Simplify registration of override-redirect windows.

This commit is contained in:
Kim Woelders 2013-11-23 20:10:19 +01:00
parent 3d86eb55fa
commit 4a0bcfccf5
4 changed files with 36 additions and 48 deletions

View File

@ -2416,9 +2416,7 @@ ECompMgrHandleRootEvent(Win win __UNUSED__, XEvent * ev, void *prm)
case_CreateNotify:
if (Conf_compmgr.override_redirect.mode != ECM_OR_ON_CREATE)
break;
eo = EobjListStackFind(xwin);
if (!eo)
EobjRegister(xwin, EOBJ_TYPE_EXT);
EobjRegisterOR(xwin, 0);
break;
case DestroyNotify:
@ -2457,19 +2455,18 @@ ECompMgrHandleRootEvent(Win win __UNUSED__, XEvent * ev, void *prm)
break;
case MapNotify:
xwin = ev->xmap.window;
#if USE_COMPOSITE_OVERLAY_WINDOW
if (ev->xmap.window == Mode_compmgr.cow)
if (xwin == Mode_compmgr.cow)
break;
#endif
eo = EobjListStackFind(ev->xmap.window);
if (!eo)
eo = EobjRegister(ev->xmap.window, EOBJ_TYPE_EXT);
if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
{
eo->shown = 1;
EobjListStackRaise(eo, 0);
ECompMgrWinMap(eo);
}
/* Register new override-redirect windows.
* Normal client windows will never go here as they first will
* generate a MapRequest (caught elsewhere) and then be reparented.
* 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);
break;
case UnmapNotify:

View File

@ -306,12 +306,17 @@ EobjWindowDestroy(EObj * eo)
}
EObj *
EobjRegister(Window xwin, int type)
EobjRegisterOR(Window xwin __UNUSED__, int mapped __UNUSED__)
{
EObj *eo;
EObj *eo = NULL;
#if USE_COMPOSITE
XWindowAttributes attr;
Win win;
if (!ECompMgrIsActive())
return NULL;
eo = EobjListStackFind(xwin);
if (eo)
return eo;
@ -319,7 +324,7 @@ EobjRegister(Window xwin, int type)
if (!EXGetWindowAttributes(xwin, &attr))
return NULL;
if (type == EOBJ_TYPE_EXT && !attr.override_redirect)
if (!attr.override_redirect)
return NULL;
win = ERegisterWindow(xwin, &attr);
@ -341,24 +346,28 @@ EobjRegister(Window xwin, int type)
eo->fade = 1;
eo->shadow = 1;
EobjInit(eo, type, win, attr.x, attr.y, attr.width, attr.height, 0, NULL);
EobjInit(eo, EOBJ_TYPE_EXT, win, attr.x, attr.y, attr.width, attr.height,
0, NULL);
#if 1 /* FIXME - TBD */
if (type == EOBJ_TYPE_EXT)
eo->shaped = 0; /* FIXME - Assume unshaped for now */
if (win->argb)
eo->shadow = 0;
EobjSetFloating(eo, 1);
EobjSetLayer(eo, 4);
if (mapped)
{
eo->shaped = 0; /* FIXME - Assume unshaped for now */
if (win->argb)
eo->shadow = 0;
EobjSetFloating(eo, 1);
EobjSetLayer(eo, 4);
eo->shown = 1;
EobjListStackRaise(eo, 0);
ECompMgrWinMap(eo);
}
#endif
#if 0
Eprintf("%s: %#lx type=%d or=%d: depth=%d argb=%d %s\n", __func__,
xwin, type, attr.override_redirect, win->depth, win->argb,
EobjGetName(eo));
Eprintf("%s: %#lx depth=%d argb=%d %s\n", __func__,
EobjGetXwin(eo), win->depth, win->argb, EobjGetName(eo));
#endif
#endif
return eo;
}
@ -372,22 +381,6 @@ EobjUnregister(EObj * eo)
EobjDestroy(eo);
}
void
EobjRegisterOR(Window xwin __UNUSED__)
{
#if USE_COMPOSITE
EObj *eo;
if (!ECompMgrIsActive())
return;
eo = EobjRegister(xwin, EOBJ_TYPE_EXT);
eo->shown = 1;
EobjListStackRaise(eo, 0);
ECompMgrWinMap(eo);
#endif
}
void
EobjMap(EObj * eo, int raise)
{

View File

@ -155,11 +155,9 @@ EObj *EobjWindowCreate(int type, int x, int y, int w, int h,
int su, const char *name);
void EobjWindowDestroy(EObj * eo);
EObj *EobjRegister(Window xwin, int type);
EObj *EobjRegisterOR(Window xwin, int mapped);
void EobjUnregister(EObj * eo);
void EobjRegisterOR(Window xwin);
void EobjMap(EObj * eo, int raise);
void EobjUnmap(EObj * eo);
void EobjMove(EObj * eo, int x, int y);

View File

@ -2247,7 +2247,7 @@ EwinsManage(void)
continue;
if (attr.override_redirect)
EobjRegisterOR(xwin);
EobjRegisterOR(xwin, 1);
else
AddToFamily(NULL, xwin, 1);
}