diff --git a/gdk/wayland/gdkdevice-wayland-private.h b/gdk/wayland/gdkdevice-wayland-private.h index a1942fbe38..3dae422081 100644 --- a/gdk/wayland/gdkdevice-wayland-private.h +++ b/gdk/wayland/gdkdevice-wayland-private.h @@ -6,7 +6,6 @@ void gdk_wayland_device_query_state (GdkDevice *device, GdkSurface *surface, - GdkSurface **child_surface, double *win_x, double *win_y, GdkModifierType *mask); diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index f55a593ba4..fbbceacb65 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -521,29 +521,32 @@ device_get_modifiers (GdkDevice *device) void gdk_wayland_device_query_state (GdkDevice *device, GdkSurface *surface, - GdkSurface **child_surface, double *win_x, double *win_y, GdkModifierType *mask) { GdkWaylandPointerData *pointer; - GList *children = NULL; + double x, y; - if (surface == NULL) - children = gdk_wayland_display_get_toplevel_surfaces (gdk_device_get_display (device)); - - pointer = GDK_WAYLAND_DEVICE (device)->pointer; - - if (child_surface) - /* Set child only if actually a child of the given surface, as XIQueryPointer() does */ - *child_surface = g_list_find (children, pointer->focus) ? pointer->focus : NULL; if (mask) *mask = device_get_modifiers (device); + pointer = GDK_WAYLAND_DEVICE (device)->pointer; + + if (pointer->focus == surface) + { + x = pointer->surface_x; + y = pointer->surface_y; + } + else + { + x = y = -1; + } + if (win_x) - *win_x = pointer->surface_x; + *win_x = x; if (win_y) - *win_y = pointer->surface_y; + *win_y = y; } static void diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 45769984ea..0fc030f9b4 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -3173,7 +3173,7 @@ gdk_wayland_surface_get_device_state (GdkSurface *surface, if (GDK_SURFACE_DESTROYED (surface)) return FALSE; - gdk_wayland_device_query_state (device, surface, NULL, x, y, mask); + gdk_wayland_device_query_state (device, surface, x, y, mask); return *x >= 0 && *y >= 0 && *x < surface->width && *y < surface->height; }