1
0
Fork 0

wayland: Register touchpoint info on CLUTTER_ENTER

The first event happening for a new touch will be the CLUTTER_ENTER
event generated when picking it. Use this event for registration of
the touch info, so that MetaWaylandEventHandler.get_focus_surface may
get the right focus surface for the device/sequence on the first try.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3889>
(cherry picked from commit 2e82a2049f)
This commit is contained in:
Carlos Garnacho 2024-07-15 23:02:19 +02:00 committed by Jonas Ådahl
parent 1c57f38daf
commit 04b2b87959
2 changed files with 17 additions and 4 deletions

View file

@ -435,12 +435,24 @@ meta_wayland_seat_update (MetaWaylandSeat *seat,
switch (clutter_event_type (event))
{
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
if (clutter_event_get_event_sequence (event))
{
if (meta_wayland_seat_has_touch (seat))
meta_wayland_touch_update (seat->touch, event);
}
else
{
if (meta_wayland_seat_has_pointer (seat))
meta_wayland_pointer_update (seat->pointer, event);
}
break;
case CLUTTER_MOTION:
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
case CLUTTER_SCROLL:
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
if (meta_wayland_seat_has_pointer (seat))
meta_wayland_pointer_update (seat->pointer, event);
break;

View file

@ -226,7 +226,7 @@ meta_wayland_touch_update (MetaWaylandTouch *touch,
sequence = clutter_event_get_event_sequence (event);
event_type = clutter_event_type (event);
if (event_type == CLUTTER_TOUCH_BEGIN)
if (event_type == CLUTTER_ENTER)
{
MetaWaylandSurface *surface = NULL;
MetaBackend *backend;
@ -256,7 +256,8 @@ meta_wayland_touch_update (MetaWaylandTouch *touch,
if (!touch_info)
return;
if (event_type != CLUTTER_TOUCH_BEGIN &&
if ((event_type == CLUTTER_TOUCH_UPDATE ||
event_type == CLUTTER_TOUCH_END) &&
!touch_info->begin_delivered)
{
g_hash_table_remove (touch->touches, sequence);