[gtk+/client-side-windows: 89/284] Fix up native window handling in gdk_window_lower too



commit c1884ce40323d677975e945c6888e61e323ca2b1
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Jan 19 14:41:08 2009 +0100

    Fix up native window handling in gdk_window_lower too
---
 gdk/gdkwindow.c |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c2f4709..1b61a15 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -5438,6 +5438,9 @@ gdk_window_lower_internal (GdkWindow *window)
 {
   GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowObject *parent = private->parent;
+  GdkWindowObject *above;
+  GList *native_children;
+  GList *l, listhead;
 
   if (parent)
     {
@@ -5445,8 +5448,48 @@ gdk_window_lower_internal (GdkWindow *window)
       parent->children = g_list_append (parent->children, window);
     }
 
-  if (gdk_window_has_impl (private))
-    GDK_WINDOW_IMPL_GET_IFACE (private->impl)->lower (window);
+  /* Just do native lower for toplevels */
+  if (private->parent == NULL ||
+      GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
+    {
+      GDK_WINDOW_IMPL_GET_IFACE (private->impl)->lower (window);
+    }
+  else if (gdk_window_has_impl (private))
+    {
+      above = find_native_sibling_above (parent, private);
+      if (above)
+	{
+	  listhead.data = window;
+	  listhead.next = NULL;
+	  listhead.prev = NULL;
+	  GDK_WINDOW_IMPL_GET_IFACE (private->impl)->restack_under ((GdkWindow *)above,
+								    &listhead);
+	}
+      else
+	GDK_WINDOW_IMPL_GET_IFACE (private->impl)->raise (window);
+    }
+  else
+    {
+      native_children = NULL;
+      get_all_native_children (private, &native_children);
+      if (native_children != NULL)
+	{
+	  above = find_native_sibling_above (parent, private);
+
+	  if (above)
+	    GDK_WINDOW_IMPL_GET_IFACE (private->impl)->restack_under ((GdkWindow *)above,
+								      native_children);
+	  else
+	    {
+	      /* Right order, since native_chilren is bottom-opmost first */
+	      for (l = native_children; l != NULL; l = l->next)
+		GDK_WINDOW_IMPL_GET_IFACE (private->impl)->raise (l->data);
+	    }
+	  
+	  g_list_free (native_children);
+	}
+      
+    }
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]