Author: olivier
Date: 2006-08-23 19:08:29 +0000 (Wed, 23 Aug 2006)
New Revision: 22858

Modified:
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/compositor.c
   xfwm4/trunk/src/compositor.h
Log:
Spot and fix an issue with stacking reordering.

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c    2006-08-23 15:10:05 UTC (rev 22857)
+++ xfwm4/trunk/src/client.c    2006-08-23 19:08:29 UTC (rev 22858)
@@ -1883,7 +1883,7 @@
     display_info = screen_info->display_info;
 
     clientRemoveFromList (c);
-    compositorRemoveWindow (display_info, c->frame);
+    compositorSetClient (display_info, c->frame, NULL);
 
     myDisplayGrabServer (display_info);
     gdk_error_trap_push ();

Modified: xfwm4/trunk/src/compositor.c
===================================================================
--- xfwm4/trunk/src/compositor.c        2006-08-23 15:10:05 UTC (rev 22857)
+++ xfwm4/trunk/src/compositor.c        2006-08-23 19:08:29 UTC (rev 22858)
@@ -1953,8 +1953,17 @@
         previous_above = ncw->id;
     }
 
-    if (previous_above != above)
+    /* If above is set to None, the window whose state was changed is on 
+     * the bottom of the stack with respect to sibling.
+     */
+    if (above == None)
     {
+        /* Insert at bottom of window stack */
+        screen_info->cwindows = g_list_delete_link (screen_info->cwindows, 
sibling);
+        screen_info->cwindows = g_list_append (screen_info->cwindows, cw);
+    }
+    else if (previous_above != above)
+    {
         GList *index;
 
         for (index = screen_info->cwindows; index; index = g_list_next (index))
@@ -1971,22 +1980,6 @@
             screen_info->cwindows = g_list_delete_link (screen_info->cwindows, 
sibling);
             screen_info->cwindows = g_list_insert_before 
(screen_info->cwindows, index, cw);
         }
-        else if (above == None)
-        {
-           /* If above is set to None, the window whose state was changed is 
on 
-            * the bottom of the stack with respect to sibling.
-            *     => Insert at bottom of window stack 
-            */
-            screen_info->cwindows = g_list_delete_link (screen_info->cwindows, 
sibling);
-            screen_info->cwindows = g_list_append (screen_info->cwindows, cw);
-        }
-        else
-        {
-            /* Don't know what to do */
-            g_warning ("The window 0x%lx has not been restacked\n"
-                       "because the specified sibling 0x%lx was "
-                       "not found in our stack", cw->id, above);
-        }
     }
 }
 
@@ -2447,18 +2440,50 @@
     }
 
     cw = find_cwindow_in_display (display_info, id);
-    if (cw)
+    if (!compositorSetClient (display_info, id, c))
     {
-        /* 
-         * The compositor window is already known, just update the client...
-         */
-        cw->c = c;
+        add_win (display_info, id, c);
     }
-    else
+#endif /* HAVE_COMPOSITOR */
+}
+
+gboolean
+compositorSetClient (DisplayInfo *display_info, Window id, Client *c)
+{
+#ifdef HAVE_COMPOSITOR
+    CWindow *cw;
+
+    g_return_val_if_fail (display_info != NULL, FALSE);
+    g_return_val_if_fail (id != None, FALSE);
+    TRACE ("entering compositorSetClient: 0x%lx", id);
+
+    if (!compositorIsUsable (display_info))
     {
-        add_win (display_info, id, c);
+        return FALSE;
     }
+
+    cw = find_cwindow_in_display (display_info, id);
+    if (cw)
+    {
+        if (cw->c != c)
+        {
+            if (WIN_IS_VISIBLE(cw))
+            {
+                damage_win (cw);
+            }
+
+            if (cw->extents)
+            {
+                XFixesDestroyRegion (display_info->dpy, cw->extents);
+                cw->extents = None;
+            }
+
+            cw->c = c;
+        }
+        return TRUE;
+    }
 #endif /* HAVE_COMPOSITOR */
+    return FALSE;
 }
 
 void

Modified: xfwm4/trunk/src/compositor.h
===================================================================
--- xfwm4/trunk/src/compositor.h        2006-08-23 15:10:05 UTC (rev 22857)
+++ xfwm4/trunk/src/compositor.h        2006-08-23 19:08:29 UTC (rev 22858)
@@ -36,9 +36,11 @@
 void     compositorAddWindow          (DisplayInfo *,
                                        Window,
                                        Client *);
+gboolean compositorSetClient          (DisplayInfo *,
+                                       Window,
+                                       Client *);
 void     compositorRemoveWindow       (DisplayInfo *,
                                        Window);
-
 void     compositorHandleEvent        (DisplayInfo *,
                                        XEvent *);
 void     compositorInitDisplay        (DisplayInfo *);

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to