New patches which fixed a problem with the old ones, which would occur if a
window didn't have a frame. So I needed to use ROOTPARENT (w), instead of
w->frame.

>From a6bfed5f6326609c13bde0429d4877b76adef898 Mon Sep 17 00:00:00 2001
From: Joel Bosveld <[email protected]>
Date: Tue, 7 Apr 2009 07:33:42 +0800
Subject: [PATCH] Restack window list immediately when calling
reconfigureXWindow

Previously, trying to restack multiple windows wouldn't work as expected, as
the window list wasn't restacked until the configureNotify was recieved,
which lead to it stacking the window above the wrong window
---
 src/privatewindow.h |    7 +++++--
 src/window.cpp      |   47 +++++++++++++++++++++++++++++++++--------------
 2 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/src/privatewindow.h b/src/privatewindow.h
index e54c096..1f2c600 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -84,9 +84,12 @@ class PrivateWindow {

     static bool stackTransients (CompWindow     *w,
                      CompWindow     *avoid,
-                     XWindowChanges *xwc);
+                     XWindowChanges *xwc,
+                     CompWindowList &updateList);

-    static void stackAncestors (CompWindow *w, XWindowChanges *xwc);
+    static void stackAncestors (CompWindow *w,
+                    XWindowChanges *xwc,
+                    CompWindowList &updateList);

     static bool isAncestorTo (CompWindow *transient,
                   CompWindow *ancestor);
diff --git a/src/window.cpp b/src/window.cpp
index 132a68d..de5ab76 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2257,6 +2257,14 @@ PrivateWindow::reconfigureXWindow (unsigned int
valueMask,
     if (valueMask & CWBorderWidth)
     serverGeometry.setBorder (xwc->border_width);

+    if (valueMask & (CWSibling | CWStackMode))
+    {
+    if (xwc->stack_mode == Above)
+        restack (xwc->sibling);
+    else
+        compLogMessage ("core", CompLogLevelWarn, "restack_mode not
Above");
+    }
+
     if (frame)
     {
     XWindowChanges wc = *xwc;
@@ -2283,7 +2291,8 @@ PrivateWindow::reconfigureXWindow (unsigned int
valueMask,
 bool
 PrivateWindow::stackTransients (CompWindow    *w,
                 CompWindow    *avoid,
-                XWindowChanges *xwc)
+                XWindowChanges *xwc,
+                CompWindowList &updateList)
 {
     CompWindow *t;
     Window     clientLeader = w->priv->clientLeader;
@@ -2303,7 +2312,7 @@ PrivateWindow::stackTransients (CompWindow    *w,
         if (!(t->priv->type & CompWindowTypeDockMask))
             return false;

-        if (!stackTransients (t, avoid, xwc))
+        if (!stackTransients (t, avoid, xwc, updateList))
         return false;

         if (xwc->sibling == t->priv->id ||
@@ -2311,7 +2320,7 @@ PrivateWindow::stackTransients (CompWindow    *w,
         return false;

         if (t->priv->mapNum || t->priv->pendingMaps)
-        t->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+        updateList.push_back (t);
     }
     }

@@ -2320,7 +2329,8 @@ PrivateWindow::stackTransients (CompWindow    *w,

 void
 PrivateWindow::stackAncestors (CompWindow     *w,
-                   XWindowChanges *xwc)
+                   XWindowChanges *xwc,
+                   CompWindowList &updateList)
 {
     CompWindow *transient = NULL;

@@ -2336,7 +2346,7 @@ PrivateWindow::stackAncestors (CompWindow     *w,
     ancestor = screen->findWindow (w->priv->transientFor);
     if (ancestor)
     {
-        if (!stackTransients (ancestor, w, xwc))
+        if (!stackTransients (ancestor, w, xwc, updateList))
         return;

         if (ancestor->priv->type & CompWindowTypeDesktopMask)
@@ -2347,10 +2357,9 @@ PrivateWindow::stackAncestors (CompWindow     *w,
             return;

         if (ancestor->priv->mapNum || ancestor->priv->pendingMaps)
-        ancestor->priv->reconfigureXWindow (CWSibling | CWStackMode,
-                            xwc);
+        updateList.push_back (ancestor);

-        stackAncestors (ancestor, xwc);
+        stackAncestors (ancestor, xwc, updateList);
     }
     }
     else if (w->priv->isGroupTransient (w->priv->clientLeader))
@@ -2367,7 +2376,7 @@ PrivateWindow::stackAncestors (CompWindow     *w,
             (a->priv->frame && xwc->sibling == a->priv->frame))
             break;

-        if (!stackTransients (a, w, xwc))
+        if (!stackTransients (a, w, xwc, updateList))
             break;

         if (a->priv->type & CompWindowTypeDesktopMask)
@@ -2378,7 +2387,7 @@ PrivateWindow::stackAncestors (CompWindow     *w,
             break;

         if (a->priv->mapNum || a->priv->pendingMaps)
-            a->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+            updateList.push_back (a);
         }
     }
     }
@@ -2390,13 +2399,22 @@ CompWindow::configureXWindow (unsigned int
valueMask,
 {
     if (priv->managed && (valueMask & (CWSibling | CWStackMode)))
     {
+    CompWindowList transients;
+    CompWindowList ancestors;
+
     /* transient children above */
-    if (PrivateWindow::stackTransients (this, NULL, xwc))
+    if (PrivateWindow::stackTransients (this, NULL, xwc, transients))
     {
-        priv->reconfigureXWindow (valueMask, xwc);
-
         /* ancestors, siblings and sibling transients below */
-        PrivateWindow::stackAncestors (this, xwc);
+        PrivateWindow::stackAncestors (this, xwc, ancestors);
+
+        foreach (CompWindow *w, transients)
+        w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+
+        this->priv->reconfigureXWindow (valueMask, xwc);
+
+        foreach (CompWindow *w, ancestors)
+        w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
     }
     }
     else
@@ -2872,6 +2890,7 @@ PrivateWindow::addWindowStackChanges (XWindowChanges
*xwc,
         XLowerWindow (screen->dpy (), id);
         if (frame)
             XLowerWindow (screen->dpy (), frame);
+        restack (0);
         }
         else if (sibling->priv->id != window->prev->priv->id)
         {
-- 
1.6.0.3


>From ad9f33011c23143b46fb164a31006cb7944e6c15 Mon Sep 17 00:00:00 2001
From: Joel Bosveld <[email protected]>
Date: Tue, 7 Apr 2009 08:02:50 +0800
Subject: [PATCH] Restack windows in reverse, and stack above correct window.

Previously this worked due to the order that the events arived in, however,
now we want it to be stacked above correct window straight away so that we
do not restack it again when configureNotify event comes through
---
 src/window.cpp |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/window.cpp b/src/window.cpp
index de5ab76..614bedd 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2408,13 +2408,22 @@ CompWindow::configureXWindow (unsigned int
valueMask,
         /* ancestors, siblings and sibling transients below */
         PrivateWindow::stackAncestors (this, xwc, ancestors);

-        foreach (CompWindow *w, transients)
-        w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+        for (CompWindowList::reverse_iterator w = ancestors.rbegin ();
+         w != ancestors.rend (); w++)
+        {
+        (*w)->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+        xwc->sibling = ROOTPARENT (*w);
+        }

         this->priv->reconfigureXWindow (valueMask, xwc);
+        xwc->sibling = ROOTPARENT (this);

-        foreach (CompWindow *w, ancestors)
-        w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+        for (CompWindowList::reverse_iterator w = transients.rbegin ();
+         w != transients.rend (); w++)
+        {
+        (*w)->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+        xwc->sibling = ROOTPARENT (*w);
+        }
     }
     }
     else
-- 
1.6.0.3
From a6bfed5f6326609c13bde0429d4877b76adef898 Mon Sep 17 00:00:00 2001
From: Joel Bosveld <[email protected]>
Date: Tue, 7 Apr 2009 07:33:42 +0800
Subject: [PATCH] Restack window list immediately when calling reconfigureXWindow

Previously, trying to restack multiple windows wouldn't work as expected, as the window list wasn't restacked until the configureNotify was recieved, which lead to it stacking the window above the wrong window
---
 src/privatewindow.h |    7 +++++--
 src/window.cpp      |   47 +++++++++++++++++++++++++++++++++--------------
 2 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/src/privatewindow.h b/src/privatewindow.h
index e54c096..1f2c600 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -84,9 +84,12 @@ class PrivateWindow {
 
 	static bool stackTransients (CompWindow     *w,
 				     CompWindow     *avoid,
-				     XWindowChanges *xwc);
+				     XWindowChanges *xwc,
+				     CompWindowList &updateList);
 
-	static void stackAncestors (CompWindow *w, XWindowChanges *xwc);
+	static void stackAncestors (CompWindow *w,
+				    XWindowChanges *xwc,
+				    CompWindowList &updateList);
 
 	static bool isAncestorTo (CompWindow *transient,
 				  CompWindow *ancestor);
diff --git a/src/window.cpp b/src/window.cpp
index 132a68d..de5ab76 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2257,6 +2257,14 @@ PrivateWindow::reconfigureXWindow (unsigned int   valueMask,
     if (valueMask & CWBorderWidth)
 	serverGeometry.setBorder (xwc->border_width);
 
+    if (valueMask & (CWSibling | CWStackMode))
+    {
+	if (xwc->stack_mode == Above)
+	    restack (xwc->sibling);
+	else
+	    compLogMessage ("core", CompLogLevelWarn, "restack_mode not Above");
+    }
+
     if (frame)
     {
 	XWindowChanges wc = *xwc;
@@ -2283,7 +2291,8 @@ PrivateWindow::reconfigureXWindow (unsigned int   valueMask,
 bool
 PrivateWindow::stackTransients (CompWindow	*w,
 				CompWindow	*avoid,
-				XWindowChanges *xwc)
+				XWindowChanges *xwc,
+				CompWindowList &updateList)
 {
     CompWindow *t;
     Window     clientLeader = w->priv->clientLeader;
@@ -2303,7 +2312,7 @@ PrivateWindow::stackTransients (CompWindow	*w,
 		if (!(t->priv->type & CompWindowTypeDockMask))
 		    return false;
 
-	    if (!stackTransients (t, avoid, xwc))
+	    if (!stackTransients (t, avoid, xwc, updateList))
 		return false;
 
 	    if (xwc->sibling == t->priv->id ||
@@ -2311,7 +2320,7 @@ PrivateWindow::stackTransients (CompWindow	*w,
 		return false;
 
 	    if (t->priv->mapNum || t->priv->pendingMaps)
-		t->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+		updateList.push_back (t);
 	}
     }
 
@@ -2320,7 +2329,8 @@ PrivateWindow::stackTransients (CompWindow	*w,
 
 void
 PrivateWindow::stackAncestors (CompWindow     *w,
-			       XWindowChanges *xwc)
+			       XWindowChanges *xwc,
+			       CompWindowList &updateList)
 {
     CompWindow *transient = NULL;
 
@@ -2336,7 +2346,7 @@ PrivateWindow::stackAncestors (CompWindow     *w,
 	ancestor = screen->findWindow (w->priv->transientFor);
 	if (ancestor)
 	{
-	    if (!stackTransients (ancestor, w, xwc))
+	    if (!stackTransients (ancestor, w, xwc, updateList))
 		return;
 
 	    if (ancestor->priv->type & CompWindowTypeDesktopMask)
@@ -2347,10 +2357,9 @@ PrivateWindow::stackAncestors (CompWindow     *w,
 		    return;
 
 	    if (ancestor->priv->mapNum || ancestor->priv->pendingMaps)
-		ancestor->priv->reconfigureXWindow (CWSibling | CWStackMode,
-						    xwc);
+		updateList.push_back (ancestor);
 
-	    stackAncestors (ancestor, xwc);
+	    stackAncestors (ancestor, xwc, updateList);
 	}
     }
     else if (w->priv->isGroupTransient (w->priv->clientLeader))
@@ -2367,7 +2376,7 @@ PrivateWindow::stackAncestors (CompWindow     *w,
 		    (a->priv->frame && xwc->sibling == a->priv->frame))
 		    break;
 
-		if (!stackTransients (a, w, xwc))
+		if (!stackTransients (a, w, xwc, updateList))
 		    break;
 
 		if (a->priv->type & CompWindowTypeDesktopMask)
@@ -2378,7 +2387,7 @@ PrivateWindow::stackAncestors (CompWindow     *w,
 			break;
 
 		if (a->priv->mapNum || a->priv->pendingMaps)
-		    a->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+		    updateList.push_back (a);
 	    }
 	}
     }
@@ -2390,13 +2399,22 @@ CompWindow::configureXWindow (unsigned int valueMask,
 {
     if (priv->managed && (valueMask & (CWSibling | CWStackMode)))
     {
+	CompWindowList transients;
+	CompWindowList ancestors;
+
 	/* transient children above */
-	if (PrivateWindow::stackTransients (this, NULL, xwc))
+	if (PrivateWindow::stackTransients (this, NULL, xwc, transients))
 	{
-	    priv->reconfigureXWindow (valueMask, xwc);
-
 	    /* ancestors, siblings and sibling transients below */
-	    PrivateWindow::stackAncestors (this, xwc);
+	    PrivateWindow::stackAncestors (this, xwc, ancestors);
+
+	    foreach (CompWindow *w, transients)
+		w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+
+	    this->priv->reconfigureXWindow (valueMask, xwc);
+
+	    foreach (CompWindow *w, ancestors)
+		w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
 	}
     }
     else
@@ -2872,6 +2890,7 @@ PrivateWindow::addWindowStackChanges (XWindowChanges *xwc,
 		XLowerWindow (screen->dpy (), id);
 		if (frame)
 		    XLowerWindow (screen->dpy (), frame);
+		restack (0);
 	    }
 	    else if (sibling->priv->id != window->prev->priv->id)
 	    {
-- 
1.6.0.3

From ad9f33011c23143b46fb164a31006cb7944e6c15 Mon Sep 17 00:00:00 2001
From: Joel Bosveld <[email protected]>
Date: Tue, 7 Apr 2009 08:02:50 +0800
Subject: [PATCH] Restack windows in reverse, and stack above correct window.

Previously this worked due to the order that the events arived in, however, now we want it to be stacked above correct window straight away so that we do not restack it again when configureNotify event comes through
---
 src/window.cpp |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/window.cpp b/src/window.cpp
index de5ab76..614bedd 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2408,13 +2408,22 @@ CompWindow::configureXWindow (unsigned int valueMask,
 	    /* ancestors, siblings and sibling transients below */
 	    PrivateWindow::stackAncestors (this, xwc, ancestors);
 
-	    foreach (CompWindow *w, transients)
-		w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+	    for (CompWindowList::reverse_iterator w = ancestors.rbegin ();
+		 w != ancestors.rend (); w++)
+	    {
+		(*w)->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+		xwc->sibling = ROOTPARENT (*w);
+	    }
 
 	    this->priv->reconfigureXWindow (valueMask, xwc);
+	    xwc->sibling = ROOTPARENT (this);
 
-	    foreach (CompWindow *w, ancestors)
-		w->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+	    for (CompWindowList::reverse_iterator w = transients.rbegin ();
+		 w != transients.rend (); w++)
+	    {
+		(*w)->priv->reconfigureXWindow (CWSibling | CWStackMode, xwc);
+		xwc->sibling = ROOTPARENT (*w);
+	    }
 	}
     }
     else
-- 
1.6.0.3

_______________________________________________
Dev mailing list
[email protected]
http://lists.compiz-fusion.org/mailman/listinfo/dev

Reply via email to