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.
This commit is contained in:
Jasper St. Pierre 2014-03-17 15:39:39 -04:00
parent c663cabe7b
commit efdd68b3b0
8 changed files with 9 additions and 96 deletions

View File

@ -724,24 +724,6 @@ gdk_window_broadway_get_root_coords (GdkWindow *window,
*root_y = y + impl->wrapper->y;
}
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;

View File

@ -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;

View File

@ -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;
}
/**

View File

@ -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,

View File

@ -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;

View File

@ -1663,18 +1663,6 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
gdk_wayland_window_sync_transient_for (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;

View File

@ -2063,27 +2063,6 @@ gdk_win32_window_restack_toplevel (GdkWindow *window,
// ### TODO
}
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;

View File

@ -3113,22 +3113,6 @@ gdk_window_x11_get_root_coords (GdkWindow *window,
*root_y = ty / impl->window_scale;
}
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;