core: Do not update last device on CLUTTER_DEVICE_ADDED/REMOVED

We only update the last device from actual input interaction here,
avoid this pair of events. This is specially nasty with
CLUTTER_DEVICE_REMOVED, since the device we're notifying upon will be
disposed soon after emission.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
This commit is contained in:
Carlos Garnacho 2020-09-25 18:49:19 +02:00
parent 16139efa5c
commit 86fa8aff4a

View File

@ -205,7 +205,6 @@ meta_display_handle_event (MetaDisplay *display,
G_GNUC_UNUSED gboolean bypass_wayland = FALSE; G_GNUC_UNUSED gboolean bypass_wayland = FALSE;
MetaGestureTracker *gesture_tracker; MetaGestureTracker *gesture_tracker;
ClutterEventSequence *sequence; ClutterEventSequence *sequence;
ClutterInputDevice *source;
sequence = clutter_event_get_event_sequence (event); sequence = clutter_event_get_event_sequence (event);
@ -271,10 +270,17 @@ meta_display_handle_event (MetaDisplay *display,
} }
} }
if (event->type != CLUTTER_DEVICE_ADDED &&
event->type != CLUTTER_DEVICE_REMOVED)
{
ClutterInputDevice *source;
handle_idletime_for_event (event);
source = clutter_event_get_source_device (event); source = clutter_event_get_source_device (event);
if (source) if (source)
meta_backend_update_last_device (backend, source); meta_backend_update_last_device (backend, source);
}
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION) if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
@ -299,8 +305,6 @@ meta_display_handle_event (MetaDisplay *display,
} }
#endif #endif
handle_idletime_for_event (event);
window = get_window_for_event (display, event); window = get_window_for_event (display, event);
display->current_time = event->any.time; display->current_time = event->any.time;