Merge lp:~compiz-team/compiz-core/compiz-core.fix_865863 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2855
Proposed branch: lp:~compiz-team/compiz-core/compiz-core.fix_865863
Merge into: lp:compiz-core/0.9.5
Diff against target: 119 lines (+56/-49)
1 file modified
src/event.cpp (+56/-49)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/compiz-core.fix_865863
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+78033@code.launchpad.net

This proposal supersedes a proposal from 2011-10-04.

Description of the change

Fixes Bug 865863

Handle windows that reparent into the root window correclty

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Do you really need to create the CoreWindow on the stack?

Could you do this:

CoreWindow cw(event->xcreatewindow.window);
cw.manage (priv->getTopWindow (), wa);
priv->createdWindows.remove (&cw);
break;

// NOTE: no delete needed.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Yes, because CoreWindow's constructor adds itself to priv->createdWindows. Yeah, I know, that's bad, but I plan to kill CoreWindow anyways

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/event.cpp'
--- src/event.cpp 2011-10-02 07:17:59 +0000
+++ src/event.cpp 2011-10-04 03:34:34 +0000
@@ -1240,59 +1240,66 @@
1240 }1240 }
1241 break;1241 break;
1242 case ReparentNotify:1242 case ReparentNotify:
1243
1243 w = findWindow (event->xreparent.window);1244 w = findWindow (event->xreparent.window);
12441245
1245 /* It is possible that some plugin might call1246 /* If this window isn't part of our tracked window
1246 * w->destroy () before the window actually receives1247 * list and was reparented into the root window then
1247 * its first ReparentNotify event which would mean1248 * we need to track it */
1248 * that it is already in the list of destroyed
1249 * windows, so check that list too */
1250 if (!w)1249 if (!w)
1251 {1250 {
1252 foreach (CompWindow *dw, screen->priv->destroyedWindows)1251 if (event->xreparent.parent == priv->root)
1253 {1252 {
1254 if (dw->priv->serverId == event->xdestroywindow.window)1253 /* Failure means that window has been destroyed. We still have to add
1255 {1254 * the window to the window list as we might get configure requests
1256 w = dw;1255 * which require us to stack other windows relative to it. Setting
1257 break;1256 * some default values if this is the case. */
1258 }1257 if (!XGetWindowAttributes (priv->dpy, event->xcreatewindow.window, &wa))
1259 }1258 priv->setDefaultWindowAttributes (&wa);
1260 }1259
12611260 CoreWindow *cw = new CoreWindow (event->xcreatewindow.window);
1262 if (!w && event->xreparent.parent == priv->root)1261 cw->manage (priv->getTopWindow (), wa);
1263 {1262
1264 /* Failure means that window has been destroyed. We still have to add 1263 priv->createdWindows.remove (cw);
1265 * the window to the window list as we might get configure requests1264 delete cw;
1266 * which require us to stack other windows relative to it. Setting1265 break;
1267 * some default values if this is the case. */1266 }
1268 if (!XGetWindowAttributes (priv->dpy, event->xcreatewindow.window, &wa))1267 else
1269 priv->setDefaultWindowAttributes (&wa);1268 {
12701269 /* It is possible that some plugin might call
1271 CoreWindow *cw = new CoreWindow (event->xcreatewindow.window);1270 * w->destroy () before the window actually receives
1272 cw->manage (priv->getTopWindow (), wa);1271 * its first ReparentNotify event which would mean
12731272 * that it is already in the list of destroyed
1274 priv->createdWindows.remove (cw);1273 * windows, so check that list too */
1275 delete cw;1274
1276 }1275 foreach (CompWindow *dw, screen->priv->destroyedWindows)
1277 else if (!(event->xreparent.parent == priv->root))1276 {
1278 {1277 if (dw->priv->serverId == event->xreparent.window)
1279 /* This is the only case where a window is removed but not1278 {
1280 destroyed. We must remove our event mask and all passive1279 w = dw;
1281 grabs. */1280 break;
12821281 }
1283 if (w)1282 }
1284 {1283 }
1285 if (event->xreparent.parent != w->priv->wrapper)1284 }
1286 {1285
1287 w->moveInputFocusToOtherWindow ();1286 /* This is the only case where a window is removed but not
1288 w->destroy ();1287 destroyed. We must remove our event mask and all passive
12891288 grabs. */
1290 XSelectInput (priv->dpy, w->id (), NoEventMask);1289
1291 XShapeSelectInput (priv->dpy, w->id (), NoEventMask);1290 if (w)
1292 XUngrabButton (priv->dpy, AnyButton, AnyModifier, w->id ());1291 {
1293 }1292 if (event->xreparent.parent != w->priv->wrapper)
1294 }1293 {
1295 }1294 w->moveInputFocusToOtherWindow ();
1295 w->destroy ();
1296
1297 XSelectInput (priv->dpy, w->id (), NoEventMask);
1298 XShapeSelectInput (priv->dpy, w->id (), NoEventMask);
1299 XUngrabButton (priv->dpy, AnyButton, AnyModifier, w->id ());
1300 }
1301 }
1302
1296 break;1303 break;
1297 case CirculateNotify:1304 case CirculateNotify:
1298 w = findWindow (event->xcirculate.window);1305 w = findWindow (event->xcirculate.window);

Subscribers

People subscribed via source and target branches