Merge branch 'provide-touch-serial-later' into 'main'

gdk/wayland: Proivde latest touch serial even after a touch ended

See merge request GNOME/gtk!5782
This commit is contained in:
Carlos Garnacho
2024-04-03 08:43:03 +00:00
2 changed files with 17 additions and 5 deletions

View File

@@ -182,6 +182,8 @@ struct _GdkWaylandSeat
GdkWaylandPointerData pointer_info;
GdkWaylandPointerData touch_info;
uint32_t latest_touch_down_serial;
GdkModifierType key_modifiers;
GdkSurface *keyboard_focus;
GdkSurface *grab_surface;

View File

@@ -1640,6 +1640,7 @@ touch_handle_down (void *data,
touch->x = wl_fixed_to_double (x);
touch->y = wl_fixed_to_double (y);
touch->touch_down_serial = serial;
seat->latest_touch_down_serial = serial;
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
@@ -4390,15 +4391,24 @@ _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
serial = tablet->pointer_info.press_serial;
}
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
if (g_hash_table_size (seat->touches) > 0)
{
if (touch->touch_down_serial > serial)
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
{
if (sequence)
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
serial = touch->touch_down_serial;
if (touch->touch_down_serial > serial)
{
if (sequence)
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
serial = touch->touch_down_serial;
}
}
}
else
{
if (seat->latest_touch_down_serial > serial)
serial = seat->latest_touch_down_serial;
}
return serial;
}