1068
1068
* manage it straight away - in reality we want
1069
1069
* that to wait until the map request */
1070
1070
if (failure || (wa.root == priv->root))
1072
/* Our SubstructureRedirectMask doesn't work on OverrideRedirect
1073
* windows so we need to track them directly here */
1074
if (!event->xcreatewindow.override_redirect)
1075
new CoreWindow (event->xcreatewindow.window);
1079
new CoreWindow (event->xcreatewindow.window);
1083
w = cw->manage (priv->getTopWindow (), wa);
1084
priv->createdWindows.remove (cw);
1072
CoreWindow *cw = new CoreWindow (event->xcreatewindow.window);
1073
cw->manage (priv->getTopWindow (), wa);
1075
priv->createdWindows.remove (cw);
1090
1079
XSelectInput (priv->dpy, event->xcreatewindow.window,
1091
1080
FocusChangeMask);
1099
1088
w->moveInputFocusToOtherWindow ();
1104
foreach (CoreWindow *cw, priv->createdWindows)
1106
if (cw->priv->id == event->xdestroywindow.window)
1108
priv->createdWindows.remove (cw);
1115
1092
case MapNotify:
1117
/* Some broken applications and toolkits (eg QT) will lie to
1118
* us about their override-redirect mask - not setting it on
1119
* the initial CreateNotify and then setting it later on
1120
* just after creation. Unfortunately, this means that QT
1121
* has successfully bypassed both of our window tracking
1122
* mechanisms (eg, not override-redirect at CreateNotify time
1123
* and then bypassing MapRequest because it *is* override-redirect
1124
* at XMapWindow time, so we need to catch this case and make
1125
* sure that windows are tracked here */
1127
foreach (CoreWindow *cw, priv->createdWindows)
1129
if (cw->priv->id == event->xmap.window)
1131
/* Failure means the window has been destroyed, but
1132
* still add it to the window list anyways since we
1133
* will soon handle the DestroyNotify event for it
1134
* and in between CreateNotify time and DestroyNotify
1135
* time there might be ConfigureRequests asking us
1136
* to stack windows relative to it
1138
if (!XGetWindowAttributes (screen->dpy (), cw->priv->id, &wa))
1139
priv->setDefaultWindowAttributes (&wa);
1141
w = cw->manage (priv->getTopWindow (), wa);
1142
priv->createdWindows.remove (cw);
1148
1094
/* Search in already-created windows for this window */
1150
1096
w = findWindow (event->xmap.window);
1233
1179
if (!XGetWindowAttributes (priv->dpy, event->xcreatewindow.window, &wa))
1234
1180
priv->setDefaultWindowAttributes (&wa);
1236
CoreWindow *cw = new CoreWindow (event->xreparent.window);
1240
cw->manage (priv->getTopWindow (), wa);
1241
priv->createdWindows.remove (cw);
1182
CoreWindow *cw = new CoreWindow (event->xcreatewindow.window);
1183
cw->manage (priv->getTopWindow (), wa);
1185
priv->createdWindows.remove (cw);
1245
1189
else if (event->xreparent.parent != priv->root)
1714
foreach (CoreWindow *cw, priv->createdWindows)
1716
if (cw->priv->id == event->xmaprequest.window)
1718
/* Failure means the window has been destroyed, but
1719
* still add it to the window list anyways since we
1720
* will soon handle the DestroyNotify event for it
1721
* and in between CreateNotify time and DestroyNotify
1722
* time there might be ConfigureRequests asking us
1723
* to stack windows relative to it
1725
if (!XGetWindowAttributes (screen->dpy (), cw->priv->id, &wa))
1726
priv->setDefaultWindowAttributes (&wa);
1728
w = cw->manage (priv->getTopWindow (), wa);
1729
priv->createdWindows.remove (cw);
1736
1647
w = screen->findWindow (event->xmaprequest.window);