summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-01-27 10:19:51 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-01-27 10:19:51 +0800
commit90cf1ceded2c75b78de6b20bbae0786888a4c399 (patch)
treec5ea23deccca9efb37580568d7e81c562b6e61b9 /src
parentf3262eed20ce32f1162586df511d559bace4008c (diff)
downloadmobileperf-90cf1ceded2c75b78de6b20bbae0786888a4c399.tar.gz
mobileperf-90cf1ceded2c75b78de6b20bbae0786888a4c399.tar.bz2
Don't track window geometries or properties until they are actually managed.
The window might get some ConfigureRequests which won't be reflected in PrivateWindow at MapRequest time. Fixes LP #707853
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp34
-rw-r--r--src/privatewindow.h4
-rw-r--r--src/screen.cpp4
-rw-r--r--src/window.cpp39
4 files changed, 51 insertions, 30 deletions
diff --git a/src/event.cpp b/src/event.cpp
index ddded38..9eb2093 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1075,15 +1075,15 @@ CompScreen::handleEvent (XEvent *event)
/* Our SubstructureRedirectMask doesn't work on OverrideRedirect
* windows so we need to track them directly here */
if (!event->xcreatewindow.override_redirect)
- new CoreWindow (event->xcreatewindow.window, wa);
+ new CoreWindow (event->xcreatewindow.window);
else
{
CoreWindow *cw =
- new CoreWindow (event->xcreatewindow.window, wa);
+ new CoreWindow (event->xcreatewindow.window);
if (cw)
{
- w = cw->manage (priv->getTopWindow ());
+ w = cw->manage (priv->getTopWindow (), wa);
delete cw;
}
}
@@ -1118,7 +1118,17 @@ CompScreen::handleEvent (XEvent *event)
{
if (cw->priv->id == event->xmap.window)
{
- w = cw->manage (priv->getTopWindow ());
+ /* Failure means the window has been destroyed, but
+ * still add it to the window list anyways since we
+ * will soon handle the DestroyNotify event for it
+ * and in between CreateNotify time and DestroyNotify
+ * time there might be ConfigureRequests asking us
+ * to stack windows relative to it
+ */
+ if (!XGetWindowAttributes (screen->dpy (), cw->priv->id, &wa))
+ priv->setDefaultWindowAttributes (&wa);
+
+ w = cw->manage (priv->getTopWindow (), wa);
delete cw;
break;
}
@@ -1207,11 +1217,11 @@ CompScreen::handleEvent (XEvent *event)
if (!XGetWindowAttributes (priv->dpy, event->xcreatewindow.window, &wa))
priv->setDefaultWindowAttributes (&wa);
- CoreWindow *cw = new CoreWindow (event->xreparent.window, wa);
+ CoreWindow *cw = new CoreWindow (event->xreparent.window);
if (cw)
{
- cw->manage (priv->getTopWindow ());
+ cw->manage (priv->getTopWindow (), wa);
delete cw;
}
}
@@ -1647,7 +1657,17 @@ CompScreen::handleEvent (XEvent *event)
{
if (cw->priv->id == event->xmaprequest.window)
{
- w = cw->manage (priv->getTopWindow ());
+ /* Failure means the window has been destroyed, but
+ * still add it to the window list anyways since we
+ * will soon handle the DestroyNotify event for it
+ * and in between CreateNotify time and DestroyNotify
+ * time there might be ConfigureRequests asking us
+ * to stack windows relative to it
+ */
+ if (!XGetWindowAttributes (screen->dpy (), cw->priv->id, &wa))
+ priv->setDefaultWindowAttributes (&wa);
+
+ w = cw->manage (priv->getTopWindow (), wa);
delete cw;
break;
}
diff --git a/src/privatewindow.h b/src/privatewindow.h
index f2f9609..4cecac2 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -308,9 +308,9 @@ class CoreWindow
{
public:
- CoreWindow (Window id, XWindowAttributes &wa);
+ CoreWindow (Window id);
- CompWindow * manage (Window id);
+ CompWindow * manage (Window above, XWindowAttributes &wa);
friend class PrivateWindow;
friend class PrivateScreen;
diff --git a/src/screen.cpp b/src/screen.cpp
index f52bebf..eae037a 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -4613,11 +4613,11 @@ CompScreen::init (const char *name)
if (!XGetWindowAttributes (screen->dpy (), children[i], &attrib))
priv->setDefaultWindowAttributes (&attrib);
- CoreWindow *cw = new CoreWindow (children[i], attrib);
+ CoreWindow *cw = new CoreWindow (children[i]);
if (cw)
{
- cw->manage (i ? children[i - 1] : 0);
+ cw->manage (i ? children[i - 1] : 0, attrib);
delete cw;
}
}
diff --git a/src/window.cpp b/src/window.cpp
index e088aa5..d2ecc3d 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -5093,10 +5093,10 @@ CompWindow::syncAlarm ()
}
CompWindow *
-CoreWindow::manage (Window aboveId)
+CoreWindow::manage (Window aboveId, XWindowAttributes &wa)
{
screen->priv->createdWindows.remove (this);
- return new CompWindow (aboveId, priv);
+ return new CompWindow (aboveId, wa, priv);
}
/*
@@ -5108,15 +5108,29 @@ CoreWindow::manage (Window aboveId)
* care about them too)
*/
-CoreWindow::CoreWindow (Window id, XWindowAttributes &wa)
+CoreWindow::CoreWindow (Window id)
{
priv = new PrivateWindow (this);
assert (priv);
screen->priv->createdWindows.push_back (this);
- priv->attrib = wa;
+ priv->id = id;
+}
+
+CompWindow::CompWindow (Window aboveId,
+ XWindowAttributes &wa,
+ PrivateWindow *priv) :
+ PluginClassStorage (windowPluginClassIndices),
+ priv (priv)
+{
+ // TODO: Reparent first!
+ priv->window = this;
+
+ screen->insertWindow (this, aboveId);
+
+ priv->attrib = wa;
priv->serverGeometry.set (priv->attrib.x, priv->attrib.y,
priv->attrib.width, priv->attrib.height,
priv->attrib.border_width);
@@ -5137,18 +5151,16 @@ CoreWindow::CoreWindow (Window id, XWindowAttributes &wa)
priv->transientFor = None;
priv->clientLeader = None;
- XSelectInput (screen->dpy (), id,
+ XSelectInput (screen->dpy (), priv->id,
PropertyChangeMask |
EnterWindowMask |
FocusChangeMask);
- priv->id = id;
-
priv->alpha = (priv->attrib.depth == 32);
priv->lastPong = screen->priv->lastPing;
if (screen->XShape ())
- XShapeSelectInput (screen->dpy (), id, ShapeNotifyMask);
+ XShapeSelectInput (screen->dpy (), priv->id, ShapeNotifyMask);
if (priv->attrib.c_class != InputOnly)
{
@@ -5165,17 +5177,6 @@ CoreWindow::CoreWindow (Window id, XWindowAttributes &wa)
{
priv->attrib.map_state = IsUnmapped;
}
-}
-
-CompWindow::CompWindow (Window aboveId, PrivateWindow *priv) :
- PluginClassStorage (windowPluginClassIndices),
- priv (priv)
-{
- // TODO: Reparent first!
-
- priv->window = this;
-
- screen->insertWindow (this, aboveId);
priv->wmType = screen->priv->getWindowType (priv->id);
priv->protocols = screen->priv->getProtocols (priv->id);