clutter: Ensure we always call handle_event_post for processed events

Since commit 2ceac4a device-related X11 events aren't processed anymore,
causing the input settings not to handle the devices.
This is due to the fact that we may never call clutter_seat_handle_event_post()
for such events.

While this is always happening for the native backend, it doesn't happen in
X11 because the events are removed from the queue as part of
meta_x11_handle_event(), and thus no event was queued to the stage by the
backend events source.

This also makes sure that the event post handler is called after the
event is actually processed, and not before an event is queued.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1564
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1769>
This commit is contained in:
Marco Trevisan (Treviño) 2021-03-10 01:13:34 +01:00 committed by Marge Bot
parent ccbdf91776
commit 012c0a18ef
2 changed files with 3 additions and 5 deletions

View File

@ -1894,8 +1894,10 @@ _clutter_process_event (ClutterEvent *event)
{ {
ClutterMainContext *context; ClutterMainContext *context;
ClutterActor *stage; ClutterActor *stage;
ClutterSeat *seat;
context = _clutter_context_get_default (); context = _clutter_context_get_default ();
seat = clutter_backend_get_default_seat (context->backend);
stage = CLUTTER_ACTOR (event->any.stage); stage = CLUTTER_ACTOR (event->any.stage);
if (stage == NULL) if (stage == NULL)
@ -1911,6 +1913,7 @@ _clutter_process_event (ClutterEvent *event)
context->current_event = g_slist_prepend (context->current_event, event); context->current_event = g_slist_prepend (context->current_event, event);
_clutter_process_event_details (stage, context, event); _clutter_process_event_details (stage, context, event);
clutter_seat_handle_event_post (seat, event);
context->current_event = g_slist_delete_link (context->current_event, context->current_event); context->current_event = g_slist_delete_link (context->current_event, context->current_event);
} }

View File

@ -991,17 +991,12 @@ clutter_source_dispatch (GSource *source,
gpointer user_data) gpointer user_data)
{ {
MetaBackendSource *backend_source = (MetaBackendSource *) source; MetaBackendSource *backend_source = (MetaBackendSource *) source;
MetaBackendPrivate *priv =
meta_backend_get_instance_private (backend_source->backend);
ClutterEvent *event = clutter_event_get (); ClutterEvent *event = clutter_event_get ();
ClutterSeat *seat;
if (event) if (event)
{ {
event->any.stage = event->any.stage =
CLUTTER_STAGE (meta_backend_get_stage (backend_source->backend)); CLUTTER_STAGE (meta_backend_get_stage (backend_source->backend));
seat = clutter_backend_get_default_seat (priv->clutter_backend);
clutter_seat_handle_event_post (seat, event);
clutter_do_event (event); clutter_do_event (event);
clutter_event_free (event); clutter_event_free (event);
} }