[gtk+/client-side-windows: 87/284] Add restack_under method to GdkWindomImpl



commit 377ca19c9feaa62f4ebca356c02d35f769156b87
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Jan 19 12:47:38 2009 +0100

    Add restack_under method to GdkWindomImpl
---
 gdk/gdkwindowimpl.h     |    2 ++
 gdk/x11/gdkwindow-x11.c |   29 +++++++++++++++++++++++++----
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index d6bd1bb..d63e5a1 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -48,6 +48,8 @@ struct _GdkWindowImplIface
   void         (* withdraw)             (GdkWindow       *window);
   void         (* raise)                (GdkWindow       *window);
   void         (* lower)                (GdkWindow       *window);
+  void         (* restack_under)        (GdkWindow       *window,
+					 GList           *native_siblings);
 
   void         (* move_resize)          (GdkWindow       *window,
                                          gboolean         with_move,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 4cec645..265e864 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -1633,15 +1633,35 @@ gdk_window_x11_reparent (GdkWindow *window,
 static void
 gdk_window_x11_raise (GdkWindow *window)
 {
-  if (!GDK_WINDOW_DESTROYED (window))
-    XRaiseWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
+  XRaiseWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
+}
+
+static void
+gdk_window_x11_restack_under (GdkWindow *window,
+			      GList *native_siblings /* in requested order, first is bottom-most */)
+{
+  Window *windows;
+  int n_windows, i;
+  GList *l;
+
+  n_windows = g_list_length (native_siblings) + 1;
+  windows = g_new (Window, n_windows);
+
+  windows[0] = GDK_WINDOW_XID (window);
+  /* Reverse order, as input order is bottom-most first */
+  i = n_windows - 1;
+  for (l = native_siblings; l != NULL; l = l->next)
+    windows[i--] = GDK_WINDOW_XID (l->data);
+ 
+  XRestackWindows (GDK_WINDOW_XDISPLAY (window), windows, n_windows);
+  
+  g_free (windows);
 }
 
 static void
 gdk_window_x11_lower (GdkWindow *window)
 {
-  if (!GDK_WINDOW_DESTROYED (window))
-    XLowerWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
+  XLowerWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
 }
 
 /**
@@ -5460,6 +5480,7 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
   iface->get_events = gdk_window_x11_get_events;
   iface->raise = gdk_window_x11_raise;
   iface->lower = gdk_window_x11_lower;
+  iface->restack_under = gdk_window_x11_restack_under;
   iface->move_resize = gdk_window_x11_move_resize;
   iface->set_background = gdk_window_x11_set_background;
   iface->set_back_pixmap = gdk_window_x11_set_back_pixmap;



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