From: <enl...@li...> - 2005-08-04 22:05:40
|
Enlightenment CVS committal Author : kwo Project : e16 Module : e Dir : e16/e/src Modified Files: E.h backgrounds.c desktops.c iclass.c pager.c Log Message: Simplify. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.474 retrieving revision 1.475 diff -u -3 -r1.474 -r1.475 --- E.h 2 Aug 2005 16:50:32 -0000 1.474 +++ E.h 4 Aug 2005 22:05:24 -0000 1.475 @@ -1548,6 +1548,9 @@ ImageClass *ImageclassFind(const char *name, int fallback); Imlib_Image *ImageclassGetImage(ImageClass * ic, int active, int sticky, int state); +Pixmap ImageclassApplySimple(ImageClass * ic, Window win, + Drawable draw, int state, int x, + int y, int w, int h); void ImageclassApply(ImageClass * ic, Window win, int w, int h, int active, int sticky, int state, char expose, int image_type); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- backgrounds.c 2 Aug 2005 16:50:35 -0000 1.39 +++ backgrounds.c 4 Aug 2005 22:05:28 -0000 1.40 @@ -1735,6 +1735,7 @@ int x; Pixmap pmap; GC gc; + ImageClass *ic_button; bglist = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND); if (!bglist) @@ -1746,6 +1747,8 @@ pmap = ECreatePixmap(win, w, h, VRoot.depth); gc = ECreateGC(pmap, 0, NULL); + ic_button = ImageclassFind("DIALOG_BUTTON", 0); + XSetForeground(disp, gc, BlackPixel(disp, VRoot.scr)); XFillRectangle(disp, pmap, gc, 0, 0, w, h); ESetWindowBackgroundPixmap(win, pmap); @@ -1756,24 +1759,13 @@ { if (((x + 64 + 8) >= 0) && (x < w)) { - ImageClass *ic; Imlib_Image *im; - ic = ImageclassFind("DIALOG_BUTTON", 0); - if (ic) - { - PmapMask pmm; - - if (i == tmp_bg_selected) - ImageclassApplyCopy(ic, pmap, 64 + 8, 48 + 8, 0, 0, - STATE_CLICKED, &pmm, 0, ST_UNKNWN); - else - ImageclassApplyCopy(ic, pmap, 64 + 8, 48 + 8, 0, 0, - STATE_NORMAL, &pmm, 0, ST_UNKNWN); - XCopyArea(disp, pmm.pmap, pmap, gc, 0, 0, 64 + 8, 48 + 8, x, - 0); - FreePmapMask(&pmm); - } + if (ic_button) + ImageclassApplySimple(ic_button, win, pmap, + (i == tmp_bg_selected) ? + STATE_CLICKED : STATE_NORMAL, + x, 0, 64 + 8, 48 + 8); if (!strcmp(BackgroundGetName(bglist[i]), "NONE")) { =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v retrieving revision 1.160 retrieving revision 1.161 diff -u -3 -r1.160 -r1.161 --- desktops.c 2 Aug 2005 16:50:35 -0000 1.160 +++ desktops.c 4 Aug 2005 22:05:29 -0000 1.161 @@ -1932,27 +1932,30 @@ static void CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data) { - char s[64]; + static int prev_ax = 0, prev_ay = 0; static char called = 0; + static Window awin; + char s[64]; DItem *di; - static Window win, awin; + Window win; int w, h; - static int prev_ax = 0, prev_ay = 0; if (val == 1) called = 0; if ((val != 1) && ((prev_ax == tmp_area_x) && (prev_ay == tmp_area_y))) return; + prev_ax = tmp_area_x; prev_ay = tmp_area_y; + di = (DItem *) data; win = DialogItemAreaGetWindow(di); DialogItemAreaGetSize(di, &w, &h); + if (!called) { ImageClass *ic; - PmapMask pmm; ic = ImageclassFind("SETTINGS_AREA_AREA", 0); if (ic) @@ -1961,10 +1964,12 @@ ic = ImageclassFind("SETTINGS_AREADESK_AREA", 0); if (ic) { - ImageclassApplyCopy(ic, awin, 18, 14, 0, 0, STATE_NORMAL, &pmm, 0, - ST_UNKNWN); - ESetWindowBackgroundPixmap(awin, pmm.pmap); - FreePmapMask(&pmm); + Pixmap pmap; + + pmap = ImageclassApplySimple(ic, awin, None, STATE_NORMAL, + 0, 0, 18, 14); + ESetWindowBackgroundPixmap(awin, pmap); + EFreePixmap(pmap); } EClearWindow(awin); called = 1; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -3 -r1.71 -r1.72 --- iclass.c 17 Jul 2005 12:55:13 -0000 1.71 +++ iclass.c 4 Aug 2005 22:05:30 -0000 1.72 @@ -687,6 +687,32 @@ return im; } +Pixmap +ImageclassApplySimple(ImageClass * ic, Window win, Drawable draw, int state, + int x, int y, int w, int h) +{ + Pixmap pmap; + Imlib_Image *im; + + im = ImageclassGetImage(ic, 0, 0, state); + if (!im) + return None; + + pmap = None; + if (draw == None) + { + pmap = ECreatePixmap(win, w, h, VRoot.depth); + draw = pmap; + x = y = 0; + } + imlib_context_set_image(im); + imlib_context_set_drawable(draw); + imlib_render_image_on_drawable_at_size(x, y, w, h); + imlib_free_image(); + + return pmap; +} + static void ImagestateMakePmapMask(ImageState * is, Drawable win, PmapMask * pmm, int make_mask, int w, int h, int image_type) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.169 retrieving revision 1.170 diff -u -3 -r1.169 -r1.170 --- pager.c 4 Aug 2005 16:01:59 -0000 1.169 +++ pager.c 4 Aug 2005 22:05:31 -0000 1.170 @@ -288,12 +288,17 @@ if (use_iclass) { - ImageClass *ic = NULL; + ImageClass *ic; ic = ImageclassFind("PAGER_WIN", 0); if (ic) - ImageclassApplyCopy(ic, EoGetWin(ewin), w, h, 0, 0, - STATE_NORMAL, &ewin->mini_pmm, 1, ST_UNKNWN); + { + ewin->mini_pmm.type = 0; + ewin->mini_pmm.mask = None; + ewin->mini_pmm.pmap = + ImageclassApplySimple(ic, p->win, None, STATE_NORMAL, + 0, 0, w, h); + } } else { @@ -483,18 +488,11 @@ if (!Conf.pagers.snap) { ImageClass *ic; - PmapMask pmm; ic = ImageclassFind("PAGER_BACKGROUND", 0); if (ic) - ImageclassApplyCopy(ic, pmap, p->dw, p->dh, 0, 0, - STATE_NORMAL, &pmm, 0, ST_UNKNWN); - gc = ECreateGC(pmap, 0, NULL); - if (gc == None) - return; - XCopyArea(disp, pmm.pmap, pmap, gc, 0, 0, p->dw, p->dh, 0, 0); - EFreeGC(gc); - FreePmapMask(&pmm); + ImageclassApplySimple(ic, p->win, pmap, STATE_NORMAL, + 0, 0, p->dw, p->dh); return; } |