From 4650de83bcc66a436762da447066ef92ccff5eb7 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan.olivier@wanadoo.fr>
Date: Sun, 12 Dec 2004 09:20:51 +0000
Subject: [PATCH] Fix #588 Improve stacking mgt in compositor

(Old svn revision: 12200)
---
 src/client.c     |  8 +++++++-
 src/compositor.c | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/client.c b/src/client.c
index 213108a68..36dd508b4 100644
--- a/src/client.c
+++ b/src/client.c
@@ -1418,6 +1418,7 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
     if (w == screen_info->gnome_win)
     {
         TRACE ("Not managing our own event window");
+        compositorAddWindow (display_info, w, NULL);
         myDisplayUngrabServer (display_info);
         gdk_error_trap_pop ();
         return NULL;
@@ -1706,6 +1707,7 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
     {
         setWMState (display_info, c->window, IconicState);
         clientSetNetState (c);
+        clientGrabMouseButton (c);
     }
     
     setNetFrameExtents (display_info, c->window, frameTop (c), frameLeft (c),
@@ -1835,12 +1837,16 @@ clientFrameAll (ScreenInfo *screen_info)
         XGetWindowAttributes (display_info->dpy, wins[i], &attr);
         if ((attr.map_state == IsViewable) && (attr.root == screen_info->xroot))
         {
-            Client *c = clientFrame (screen_info->display_info, wins[i], TRUE);
+            Client *c = clientFrame (display_info, wins[i], TRUE);
             if ((c) && ((screen_info->params->raise_on_click) || (screen_info->params->click_to_focus)))
             {
                 clientGrabMouseButton (c);
             }
         }
+        else
+        {
+             compositorAddWindow (display_info, wins[i], NULL);
+        }
     }
     if (wins)
     {
diff --git a/src/compositor.c b/src/compositor.c
index c85d35224..088415557 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1537,6 +1537,20 @@ restack_win (CWindow *cw, Window above)
             screen_info->cwindows =  g_list_prepend (screen_info->cwindows, cw);
         }
     }
+    
+#if 0
+    /* Dump stack */
+    {
+        GList *index;
+        g_print ("top of stack\n");
+        for (index = screen_info->cwindows; index; index = g_list_next (index))
+        {
+            CWindow *cw2 = (CWindow *) index->data;
+            g_print ("Window id 0x%lx\n", cw2->id);
+        }
+        g_print ("top of stack\n");
+    }
+#endif
 }
 
 void
-- 
GitLab