Avoid redundant calls of XGetWindowAttributes (eobjs).

This commit is contained in:
Kim Woelders 2013-11-23 20:29:40 +01:00
parent 1452bdec56
commit 1294510ef2
4 changed files with 18 additions and 12 deletions

View File

@ -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:

View File

@ -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))
if (!pxwa)
{
pxwa = &attr;
if (!EXGetWindowAttributes(xwin, &attr))
return NULL;
}
if (!pxwa->override_redirect)
return NULL;
if (!attr.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 */

View File

@ -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);

View File

@ -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);
}