Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: E.h Makefile.am ewins.c iconify.c warp.c Added Files: icons.c icons.h Log Message: Fix focuslist icons interfering with iconbox ones. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.435 retrieving revision 1.436 diff -u -3 -r1.435 -r1.436 --- E.h 22 May 2005 13:45:09 -0000 1.435 +++ E.h 25 May 2005 21:42:58 -0000 1.436 @@ -745,7 +745,7 @@ PmapMask mini_pmm; int mini_w, mini_h; Snapshot *snap; - Imlib_Image *icon_image; + Imlib_Image *icon_image[3]; int icon_type; int head; struct @@ -1887,9 +1887,6 @@ char expose, int image_type, TextClass * tc, TextState * ts, const char *text); -/* iconify.c */ -void UpdateAppIcon(EWin * ewin, int imode); - /* ipc.c */ void __PRINTF__ IpcPrintf(const char *fmt, ...); int HandleIPC(const char *params, Client * c); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v retrieving revision 1.48 retrieving revision 1.49 diff -u -3 -r1.48 -r1.49 --- Makefile.am 14 Mar 2005 20:19:34 -0000 1.48 +++ Makefile.am 25 May 2005 21:42:58 -0000 1.49 @@ -22,6 +22,7 @@ ecore-e16.h \ emodule.h \ ewin-ops.h \ + icons.h \ snaps.h \ timestamp.h \ aclass.c \ @@ -63,6 +64,7 @@ icccm.c \ iclass.c \ iconify.c \ + icons.c \ ipc.c \ lang.c \ lists.c \ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -3 -r1.65 -r1.66 --- ewins.c 22 May 2005 15:02:19 -0000 1.65 +++ ewins.c 25 May 2005 21:42:58 -0000 1.66 @@ -23,6 +23,7 @@ */ #include "E.h" #include "ecompmgr.h" +#include "icons.h" #include "snaps.h" #include <sys/time.h> @@ -249,11 +250,7 @@ if (ewin->session_id) Efree(ewin->session_id); FreePmapMask(&ewin->mini_pmm); - if (ewin->icon_image) - { - imlib_context_set_image(ewin->icon_image); - imlib_free_image_and_decache(); - } + EwinIconImageFree(ewin); GroupsEwinRemove(ewin); Efree(ewin); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v retrieving revision 1.151 retrieving revision 1.152 diff -u -3 -r1.151 -r1.152 --- iconify.c 22 May 2005 15:02:19 -0000 1.151 +++ iconify.c 25 May 2005 21:42:58 -0000 1.152 @@ -23,15 +23,9 @@ */ #include "E.h" #include "ecore-e16.h" +#include "icons.h" #include <math.h> -typedef enum -{ - EWIN_ICON_TYPE_APP, - EWIN_ICON_TYPE_IMG, - EWIN_ICON_TYPE_SNAP -} ewin_icon_e; - typedef struct _iconbox Iconbox; static void IconboxesConfigSave(void); @@ -675,13 +669,14 @@ SoundPlay("SOUND_ICONIFY"); ib = SelectIconboxForEwin(ewin); - if (ib) - { - if (ib->animate && !ewin->st.showingdesk) - IB_Animate(1, ewin, ib->ewin); - UpdateAppIcon(ewin, ib->icon_mode); - IconboxObjEwinAdd(ib, ewin); - } + if (!ib) + return; + + EwinIconImageGet(ewin, ib->iconsize, ib->icon_mode, 1); + IconboxObjEwinAdd(ib, ewin); + + if (ib->animate && !ewin->st.showingdesk) + IB_Animate(1, ewin, ib->ewin); } static void @@ -710,130 +705,6 @@ IconboxObjEwinDel(ib, ewin); } -static void -IB_SnapEWin(EWin * ewin) -{ - /* Make snapshot of window */ - int w, h, ww, hh, scale; - Iconbox *ib; - Imlib_Image *im; - Drawable draw; - - if (!EwinIsMapped(ewin)) - return; - - ww = EoGetW(ewin); - hh = EoGetH(ewin); - if (ww <= 0 || hh <= 0) - return; - - w = 40; - h = 40; - ib = SelectIconboxForEwin(ewin); - if (ib) - { - w = ib->iconsize; - h = ib->iconsize; - } - - /* Oversample for nicer snapshots */ - scale = 4; - w *= scale; - h *= scale; - - if (ww > hh) - h = (w * hh) / ww; - else - w = (h * ww) / hh; - if (w < 4) - w = 4; - if (h < 4) - h = 4; - if (w > ww || h > hh) - { - w = ww; - h = hh; - } - -#if USE_COMPOSITE - draw = EoGetPixmap(ewin); - if (draw != None) - { - Pixmap mask; - - mask = EWindowGetShapePixmap(EoGetWin(ewin)); - imlib_context_set_drawable(draw); - im = imlib_create_scaled_image_from_drawable(mask, 0, 0, ww, hh, - w, h, !EServerIsGrabbed(), - 0); - imlib_context_set_image(im); - imlib_image_set_has_alpha(1); /* Should be set by imlib? */ - } - else -#endif - { - draw = EoGetWin(ewin); - imlib_context_set_drawable(draw); - im = imlib_create_scaled_image_from_drawable(None, 0, 0, ww, hh, - w, h, !EServerIsGrabbed(), - 1); - imlib_context_set_image(im); - imlib_image_set_has_alpha(1); /* Should be set by imlib? */ - } - ewin->icon_image = im; - ewin->icon_type = EWIN_ICON_TYPE_SNAP; -} - -static void -IB_GetAppIcon(EWin * ewin) -{ - /* Get the applications icon pixmap/mask */ - int x, y; - unsigned int w, h, depth, bw; - Window rt; - Imlib_Image im; - - if (!ewin->client.icon_pmap) - return; - - w = 0; - h = 0; - XGetGeometry(disp, ewin->client.icon_pmap, &rt, &x, &y, &w, &h, &bw, &depth); - - if (w < 1 || h < 1) - return; - - imlib_context_set_colormap(None); - imlib_context_set_drawable(ewin->client.icon_pmap); - im = imlib_create_image_from_drawable(ewin->client.icon_mask, 0, 0, w, h, - !EServerIsGrabbed()); - imlib_context_set_image(im); - imlib_image_set_has_alpha(1); /* Should be set by imlib? */ - imlib_context_set_colormap(VRoot.cmap); - imlib_context_set_drawable(VRoot.win); - ewin->icon_image = im; - ewin->icon_type = EWIN_ICON_TYPE_APP; -} - -static void -IB_GetEIcon(EWin * ewin) -{ - /* get the icon defined for this window in E's iconf match file */ - const char *file; - Imlib_Image *im; - - file = WindowMatchEwinIcon(ewin); - if (!file) - return; - - im = ELoadImage(file); - if (!im) - return; - - ewin->icon_image = im; - ewin->icon_type = EWIN_ICON_TYPE_IMG; -} - static Iconbox ** IconboxesList(int *num) { @@ -915,7 +786,7 @@ if (IconboxObjEwinFind(ib, ewin) < 0) return; - UpdateAppIcon(ewin, icon_mode); + EwinIconImageGet(ewin, ib->iconsize, icon_mode, 1); IconboxRedraw(ib); } @@ -934,80 +805,6 @@ Efree(ib); } -void -UpdateAppIcon(EWin * ewin, int imode) -{ - /* free whatever we had before */ - if (ewin->icon_image) - { - imlib_context_set_image(ewin->icon_image); - imlib_free_image(); - ewin->icon_image = NULL; - } - - switch (imode) - { - case 0: - /* snap first - if fails try app, then e */ - if (!ewin->icon_image) - { - if (ewin->shaded) - EwinInstantUnShade(ewin); - RaiseEwin(ewin); - IB_SnapEWin(ewin); - } - if (!ewin->icon_image) - IB_GetAppIcon(ewin); - if (!ewin->icon_image) - IB_GetEIcon(ewin); - break; - case 1: - /* try app first, then e, then snap */ - if (!ewin->icon_image) - IB_GetAppIcon(ewin); - if (!ewin->icon_image) - IB_GetEIcon(ewin); - if (!ewin->icon_image) - { - if (ewin->shaded) - EwinInstantUnShade(ewin); - RaiseEwin(ewin); - IB_SnapEWin(ewin); - } - break; - case 2: - /* try E first, then snap, then app */ - if (!ewin->icon_image) - IB_GetEIcon(ewin); - if (!ewin->icon_image) - { - if (ewin->shaded) - EwinInstantUnShade(ewin); - RaiseEwin(ewin); - IB_SnapEWin(ewin); - } - if (!ewin->icon_image) - IB_GetAppIcon(ewin); - break; - case 3: - /* try E first, then app */ - if (!ewin->icon_image) - IB_GetEIcon(ewin); - if (!ewin->icon_image) - IB_GetAppIcon(ewin); - break; - case 4: - /* try app first, then E */ - if (!ewin->icon_image) - IB_GetAppIcon(ewin); - if (!ewin->icon_image) - IB_GetEIcon(ewin); - break; - default: - break; - } -} - static void IconboxFindIconSize(Imlib_Image * im, int *pw, int *ph, int size) { @@ -1091,13 +888,13 @@ if (ib->type == IB_TYPE_ICONBOX) { EWin *ewin; + Imlib_Image *im; ewin = ibo->u.ewin; - if (!ewin->icon_image) - UpdateAppIcon(ewin, ib->icon_mode); + im = EwinIconImageGet(ewin, ib->iconsize, ib->icon_mode, 0); wi = hi = 8; - if (ewin->icon_image) - IconboxFindIconSize(ewin->icon_image, &wi, &hi, ib->iconsize); + if (im) + IconboxFindIconSize(im, &wi, &hi, ib->iconsize); } else { @@ -1857,19 +1654,20 @@ if (ib->type == IB_TYPE_ICONBOX) { EWin *ewin; + Imlib_Image *ii; ewin = ib->objs[i].u.ewin; - if (ewin->icon_image) + ii = EwinIconImageGet(ewin, ib->iconsize, ib->icon_mode, 0); + if (ii) { - imlib_context_set_image(ewin->icon_image); + imlib_context_set_image(ii); ww = imlib_image_get_width(); hh = imlib_image_get_height(); imlib_context_set_image(im); imlib_context_set_anti_alias(1); imlib_context_set_blend(1); - imlib_blend_image_onto_image(ewin->icon_image, 1, - 0, 0, ww, hh, + imlib_blend_image_onto_image(ii, 1, 0, 0, ww, hh, ibo->xi, ibo->yi, ibo->wi, ibo->hi); imlib_context_set_blend(0); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -3 -r1.64 -r1.65 --- warp.c 21 May 2005 20:58:18 -0000 1.64 +++ warp.c 25 May 2005 21:42:59 -0000 1.65 @@ -37,6 +37,7 @@ * selected one. */ #include "E.h" +#include "icons.h" #include <X11/keysym.h> typedef struct @@ -65,6 +66,7 @@ int i, x, y, w, h, num, ww, hh; static int mw, mh, tw, th; char s[1024]; + WarplistItem *wl; tc = TextclassFind("WARPFOCUS", 0); if (!tc) @@ -106,13 +108,13 @@ warplist_num++; warplist = Erealloc(warplist, warplist_num * sizeof(WarplistItem)); - warplist[warplist_num - 1].win = - ECreateWindow(warpFocusWindow->win, 0, 0, 1, 1, 0); - EMapWindow(warplist[warplist_num - 1].win); - warplist[warplist_num - 1].ewin = lst[i]; + wl = warplist + warplist_num - 1; + wl->win = ECreateWindow(warpFocusWindow->win, 0, 0, 1, 1, 0); + EMapWindow(wl->win); + wl->ewin = lst[i]; Esnprintf(s, sizeof(s), (lst[i]->iconified) ? "[%s]" : "%s", EwinGetName(lst[i])); - warplist[warplist_num - 1].txt = strdup(s); + wl->txt = strdup(s); TextSize(tc, 0, 0, 0, warplist[warplist_num - 1].txt, &ww, &hh, 17); if (ww > w) @@ -161,33 +163,35 @@ for (i = 0; i < warplist_num; i++) { - if (!FindItem((char *)warplist[i].ewin, 0, LIST_FINDBY_POINTER, - LIST_TYPE_EWIN)) - warplist[i].ewin = NULL; - if (warplist[i].ewin) + wl = warplist + i; + + if (!FindItem((char *)wl->ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN)) + wl->ewin = NULL; + if (wl->ewin) { int state; - state = (ewin == warplist[i].ewin) ? STATE_CLICKED : STATE_NORMAL; + state = (ewin == wl->ewin) ? STATE_CLICKED : STATE_NORMAL; - ImageclassApply(ic, warplist[i].win, mw, mh, 0, 0, state, 0, - ST_WARPLIST); + ImageclassApply(ic, wl->win, mw, mh, 0, 0, state, 0, ST_WARPLIST); /* New icon stuff */ if (Conf.warplist.icon_mode != 0) { int icon_size = mh - 2 * ICON_PAD; + Imlib_Image *im; - TextDraw(tc, warplist[i].win, 0, 0, state, warplist[i].txt, + TextDraw(tc, wl->win, 0, 0, state, wl->txt, ic->padding.left + mh, ic->padding.top, tw, th, 0, 0); - UpdateAppIcon(warplist[i].ewin, Conf.warplist.icon_mode); - if (!warplist[i].ewin->icon_image) + im = EwinIconImageGet(wl->ewin, icon_size, + Conf.warplist.icon_mode, 1); + if (!im) continue; - imlib_context_set_image(warplist[i].ewin->icon_image); - imlib_context_set_drawable(warplist[i].win); + imlib_context_set_image(im); + imlib_context_set_drawable(wl->win); imlib_context_set_blend(1); imlib_render_image_on_drawable_at_size(ic->padding.left + ICON_PAD, ICON_PAD, @@ -196,8 +200,8 @@ } else { - TextclassApply(ic, warplist[i].win, mw, mh, 0, 0, state, 0, - tc, warplist[i].txt); + TextclassApply(ic, wl->win, mw, mh, 0, 0, state, 0, + tc, wl->txt); } } } ------------------------------------------------------- SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate online with coworkers and clients while avoiding the high cost of travel and communications. There is no equipment to buy and you can meet as often as you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs