kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=1294510ef2693323f08748d7645ed90690f8f0c1
commit 1294510ef2693323f08748d7645ed90690f8f0c1 Author: Kim Woelders <[email protected]> Date: Sat Nov 23 20:29:40 2013 +0100 Avoid redundant calls of XGetWindowAttributes (eobjs). --- src/ecompmgr.c | 4 ++-- src/eobj.c | 18 +++++++++++------- src/eobj.h | 3 ++- src/ewins.c | 5 +++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/ecompmgr.c b/src/ecompmgr.c index 0c3c54c..de04871 100644 --- a/src/ecompmgr.c +++ b/src/ecompmgr.c @@ -2416,7 +2416,7 @@ ECompMgrHandleRootEvent(Win win __UNUSED__, XEvent * ev, void *prm) case_CreateNotify: if (Conf_compmgr.override_redirect.mode != ECM_OR_ON_CREATE) break; - EobjRegisterOR(xwin, 0); + EobjRegisterOR(xwin, NULL, 0); break; case DestroyNotify: @@ -2466,7 +2466,7 @@ ECompMgrHandleRootEvent(Win win __UNUSED__, XEvent * ev, void *prm) * The client frame windows (on desk 0) and internal ones (with root * parent) will go here when mapped and will be ignored as they are * already registered. */ - EobjRegisterOR(xwin, 1); + EobjRegisterOR(xwin, NULL, 1); break; case UnmapNotify: diff --git a/src/eobj.c b/src/eobj.c index c5fea3c..57628d3 100644 --- a/src/eobj.c +++ b/src/eobj.c @@ -306,7 +306,8 @@ EobjWindowDestroy(EObj * eo) } EObj * -EobjRegisterOR(Window xwin __UNUSED__, int mapped __UNUSED__) +EobjRegisterOR(Window xwin __UNUSED__, XWindowAttributes * pxwa __UNUSED__, + int mapped __UNUSED__) { EObj *eo = NULL; @@ -321,13 +322,16 @@ EobjRegisterOR(Window xwin __UNUSED__, int mapped __UNUSED__) if (eo) return eo; - if (!EXGetWindowAttributes(xwin, &attr)) - return NULL; - - if (!attr.override_redirect) + if (!pxwa) + { + pxwa = &attr; + if (!EXGetWindowAttributes(xwin, &attr)) + return NULL; + } + if (!pxwa->override_redirect) return NULL; - win = ERegisterWindow(xwin, &attr); + win = ERegisterWindow(xwin, pxwa); if (!win) return NULL; @@ -346,7 +350,7 @@ EobjRegisterOR(Window xwin __UNUSED__, int mapped __UNUSED__) eo->fade = 1; eo->shadow = 1; - EobjInit(eo, EOBJ_TYPE_EXT, win, attr.x, attr.y, attr.width, attr.height, + EobjInit(eo, EOBJ_TYPE_EXT, win, pxwa->x, pxwa->y, pxwa->width, pxwa->height, 0, NULL); eo->shaped = 0; /* FIXME - Assume unshaped for now */ diff --git a/src/eobj.h b/src/eobj.h index 9c0b874..ceee1ce 100644 --- a/src/eobj.h +++ b/src/eobj.h @@ -155,7 +155,8 @@ EObj *EobjWindowCreate(int type, int x, int y, int w, int h, int su, const char *name); void EobjWindowDestroy(EObj * eo); -EObj *EobjRegisterOR(Window xwin, int mapped); +EObj *EobjRegisterOR(Window xwin, XWindowAttributes * pxwa, + int mapped); void EobjUnregister(EObj * eo); void EobjMap(EObj * eo, int raise); diff --git a/src/ewins.c b/src/ewins.c index 641acf0..8faf2a9 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -747,7 +747,8 @@ AddToFamily(EWin * ewin, Window xwin, XWindowAttributes * pxwa, int startup) if (!pxwa) { pxwa = &attr; - EXGetWindowAttributes(xwin, &attr); + if (!EXGetWindowAttributes(xwin, &attr)) + goto done; } if (ewin) @@ -2254,7 +2255,7 @@ EwinsManage(void) continue; if (attr.override_redirect) - EobjRegisterOR(xwin, 1); + EobjRegisterOR(xwin, &attr, 1); else AddToFamily(NULL, xwin, &attr, 1); } --
