summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/core/screen.h1
-rw-r--r--include/core/window.h6
-rw-r--r--src/event.cpp36
-rw-r--r--src/privatescreen.h3
-rw-r--r--src/privatewindow.h22
-rw-r--r--src/screen.cpp10
-rw-r--r--src/window.cpp43
7 files changed, 100 insertions, 21 deletions
diff --git a/include/core/screen.h b/include/core/screen.h
index c5bfc4c..a36599b 100644
--- a/include/core/screen.h
+++ b/include/core/screen.h
@@ -399,6 +399,7 @@ class CompScreen :
friend class CompTimer;
friend class CompWindow;
friend class PrivateWindow;
+ friend class CoreWindow;
friend class ModifierHandler;
friend class CompManager;
diff --git a/include/core/window.h b/include/core/window.h
index 6b07a56..08b6e68 100644
--- a/include/core/window.h
+++ b/include/core/window.h
@@ -294,8 +294,6 @@ class CompWindow :
CompWindow *prev;
public:
- CompWindow (Window id,
- Window aboveId);
~CompWindow ();
/**
@@ -552,8 +550,12 @@ class CompWindow :
friend class CompScreen;
friend class PrivateScreen;
friend class ModifierHandler;
+ friend class CoreWindow;
private:
+ CompWindow (Window aboveId,
+ PrivateWindow *priv);
+
PrivateWindow *priv;
};
diff --git a/src/event.cpp b/src/event.cpp
index 987433b..ecb89f8 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1029,13 +1029,15 @@ CompScreen::handleEvent (XEvent *event)
{
/* Track the window if it was created on this
* screen, otherwise we still need to register
- * for FocusChangeMask */
+ * for FocusChangeMask. Also, we don't want to
+ * manage it straight away - in reality we want
+ * that to wait until the map request */
if (wa.root == priv->root)
- new CompWindow (event->xcreatewindow.window, priv->getTopWindow ());
+ new CoreWindow (event->xcreatewindow.window);
else
XSelectInput (priv->dpy, event->xcreatewindow.window,
- FocusChangeMask);
- }
+ FocusChangeMask);
+ }
break;
case DestroyNotify:
w = findWindow (event->xdestroywindow.window);
@@ -1051,8 +1053,8 @@ CompScreen::handleEvent (XEvent *event)
{
if (w->priv->pendingMaps)
{
- if (!w->priv->frame)
- w->priv->reparent ();
+ //if (!w->priv->frame)
+ //w->priv->reparent ();
w->priv->managed = true;
}
@@ -1113,7 +1115,13 @@ CompScreen::handleEvent (XEvent *event)
w = findWindow (event->xreparent.window);
if (!w && event->xreparent.parent == priv->root)
{
- new CompWindow (event->xreparent.window, priv->getTopWindow ());
+ CoreWindow *cw = new CoreWindow (event->xreparent.window);
+
+ if (cw)
+ {
+ cw->manage (priv->getTopWindow ());
+ delete cw;
+ }
}
else if (w && !(event->xreparent.parent == w->priv->wrapper ||
event->xreparent.parent == priv->root))
@@ -1540,7 +1548,19 @@ CompScreen::handleEvent (XEvent *event)
modHandler->updateModifierMappings ();
break;
case MapRequest:
- w = findWindow (event->xmaprequest.window);
+ /* Create the CompWindow structure here */
+ w = NULL;
+
+ foreach (CoreWindow *cw, priv->createdWindows)
+ {
+ if (cw->priv->id == event->xmaprequest.window)
+ {
+ w = cw->manage (priv->getTopWindow ());
+ delete cw;
+ break;
+ }
+ }
+
if (w)
{
XWindowAttributes attr;
diff --git a/src/privatescreen.h b/src/privatescreen.h
index 961daf2..b6975cc 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -39,6 +39,8 @@
CompPlugin::VTable * getCoreVTable ();
+class CoreWindow;
+
extern bool shutDown;
extern bool restartSignal;
@@ -358,6 +360,7 @@ class PrivateScreen : public CoreOptions {
CompScreen *screen;
+ std::list <CoreWindow *> createdWindows;
CompWindowList windows;
CompWindow::Map windowsMap;
diff --git a/src/privatewindow.h b/src/privatewindow.h
index 99d0c4e..eb86932 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -46,7 +46,7 @@ typedef CompWindowExtents CompFullscreenMonitorSet;
class PrivateWindow {
public:
- PrivateWindow (CompWindow *window);
+ PrivateWindow (CoreWindow *window);
~PrivateWindow ();
void recalcNormalHints ();
@@ -302,4 +302,24 @@ class PrivateWindow {
Time lastCloseRequestTime;
};
+/* Minimal tracking of the window which happens
+ * on CreateNotify */
+
+class CoreWindow
+{
+ public:
+
+ CoreWindow (Window id);
+
+ CompWindow * manage (Window id);
+
+ friend class PrivateWindow;
+ friend class PrivateScreen;
+ friend class CompScreen;
+
+ private:
+
+ PrivateWindow *priv;
+};
+
#endif
diff --git a/src/screen.cpp b/src/screen.cpp
index 706d1a7..5410f58 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -4571,7 +4571,15 @@ CompScreen::init (const char *name)
&children, &nchildren);
for (unsigned int i = 0; i < nchildren; i++)
- new CompWindow (children[i], i ? children[i - 1] : 0);
+ {
+ CoreWindow *cw = new CoreWindow (children[i]);
+
+ if (cw)
+ {
+ cw->manage (i ? children[i - 1] : 0);
+ delete cw;
+ }
+ }
foreach (CompWindow *w, priv->windows)
{
diff --git a/src/window.cpp b/src/window.cpp
index 7da262d..ac56ef4 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -5116,14 +5116,29 @@ CompWindow::syncAlarm ()
return priv->syncAlarm;
}
+CompWindow *
+CoreWindow::manage (Window aboveId)
+{
+ screen->priv->createdWindows.remove (this);
+ return new CompWindow (aboveId, priv);
+}
+
+/*
+ * On CreateNotify we only want to do some very basic
+ * initialization on the windows, and we need to be
+ * tracking things like eg override-redirect windows
+ * for compositing, although only on MapRequest do
+ * we actually care about them (and let the plugins
+ * care about them too)
+ */
-CompWindow::CompWindow (Window id,
- Window aboveId) :
- PluginClassStorage (windowPluginClassIndices)
+CoreWindow::CoreWindow (Window id)
{
priv = new PrivateWindow (this);
assert (priv);
+ screen->priv->createdWindows.push_back (this);
+
/* Failure means that window has been destroyed. We still have to add the
window to the window list as we might get configure requests which
require us to stack other windows relative to it. Setting some default
@@ -5158,15 +5173,13 @@ CompWindow::CompWindow (Window id,
priv->id = id;
- priv->alpha = (depth () == 32);
+ priv->alpha = (priv->attrib.depth == 32);
priv->lastPong = screen->priv->lastPing;
if (screen->XShape ())
XShapeSelectInput (screen->dpy (), id, ShapeNotifyMask);
- screen->insertWindow (this, aboveId);
-
- if (windowClass () != InputOnly)
+ if (priv->attrib.c_class != InputOnly)
{
priv->region = CompRegion (priv->attrib.x, priv->attrib.y,
priv->width, priv->height);
@@ -5181,6 +5194,17 @@ CompWindow::CompWindow (Window id,
{
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);
@@ -5221,6 +5245,7 @@ CompWindow::CompWindow (Window id,
if (!overrideRedirect ())
{
+ // needs to happen right after maprequest
if (!priv->frame)
priv->reparent ();
priv->managed = true;
@@ -5276,6 +5301,7 @@ CompWindow::CompWindow (Window id,
{
if (screen->priv->getWmState (priv->id) == IconicState)
{
+ // before everything else in maprequest
if (!priv->frame)
priv->reparent ();
priv->managed = true;
@@ -5359,9 +5385,8 @@ CompWindow::~CompWindow ()
delete priv;
}
-PrivateWindow::PrivateWindow (CompWindow *window) :
+PrivateWindow::PrivateWindow (CoreWindow *window) :
priv (this),
- window (window),
refcnt (1),
id (None),
frame (None),