Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: ecompmgr.c Log Message: Use some macros to simplify code. Minor reorganization of root stuff. =================================================================== RCS file: /cvs/e/e16/e/src/ecompmgr.c,v retrieving revision 1.147 retrieving revision 1.148 diff -u -3 -r1.147 -r1.148 --- ecompmgr.c 22 Apr 2007 12:27:16 -0000 1.147 +++ ecompmgr.c 22 Apr 2007 14:08:35 -0000 1.148 @@ -230,11 +230,16 @@ EObj ** first, EObj ** last, Desk * dsk, XserverRegion clip); +#define PIXMAP_DESTROY(pmap) \ + if (pmap != None) { XFreePixmap(disp, pmap); pmap = None; } +#define PICTURE_DESTROY(pict) \ + if (pict != None) { XRenderFreePicture(disp, pict); pict = None; } +#define REGION_DESTROY(rgn) \ + if (rgn != None) { ERegionDestroy(rgn); rgn = None; } + /* * Regions */ -#define REGION_DESTROY(rgn) \ - if (rgn != None) { ERegionDestroy(rgn); rgn = None; } static XserverRegion ERegionCreate(void) @@ -322,19 +327,6 @@ } static void -ERegionLimit(XserverRegion rgn) -{ - XserverRegion screen; - - screen = Mode_compmgr.rgn_screen; - if (screen == None) - Mode_compmgr.rgn_screen = screen = - ERegionCreateRect(0, 0, VRoot.w, VRoot.h); - - ERegionIntersect(rgn, screen); -} - -static void ERegionSubtractOffset(XserverRegion dst, int dx, int dy, XserverRegion src) { Display *dpy = disp; @@ -1137,49 +1129,27 @@ what |= INV_PICTURE; } - if ((what & INV_GEOM) && cw->shape != None) - { - ERegionDestroy(cw->shape); - cw->shape = None; - } + if (what & INV_GEOM) + REGION_DESTROY(cw->shape); - if ((what & INV_PICTURE) && cw->picture != None) - { - XRenderFreePicture(dpy, cw->picture); - cw->picture = None; - } + if (what & INV_PICTURE) + PICTURE_DESTROY(cw->picture); - if ((what & INV_OPACITY) && cw->pict_alpha != None) - { - XRenderFreePicture(dpy, cw->pict_alpha); - cw->pict_alpha = None; - } + if (what & INV_OPACITY) + PICTURE_DESTROY(cw->pict_alpha); - if ((what & (INV_CLIP | INV_GEOM)) && cw->clip != None) - { - ERegionDestroy(cw->clip); - cw->clip = None; - } + if (what & (INV_CLIP | INV_GEOM)) + REGION_DESTROY(cw->clip); #if ENABLE_SHADOWS - if ((what & (INV_SIZE | INV_SHADOW)) && cw->shadow_pict != None) - { - XRenderFreePicture(dpy, cw->shadow_pict); - cw->shadow_pict = None; - what |= INV_GEOM; - } - if ((what & (INV_OPACITY | INV_SHADOW)) && cw->shadow_alpha != None) - { - XRenderFreePicture(dpy, cw->shadow_alpha); - cw->shadow_alpha = None; - } + if (what & (INV_SIZE | INV_SHADOW)) + PICTURE_DESTROY(cw->shadow_pict); + if (what & (INV_OPACITY | INV_SHADOW)) + PICTURE_DESTROY(cw->shadow_alpha); #endif - if ((what & (INV_GEOM | INV_SHADOW)) && cw->extents != None) - { - ERegionDestroy(cw->extents); - cw->extents = None; - } + if (what & (INV_GEOM | INV_SHADOW)) + REGION_DESTROY(cw->extents); } static void @@ -1805,9 +1775,7 @@ cw = eo->cmhook; if (!cw) continue; - if (cw->clip != None) - ERegionDestroy(cw->clip); - cw->clip = None; + REGION_DESTROY(cw->clip); } } @@ -2155,16 +2123,13 @@ if (!Mode_compmgr.active || !Mode_compmgr.got_damage) return; - ERegionLimit(Mode_compmgr.damage); + ERegionIntersect(Mode_compmgr.damage, Mode_compmgr.rgn_screen); D2printf("ECompMgrRepaint rootBuffer=%#lx rootPicture=%#lx\n", rootBuffer, rootPicture); if (EDebug(EDBUG_TYPE_COMPMGR)) ERegionShow("damage", Mode_compmgr.damage); - if (!rootBuffer) - rootBuffer = EPictureCreateBuffer(VRoot.xwin, VRoot.w, VRoot.h, - VRoot.depth, VRoot.vis, &VRoot.pmap); pbuf = rootBuffer; if (!dsk) @@ -2221,15 +2186,22 @@ } static void +ECompMgrRootBufferCreate(unsigned int w, unsigned int h) +{ + /* Root buffer picture and pixmap */ + rootBuffer = EPictureCreateBuffer(VRoot.xwin, w, h, + VRoot.depth, VRoot.vis, &VRoot.pmap); + + /* Screen region */ + Mode_compmgr.rgn_screen = ERegionCreateRect(0, 0, w, h); +} + +static void ECompMgrRootBufferDestroy(void) { /* Root buffer picture and pixmap */ - if (rootBuffer != None) - XRenderFreePicture(disp, rootBuffer); - rootBuffer = None; - if (VRoot.pmap != None) - XFreePixmap(disp, VRoot.pmap); - VRoot.pmap = None; + PICTURE_DESTROY(rootBuffer); + PIXMAP_DESTROY(VRoot.pmap); /* Screen region */ REGION_DESTROY(Mode_compmgr.rgn_screen); @@ -2239,8 +2211,9 @@ ECompMgrRootConfigure(void *prm __UNUSED__, XEvent * ev) { D1printf("ECompMgrRootConfigure root\n"); - if (ev->xconfigure.window == VRoot.xwin) - ECompMgrRootBufferDestroy(); + + ECompMgrRootBufferDestroy(); + ECompMgrRootBufferCreate(ev->xconfigure.width, ev->xconfigure.height); } #if USE_DESK_EXPOSE /* FIXME - Remove? */ @@ -2308,9 +2281,7 @@ } else { - if (transBlackPicture) - XRenderFreePicture(disp, transBlackPicture); - transBlackPicture = None; + PICTURE_DESTROY(transBlackPicture); } if (cleanup) @@ -2348,6 +2319,8 @@ Conf_compmgr.override_redirect.opacity = OpacityFix(Conf_compmgr.override_redirect.opacity, 100); + ECompMgrRootBufferCreate(VRoot.w, VRoot.h); + Mode_compmgr.root = VRoot.xwin; #if USE_COMPOSITE_OVERLAY_WINDOW if (Conf_compmgr.use_cow && !Mode.wm.window) @@ -2440,9 +2413,7 @@ SelectionRelease(wm_cm_sel); wm_cm_sel = NULL; - if (rootPicture) - XRenderFreePicture(disp, rootPicture); - rootPicture = None; + PICTURE_DESTROY(rootPicture); ECompMgrRootBufferDestroy(); ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs