backends: Add private call to update MetaBackend from a device

We update some details like the last used device and pointer visibility
from events, but this is done inconsistently on X11 since the
ClutterEvents are created and pushed from an additional place.

Make these updates happen on a private call, that will be called from
these places in X11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
This commit is contained in:
Carlos Garnacho 2022-02-05 13:11:06 +01:00 committed by Marge Bot
parent f5c0bcbf9c
commit 13330f34f3
2 changed files with 12 additions and 2 deletions

View File

@ -202,4 +202,7 @@ void meta_backend_remove_hw_cursor_inhibitor (MetaBackend *backend,
gboolean meta_backend_is_hw_cursors_inhibited (MetaBackend *backend);
void meta_backend_update_from_event (MetaBackend *backend,
ClutterEvent *event);
#endif /* META_BACKEND_PRIVATE_H */

View File

@ -1065,8 +1065,7 @@ clutter_source_dispatch (GSource *source,
event->any.stage =
CLUTTER_STAGE (meta_backend_get_stage (backend_source->backend));
clutter_do_event (event);
update_last_device_from_event (backend_source->backend, event);
update_pointer_visibility_from_event (backend_source->backend, event);
meta_backend_update_from_event (backend_source->backend, event);
clutter_event_free (event);
}
@ -1680,3 +1679,11 @@ meta_backend_is_hw_cursors_inhibited (MetaBackend *backend)
return FALSE;
}
void
meta_backend_update_from_event (MetaBackend *backend,
ClutterEvent *event)
{
update_last_device_from_event (backend, event);
update_pointer_visibility_from_event (backend, event);
}