[gtk+] Implement get_root_origin generically for all backends



commit efdd68b3b058e988cb800fc38a3e3d89f99b33b7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 17 15:39:39 2014 -0400

    Implement get_root_origin generically for all backends
    
    It seems that some backends implemented get_root_origin wrong
    and returned the client window coordinates, not the frame window
    coordinates. Since it's possible to implement generically for all
    windows, let's do that instead of having a separate impl vfunc.

 gdk/broadway/gdkwindow-broadway.c |   19 -------------------
 gdk/gdkoffscreenwindow.c          |    1 -
 gdk/gdkwindow.c                   |   10 +++++++++-
 gdk/gdkwindowimpl.h               |    3 ---
 gdk/quartz/gdkwindow-quartz.c     |   20 --------------------
 gdk/wayland/gdkwindow-wayland.c   |   13 -------------
 gdk/win32/gdkwindow-win32.c       |   22 ----------------------
 gdk/x11/gdkwindow-x11.c           |   17 -----------------
 8 files changed, 9 insertions(+), 96 deletions(-)
---
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index fa541c8..97cb6cf 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -725,24 +725,6 @@ gdk_window_broadway_get_root_coords (GdkWindow *window,
 }
 
 static void
-gdk_broadway_window_get_root_origin (GdkWindow *window,
-                                    gint      *x,
-                                    gint      *y)
-{
-  GdkWindowImplBroadway *impl;
-
-  impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
-
-  /* TODO: This should take wm frame into account */
-
-  if (x)
-    *x = impl->wrapper->x;
-
-  if (y)
-    *y = impl->wrapper->x;
-}
-
-static void
 gdk_broadway_window_get_frame_extents (GdkWindow    *window,
                                       GdkRectangle *rect)
 {
@@ -1584,7 +1566,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
   impl_class->set_role = gdk_broadway_window_set_role;
   impl_class->set_startup_id = gdk_broadway_window_set_startup_id;
   impl_class->set_transient_for = gdk_broadway_window_set_transient_for;
-  impl_class->get_root_origin = gdk_broadway_window_get_root_origin;
   impl_class->get_frame_extents = gdk_broadway_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_broadway_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_broadway_window_set_accept_focus;
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index a5a413b..9276103 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -743,7 +743,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
   impl_class->set_role = gdk_offscreen_window_set_string;
   impl_class->set_startup_id = gdk_offscreen_window_set_string;
   impl_class->set_transient_for = gdk_offscreen_window_set_transient_for;
-  impl_class->get_root_origin = NULL;
   impl_class->get_frame_extents = gdk_offscreen_window_get_frame_extents;
   impl_class->set_override_redirect = NULL;
   impl_class->set_accept_focus = NULL;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 17c6d09..acecc87 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -9630,7 +9630,15 @@ gdk_window_get_root_origin (GdkWindow *window,
                            gint      *x,
                            gint      *y)
 {
-  GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_root_origin (window, x, y);
+  GdkRectangle rect;
+
+  gdk_window_get_frame_extents (window, &rect);
+
+  if (x)
+    *x = rect.x;
+
+  if (y)
+    *y = rect.y;
 }
 
 /**
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index d8b0ff4..bd1714d 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -194,9 +194,6 @@ struct _GdkWindowImplClass
                                         const gchar *startup_id);
   void         (* set_transient_for)    (GdkWindow *window,
                                         GdkWindow *parent);
-  void         (* get_root_origin)      (GdkWindow *window,
-                                        gint      *x,
-                                        gint      *y);
   void         (* get_frame_extents)    (GdkWindow    *window,
                                         GdkRectangle *rect);
   void         (* set_override_redirect) (GdkWindow *window,
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index cfa211a..84e7ab8 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -1791,25 +1791,6 @@ gdk_window_quartz_get_root_coords (GdkWindow *window,
     *root_y = tmp_y;
 }
 
-static void
-gdk_quartz_window_get_root_origin (GdkWindow *window,
-                                   gint      *x,
-                                   gint      *y)
-{
-  GdkRectangle rect;
-
-  rect.x = 0;
-  rect.y = 0;
-  
-  gdk_window_get_frame_extents (window, &rect);
-
-  if (x)
-    *x = rect.x;
-
-  if (y)
-    *y = rect.y;
-}
-
 /* Returns coordinates relative to the passed in window. */
 static GdkWindow *
 gdk_window_quartz_get_device_state_helper (GdkWindow       *window,
@@ -2987,7 +2968,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
   impl_class->set_role = gdk_quartz_window_set_role;
   impl_class->set_startup_id = gdk_quartz_window_set_startup_id;
   impl_class->set_transient_for = gdk_quartz_window_set_transient_for;
-  impl_class->get_root_origin = gdk_quartz_window_get_root_origin;
   impl_class->get_frame_extents = gdk_quartz_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_quartz_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_quartz_window_set_accept_focus;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index b6d3811..c419714 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1664,18 +1664,6 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
 }
 
 static void
-gdk_wayland_window_get_root_origin (GdkWindow *window,
-                                   gint      *x,
-                                   gint      *y)
-{
-  if (x)
-    *x = 0;
-
-  if (y)
-    *y = 0;
-}
-
-static void
 gdk_wayland_window_get_frame_extents (GdkWindow    *window,
                                       GdkRectangle *rect)
 {
@@ -2226,7 +2214,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
   impl_class->set_role = gdk_wayland_window_set_role;
   impl_class->set_startup_id = gdk_wayland_window_set_startup_id;
   impl_class->set_transient_for = gdk_wayland_window_set_transient_for;
-  impl_class->get_root_origin = gdk_wayland_window_get_root_origin;
   impl_class->get_frame_extents = gdk_wayland_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_wayland_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_wayland_window_set_accept_focus;
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 35a49b7..aa8f591 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -2064,27 +2064,6 @@ gdk_win32_window_restack_toplevel (GdkWindow *window,
 }
 
 static void
-gdk_win32_window_get_root_origin (GdkWindow *window,
-                           gint      *x,
-                           gint      *y)
-{
-  GdkRectangle rect;
-
-  g_return_if_fail (GDK_IS_WINDOW (window));
-
-  gdk_window_get_frame_extents (window, &rect);
-
-  if (x)
-    *x = rect.x;
-
-  if (y)
-    *y = rect.y;
-
-  GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %p: %+d%+d\n",
-                          GDK_WINDOW_HWND (window), rect.x, rect.y));
-}
-
-static void
 gdk_win32_window_get_frame_extents (GdkWindow    *window,
                               GdkRectangle *rect)
 {
@@ -3472,7 +3451,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
   impl_class->set_role = gdk_win32_window_set_role;
   //impl_class->set_startup_id = gdk_x11_window_set_startup_id;
   impl_class->set_transient_for = gdk_win32_window_set_transient_for;
-  impl_class->get_root_origin = gdk_win32_window_get_root_origin;
   impl_class->get_frame_extents = gdk_win32_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_win32_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_win32_window_set_accept_focus;
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 83b3c7b..0856f8a 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -3114,22 +3114,6 @@ gdk_window_x11_get_root_coords (GdkWindow *window,
 }
 
 static void
-gdk_x11_window_get_root_origin (GdkWindow *window,
-                           gint      *x,
-                           gint      *y)
-{
-  GdkRectangle rect;
-
-  gdk_window_get_frame_extents (window, &rect);
-
-  if (x)
-    *x = rect.x;
-
-  if (y)
-    *y = rect.y;
-}
-
-static void
 gdk_x11_window_get_frame_extents (GdkWindow    *window,
                                   GdkRectangle *rect)
 {
@@ -5766,7 +5750,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
   impl_class->set_role = gdk_x11_window_set_role;
   impl_class->set_startup_id = gdk_x11_window_set_startup_id;
   impl_class->set_transient_for = gdk_x11_window_set_transient_for;
-  impl_class->get_root_origin = gdk_x11_window_get_root_origin;
   impl_class->get_frame_extents = gdk_x11_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_x11_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_x11_window_set_accept_focus;


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