Merge branch 'broadway-device-query-state-fix' into 'main'

GTK4 gdk/broadway: correct gdk_broadway_device_query_state() to return pointer coordinates relative to the upper left corner of surface

See merge request GNOME/gtk!5053
This commit is contained in:
Matthias Clasen 2022-09-28 01:38:45 +00:00
commit 5f469d8903

View File

@ -84,6 +84,7 @@ gdk_broadway_device_query_state (GdkDevice *device,
gint32 device_root_x, device_root_y;
guint32 mouse_toplevel_id;
guint32 mask32;
int origin_x, origin_y;
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
return;
@ -97,10 +98,12 @@ gdk_broadway_device_query_state (GdkDevice *device,
&device_root_y,
&mask32);
gdk_surface_get_origin (surface, &origin_x, &origin_y);
if (win_x)
*win_x = device_root_x;
*win_x = device_root_x - origin_x;
if (win_y)
*win_y = device_root_y;
*win_y = device_root_y - origin_y;
if (mask)
*mask = mask32;
}