[gtk+/wip/csd: 11/11] WIP: Add window position offset



commit ec22cfd4f91a36e61f04a5e9e2ba347ac0fe9686
Author: Rob Bradford <rob linux intel com>
Date:   Mon Apr 23 17:26:49 2012 +0100

    WIP: Add window position offset

 gdk/wayland/gdkwindow-wayland.c |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 48859cd..03968a0 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -874,6 +874,33 @@ gdk_window_wayland_get_geometry (GdkWindow *window,
     }
 }
 
+
+void
+_gdk_wayland_window_offset (GdkWindow *window,
+                            gdouble   *x_out,
+                            gdouble   *y_out)
+{
+  GdkWindowImplWayland *impl, *parent_impl;
+  GdkWindow *parent_window;
+  gdouble x_offset = 0, y_offset = 0;
+
+  impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+  parent_window = impl->transient_for;
+  while (parent_window)
+    {
+      parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent_window->impl);
+
+      x_offset += window->x;
+      y_offset += window->y;
+
+      parent_window = parent_impl->transient_for;
+    }
+
+  *x_out = x_offset;
+  *y_out = y_offset;
+}
+
 static gint
 gdk_window_wayland_get_root_coords (GdkWindow *window,
 				gint       x,
@@ -881,11 +908,12 @@ gdk_window_wayland_get_root_coords (GdkWindow *window,
 				gint      *root_x,
 				gint      *root_y)
 {
-  /* We can't do this. */
-  if (root_x)
-    *root_x = 0;
-  if (root_y)
-    *root_y = 0;
+  double x_offset, y_offset;
+
+  _gdk_wayland_window_offset (window, &x_offset, &y_offset);
+
+  *root_x = x_offset + x;
+  *root_y = y_offset + y;
 
   return 1;
 }



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