Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: comms.c desktops.c ecompmgr.c eobj.c eobj.h ewins.c ewins.h iconify.c setup.c x.c xwin.h Log Message: Eliminate a number of attribute fetches. =================================================================== RCS file: /cvs/e/e16/e/src/comms.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- comms.c 29 Apr 2006 19:39:20 -0000 1.76 +++ comms.c 21 May 2006 12:09:14 -0000 1.77 @@ -58,7 +58,12 @@ Esnprintf(st, sizeof(st), "%8x", (int)xwin); c->name = Estrdup(st); - c->win = ERegisterWindow(xwin); + c->win = ERegisterWindow(xwin, NULL); + if (!c->win) + { + Efree(c); + return NULL; + } EventCallbackRegister(c->win, 0, ClientHandleEvents, c); ESelectInput(c->win, StructureNotifyMask | SubstructureNotifyMask); =================================================================== RCS file: /cvs/e/e16/e/src/desktops.c,v retrieving revision 1.243 retrieving revision 1.244 diff -u -3 -r1.243 -r1.244 --- desktops.c 7 May 2006 16:21:37 -0000 1.243 +++ desktops.c 21 May 2006 12:09:14 -0000 1.244 @@ -353,7 +353,7 @@ } else { - EGetWindowAttributes(win, &xwa); + EXGetWindowAttributes(win, &xwa); dsk->event_mask = xwa.your_event_mask | EDESK_EVENT_MASK; event_mask = PropertyChangeMask | SubstructureRedirectMask | =================================================================== RCS file: /cvs/e/e16/e/src/ecompmgr.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -3 -r1.116 -r1.117 --- ecompmgr.c 14 May 2006 19:57:38 -0000 1.116 +++ ecompmgr.c 21 May 2006 12:09:14 -0000 1.117 @@ -86,13 +86,8 @@ EObj *next; /* Paint order */ EObj *prev; /* Paint order */ Pixmap pixmap; - struct - { - int depth; /* FIXME - Remove? */ - Visual *visual; /* FIXME - Remove? */ - int border_width; - } a; int rcx, rcy, rcw, rch; + int bw; int mode; unsigned damaged:1; unsigned fading:1; @@ -500,8 +495,8 @@ } /* Resizing - grab old contents */ - pict = - EPictureCreateBuffer(Xwin(eo->win), wo, ho, cw->a.depth, cw->a.visual); + pict = EPictureCreateBuffer(EobjGetXwin(eo), wo, ho, WinGetDepth(eo->win), + WinGetVisual(eo->win)); XRenderComposite(disp, PictOpSrc, cw->picture, None, pict, 0, 0, 0, 0, 0, 0, wo, ho); @@ -961,7 +956,7 @@ unsigned int bw; /* FIXME - Get this right */ - bw = cw->a.border_width; + bw = cw->bw; if (Mode_compmgr.use_pixmap) { cw->rcx = eo->x; @@ -1095,8 +1090,8 @@ } /* translate this */ - x = eo->x + cw->a.border_width; - y = eo->y + cw->a.border_width; + x = eo->x + cw->bw; + y = eo->y + cw->bw; ERegionTranslate(border, x, y); D2printf("shape %#lx: %d %d\n", EobjGetXwin(eo), x, y); @@ -1211,7 +1206,7 @@ if (eo->noredir) mode = WINDOW_UNREDIR; - else if (EVisualIsARGB(cw->a.visual)) + else if (eo->argb) mode = WINDOW_ARGB; else if (cw->opacity != OPAQUE) mode = WINDOW_TRANS; @@ -1434,7 +1429,7 @@ if (draw == None) return; - pictfmt = XRenderFindVisualFormat(disp, cw->a.visual); + pictfmt = XRenderFindVisualFormat(disp, WinGetVisual(eo->win)); pa.subwindow_mode = IncludeInferiors; cw->picture = XRenderCreatePicture(disp, draw, pictfmt, CPSubwindowMode, &pa); @@ -1456,7 +1451,6 @@ ECompMgrWinNew(EObj * eo) { ECmWinInfo *cw; - XWindowAttributes attr; if (!Mode_compmgr.active) /* FIXME - Here? */ return; @@ -1464,9 +1458,6 @@ if (eo->inputonly || eo->win == VRoot.win) return; - if (!XGetWindowAttributes(disp, EobjGetXwin(eo), &attr)) - return; - cw = Ecalloc(1, sizeof(ECmWinInfo)); if (!cw) return; @@ -1475,11 +1466,7 @@ eo->cmhook = cw; - cw->damaged = 0; - - cw->a.depth = attr.depth; - cw->a.visual = attr.visual; - cw->a.border_width = attr.border_width; + cw->bw = WinGetBorderWidth(eo->win); if (eo->type == EOBJ_TYPE_EXT && Conf_compmgr.override_redirect.mode == ECM_OR_UNREDIRECTED) @@ -1596,13 +1583,13 @@ change_xy = eo->x != x || eo->y != y; change_wh = eo->w != w || eo->h != h; - change_bw = cw->a.border_width != bw; + change_bw = cw->bw != bw; eo->x = x; eo->y = y; eo->w = w; eo->h = h; - cw->a.border_width = bw; + cw->bw = bw; ECompMgrWinMoveResize(eo, change_xy, change_wh, change_bw); } @@ -1739,9 +1726,7 @@ { parts = ERegionCreate(); XDamageSubtract(dpy, cw->damage, None, parts); - ERegionTranslate(parts, - eo->x + cw->a.border_width, - eo->y + cw->a.border_width); + ERegionTranslate(parts, eo->x + cw->bw, eo->y + cw->bw); #if 0 /* ENABLE_SHADOWS - FIXME - This is not right, remove? */ if (Mode_compmgr.shadow_mode == ECM_SHADOWS_SHARP) { =================================================================== RCS file: /cvs/e/e16/e/src/eobj.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- eobj.c 14 May 2006 10:43:01 -0000 1.76 +++ eobj.c 21 May 2006 12:09:14 -0000 1.77 @@ -299,11 +299,13 @@ if (type == EOBJ_TYPE_EXT && !attr.override_redirect) return NULL; + win = ERegisterWindow(xwin, &attr); + if (!win) + return NULL; + eo = Ecalloc(1, sizeof(EObj)); if (!eo) return eo; - - win = ERegisterWindow(xwin); if (attr.class == InputOnly) eo->inputonly = 1; =================================================================== RCS file: /cvs/e/e16/e/src/eobj.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- eobj.h 29 Apr 2006 19:39:21 -0000 1.28 +++ eobj.h 21 May 2006 12:09:14 -0000 1.29 @@ -48,6 +48,7 @@ unsigned noredir:1; /* Do not redirect */ unsigned shadow:1; /* Enable shadows */ unsigned fade:1; + unsigned argb:1; #if USE_COMPOSITE unsigned int opacity; void *cmhook; =================================================================== RCS file: /cvs/e/e16/e/src/ewins.c,v retrieving revision 1.163 retrieving revision 1.164 diff -u -3 -r1.163 -r1.164 --- ewins.c 16 May 2006 16:51:26 -0000 1.163 +++ ewins.c 21 May 2006 12:09:14 -0000 1.164 @@ -72,17 +72,10 @@ } static EWin * -EwinCreate(Win win, Window xwin, int type) +EwinCreate(int type) { EWin *ewin; - if (!win) - { - win = ERegisterWindow(xwin); - if (!win) - return NULL; - } - ewin = Ecalloc(1, sizeof(EWin)); ewin->type = type; @@ -101,13 +94,6 @@ ewin->lh = -1; ewin->ll = -1; - ewin->client.win = win; - ewin->client.x = -1; - ewin->client.y = -1; - ewin->client.w = -1; - ewin->client.h = -1; - ewin->client.grav = NorthWestGravity; - ewin->icccm.need_input = 1; ewin->icccm.width.min = 0; @@ -138,13 +124,20 @@ } static int -EwinGetAttributes(EWin * ewin) +EwinGetAttributes(EWin * ewin, Win win, Window xwin) { XWindowAttributes xwa; - if (!XGetWindowAttributes(disp, _EwinGetClientXwin(ewin), &xwa)) - return -1; + if (!win) + { + win = ERegisterWindow(xwin, NULL); + if (!win) + return -1; + } + EGetWindowAttributes(win, &xwa); + + ewin->client.win = win; ewin->client.x = ewin->lx = xwa.x; ewin->client.y = ewin->ly = xwa.y; ewin->client.w = ewin->lw = xwa.width; @@ -152,7 +145,6 @@ ewin->client.bw = xwa.border_width; ewin->client.cmap = xwa.colormap; ewin->client.grav = NorthWestGravity; - ewin->client.argb = EVisualIsARGB(xwa.visual); if (EventDebug(EDBUG_TYPE_SNAPS)) Eprintf("Snap get attr %#lx: %4d+%4d %4dx%4d: %s\n", @@ -199,16 +191,17 @@ if (ewin->state.docked) ewin->inh_wm.b.border = 1; - if (ewin->client.argb && Conf.argb_client_mode > 0) + if (EVisualIsARGB(WinGetVisual(_EwinGetClientWin(ewin)))) { - if (!XGetWindowAttributes(disp, _EwinGetClientXwin(ewin), &win_attr)) - return; + ewin->o.argb = 1; + + EGetWindowAttributes(_EwinGetClientWin(ewin), &win_attr); frame = ECreateVisualWindow(VRoot.win, ewin->client.x, ewin->client.y, ewin->client.w, ewin->client.h, 1, &win_attr); ewin->win_container = - ECreateVisualWindow(frame, ewin->client.x, ewin->client.y, - ewin->client.w, ewin->client.h, 0, &win_attr); + ECreateVisualWindow(frame, 0, 0, ewin->client.w, ewin->client.h, + 0, &win_attr); if (Conf.argb_client_mode == 1) ewin->inh_wm.b.border = 1; @@ -219,8 +212,7 @@ ECreateWindow(VRoot.win, ewin->client.x, ewin->client.y, ewin->client.w, ewin->client.h, 1); ewin->win_container = - ECreateWindow(frame, ewin->client.x, ewin->client.y, - ewin->client.w, ewin->client.h, 0); + ECreateWindow(frame, 0, 0, ewin->client.w, ewin->client.h, 0); } EoInit(ewin, EOBJ_TYPE_EWIN, frame, ewin->client.x, ewin->client.y, @@ -680,7 +672,7 @@ } void -AddToFamily(EWin * ewin, Window win) +AddToFamily(EWin * ewin, Window xwin) { EWin *ewin2; EWin **lst; @@ -693,13 +685,13 @@ if (ewin) EwinCleanup(ewin); else - ewin = EwinCreate(0, win, EWIN_TYPE_NORMAL); + ewin = EwinCreate(EWIN_TYPE_NORMAL); if (!ewin) goto done; - if (EwinGetAttributes(ewin)) + if (EwinGetAttributes(ewin, NULL, xwin)) { - Eprintf("Window is gone %#lx\n", win); + Eprintf("Window is gone %#lx\n", xwin); /* We got here by MapRequest. DestroyNotify should follow. */ goto done; } @@ -952,11 +944,11 @@ EGrabServer(); - ewin = EwinCreate(win, None, type); + ewin = EwinCreate(type); if (!ewin) goto done; - EwinGetAttributes(ewin); + EwinGetAttributes(ewin, win, None); EwinGetHints(ewin); EwinManage(ewin); =================================================================== RCS file: /cvs/e/e16/e/src/ewins.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -3 -r1.51 -r1.52 --- ewins.h 3 May 2006 21:04:08 -0000 1.51 +++ ewins.h 21 May 2006 12:09:14 -0000 1.52 @@ -74,7 +74,6 @@ int grav; Colormap cmap; long event_mask; - unsigned argb:1; } client; struct =================================================================== RCS file: /cvs/e/e16/e/src/iconify.c,v retrieving revision 1.209 retrieving revision 1.210 diff -u -3 -r1.209 -r1.210 --- iconify.c 14 May 2006 10:45:01 -0000 1.209 +++ iconify.c 21 May 2006 12:09:14 -0000 1.210 @@ -2706,7 +2706,7 @@ #if DEBUG_SYSTRAY Eprintf("IconboxObjSwinManage %#lx\n", xwin); #endif - win = ERegisterWindow(xwin); + win = ERegisterWindow(xwin, NULL); if (win == NoWin) return win; =================================================================== RCS file: /cvs/e/e16/e/src/setup.c,v retrieving revision 1.175 retrieving revision 1.176 diff -u -3 -r1.175 -r1.176 --- setup.c 29 Apr 2006 19:39:21 -0000 1.175 +++ setup.c 21 May 2006 12:09:14 -0000 1.176 @@ -213,7 +213,7 @@ VRoot.depth = RRoot.depth; VRoot.cmap = RRoot.cmap; - RRoot.win = ERegisterWindow(RRoot.xwin); + RRoot.win = ERegisterWindow(RRoot.xwin, NULL); if (Mode.wm.window) { @@ -231,7 +231,7 @@ CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWColormap | CWBackPixel | CWBorderPixel, &attr); - VRoot.win = ERegisterWindow(VRoot.xwin); + VRoot.win = ERegisterWindow(VRoot.xwin, NULL); /* Enable eesh and edox to pix up the virtual root */ Esnprintf(buf, sizeof(buf), "%#lx", VRoot.xwin); =================================================================== RCS file: /cvs/e/e16/e/src/x.c,v retrieving revision 1.140 retrieving revision 1.141 diff -u -3 -r1.140 -r1.141 --- x.c 14 May 2006 16:00:20 -0000 1.140 +++ x.c 21 May 2006 12:09:14 -0000 1.141 @@ -52,6 +52,7 @@ Window xwin; Win parent; int x, y, w, h; + int bw; char mapped; char in_use; signed char do_del; @@ -79,6 +80,18 @@ return win->xwin; } +int +WinGetBorderWidth(const Win win) +{ + return win->bw; +} + +int +WinGetDepth(const Win win) +{ + return win->depth; +} + Visual * WinGetVisual(const Win win) { @@ -623,7 +636,7 @@ } Win -ERegisterWindow(Window xwin) +ERegisterWindow(Window xwin, XWindowAttributes * pxwa) { EXID *xid; XWindowAttributes xwa; @@ -632,12 +645,18 @@ if (xid) goto done; - XGetWindowAttributes(disp, xwin, &xwa); + if (!pxwa) + { + pxwa = &xwa; + if (!XGetWindowAttributes(disp, xwin, pxwa)) + goto done; + } + #if 0 Eprintf("ERegisterWindow %#lx %d+%d %dx%d\n", win, x, y, w, h); #endif - xid = EXidSet(xwin, None, xwa.x, xwa.y, xwa.width, xwa.height, xwa.depth, - xwa.visual, xwa.colormap); + xid = EXidSet(xwin, None, pxwa->x, pxwa->y, pxwa->width, pxwa->height, + pxwa->depth, pxwa->visual, pxwa->colormap); xid->attached = 1; done: @@ -817,6 +836,24 @@ *root_return = VRoot.xwin; return 1; +} + +void +EGetWindowAttributes(Win win, XWindowAttributes * pxwa) +{ + EXID *xid = win; + + if (!xid) + return; + + pxwa->x = xid->x; + pxwa->y = xid->y; + pxwa->width = xid->w; + pxwa->height = xid->h; + pxwa->border_width = xid->bw; + pxwa->depth = xid->depth; + pxwa->visual = xid->visual; + pxwa->colormap = xid->cmap; } void =================================================================== RCS file: /cvs/e/e16/e/src/xwin.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- xwin.h 14 May 2006 16:00:20 -0000 1.19 +++ xwin.h 21 May 2006 12:09:14 -0000 1.20 @@ -32,6 +32,8 @@ #define Xwin(win) WinGetXwin(win) Window WinGetXwin(const Win win); +int WinGetBorderWidth(const Win win); +int WinGetDepth(const Win win); Visual *WinGetVisual(const Win win); Colormap WinGetCmap(const Win win); @@ -48,7 +50,7 @@ void ESync(void); Time EGetTimestamp(void); -Win ERegisterWindow(Window xwin); +Win ERegisterWindow(Window xwin, XWindowAttributes * pxwa); void EUnregisterWindow(Win win); void EUnregisterXwin(Window xwin); typedef void (EventCallbackFunc) (Win win, XEvent * ev, void *prm); @@ -81,6 +83,7 @@ int EGetGeometry(Win win, Window * root_return, int *x, int *y, int *w, int *h, int *bw, int *depth); +void EGetWindowAttributes(Win win, XWindowAttributes * pxwa); void EConfigureWindow(Win win, unsigned int mask, XWindowChanges * wc); void ESetWindowBackgroundPixmap(Win win, Pixmap pmap); @@ -95,8 +98,6 @@ #define ESelectInput(win, event_mask) \ XSelectInput(disp, Xwin(win), event_mask) -#define EGetWindowAttributes(win, xwa) \ - XGetWindowAttributes(disp, Xwin(win), xwa) #define EChangeWindowAttributes(win, mask, attr) \ XChangeWindowAttributes(disp, Xwin(win), mask, attr) #define ESetWindowBorderWidth(win, bw) \ @@ -139,6 +140,8 @@ int EXGetGeometry(Window xwin, Window * root_return, int *x, int *y, int *w, int *h, int *bw, int *depth); +#define EXGetWindowAttributes(win, xwa) \ + XGetWindowAttributes(disp, Xwin(win), xwa) void EXCopyArea(Drawable src, Drawable dst, int sx, int sy, unsigned int w, unsigned int h, int dx, int dy); ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs