~unity-team/compiz-core/core.fix_edgebuttons

« back to all changes in this revision

Viewing changes to src/window.cpp

  • Committer: Sam Spilsbury
  • Date: 2011-04-30 14:07:20 UTC
  • Revision ID: git-v1:74e8e9698d8851cfb40c81bd0648dcb56032e34c
Track windows on CreateNotify again, don't rely on trying to beat the race
condition by putting that on MapRequest, instead check at reparent time
if the window has already been reparented server-side and don't reparent it
again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5107
5107
CompWindow *
5108
5108
CoreWindow::manage (Window aboveId, XWindowAttributes &wa)
5109
5109
{
5110
 
    screen->priv->createdWindows.remove (this);
5111
5110
    return new CompWindow (aboveId, wa, priv);
5112
5111
}
5113
5112
 
5114
 
/*
5115
 
 * On CreateNotify we only want to do some very basic
5116
 
 * initialization on the windows, and we need to be
5117
 
 * tracking things like eg override-redirect windows
5118
 
 * for compositing, although only on MapRequest do
5119
 
 * we actually care about them (and let the plugins
5120
 
 * care about them too)
5121
 
 */
5122
 
 
5123
5113
CoreWindow::CoreWindow (Window id)
5124
5114
{
5125
 
    priv = new PrivateWindow (this);
 
5115
    priv = new PrivateWindow ();
5126
5116
    assert (priv);
5127
 
 
5128
 
    screen->priv->createdWindows.push_back (this);
5129
 
 
5130
5117
    priv->id = id;
5131
5118
}
5132
5119
 
5369
5356
    delete priv;
5370
5357
}
5371
5358
 
5372
 
PrivateWindow::PrivateWindow (CoreWindow *window) :
 
5359
PrivateWindow::PrivateWindow () :
5373
5360
    priv (this),
5374
5361
    refcnt (1),
5375
5362
    id (None),
5684
5671
    XWindowAttributes    wa;
5685
5672
    XWindowChanges       xwc;
5686
5673
    int                  mask;
 
5674
    unsigned int         nchildren;
 
5675
    Window               *children, root_return, parent_return;
5687
5676
    CompWindow::Geometry &sg = serverGeometry;
5688
5677
    Display              *dpy = screen->dpy ();
5689
5678
    Visual               *visual = DefaultVisual (screen->dpy (),
5704
5693
        return false;
5705
5694
    }
5706
5695
 
 
5696
    /* Don't ever reparent windows which have ended up
 
5697
     * reparented themselves on the server side but not
 
5698
     * on the client side */
 
5699
 
 
5700
    XQueryTree (dpy, id, &root_return, &parent_return, &children, &nchildren);
 
5701
 
 
5702
    if (parent_return != root_return)
 
5703
    {
 
5704
        XFree (children);
 
5705
        XUngrabServer (dpy);
 
5706
        XSync (dpy, false);
 
5707
        return false;
 
5708
    }
 
5709
 
 
5710
    XFree (children);
 
5711
 
5707
5712
    XChangeSaveSet (dpy, id, SetModeInsert);
5708
5713
    XSelectInput (dpy, id, NoEventMask);
5709
5714
    XSelectInput (dpy, screen->root (), NoEventMask);