summaryrefslogtreecommitdiff
path: root/gdk/wayland
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-03-17 15:11:13 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2014-03-17 15:36:41 -0400
commit92833a0b823d49ba178f7ecd849988aadcbbf9ae (patch)
treee93afd38d8ba190cb5bfa26e92ccdd12a762ebb0 /gdk/wayland
parent35a1f49db5d7a4715c150561a29d103914df5c94 (diff)
downloadgtk+-92833a0b823d49ba178f7ecd849988aadcbbf9ae.tar.gz
wayland: Properly apply the fake root offset to event coordinates
GdkEvent's x_root and y_root values should be in the same "fake root window" coordinate space as gdk_window_get_root_coords.
Diffstat (limited to 'gdk/wayland')
-rw-r--r--gdk/wayland/gdkdevice-wayland.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 88e6e3fe5d..c4f93aea58 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -242,15 +242,30 @@ get_coordinates (GdkWaylandDeviceData *data,
double *x, double *y,
double *x_root, double *y_root)
{
+ int root_x, root_y;
+
if (x)
*x = data->surface_x;
if (y)
*y = data->surface_y;
- /* TODO: Do something clever for relative here */
+
+ if (data->pointer_focus)
+ {
+ gdk_window_get_root_coords (data->pointer_focus,
+ data->surface_x,
+ data->surface_y,
+ &root_x, &root_y);
+ }
+ else
+ {
+ root_x = data->surface_x;
+ root_y = data->surface_y;
+ }
+
if (x_root)
- *x_root = data->surface_x;
+ *x_root = root_x;
if (y_root)
- *y_root = data->surface_y;
+ *y_root = root_y;
}
static void