mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
compositor: Sync pointer after begin/end modal on X11
Ensure we issue a motion event for the current pointer position, as there might be situations where compositor modals get X grabs from other clients stacked on top, or missed events in between otherwise. Ensure the Clutter state is still up-to-date afterwards here. This replaces some sync_pointer() calls done in GNOME Shell code, always done after modality changes. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1659>
This commit is contained in:
parent
00c7f45a0f
commit
437f5d1c66
@ -921,3 +921,28 @@ meta_backend_x11_reload_cursor (MetaBackendX11 *x11)
|
||||
|
||||
meta_cursor_renderer_force_update (cursor_renderer);
|
||||
}
|
||||
|
||||
void
|
||||
meta_backend_x11_sync_pointer (MetaBackendX11 *backend_x11)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (backend_x11);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
ClutterInputDevice *pointer = clutter_seat_get_pointer (seat);
|
||||
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
ClutterModifierType modifiers;
|
||||
ClutterEvent *event;
|
||||
graphene_point_t pos;
|
||||
|
||||
event = clutter_event_new (CLUTTER_MOTION);
|
||||
clutter_seat_query_state (seat, pointer, NULL, &pos, &modifiers);
|
||||
clutter_event_set_flags (event, CLUTTER_EVENT_FLAG_SYNTHETIC);
|
||||
clutter_event_set_coords (event, pos.x, pos.y);
|
||||
clutter_event_set_device (event, pointer);
|
||||
clutter_event_set_state (event, modifiers);
|
||||
clutter_event_set_source_device (event, NULL);
|
||||
clutter_event_set_stage (event, stage);
|
||||
|
||||
clutter_event_put (event);
|
||||
clutter_event_free (event);
|
||||
}
|
||||
|
@ -58,4 +58,6 @@ uint8_t meta_backend_x11_get_xkb_event_base (MetaBackendX11 *x11);
|
||||
|
||||
void meta_backend_x11_reload_cursor (MetaBackendX11 *x11);
|
||||
|
||||
void meta_backend_x11_sync_pointer (MetaBackendX11 *backend_x11);
|
||||
|
||||
#endif /* META_BACKEND_X11_H */
|
||||
|
@ -442,11 +442,17 @@ meta_compositor_x11_monotonic_to_high_res_xserver_time (MetaCompositor *composit
|
||||
static void
|
||||
meta_compositor_x11_grab_begin (MetaCompositor *compositor)
|
||||
{
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (meta_get_backend ());
|
||||
|
||||
meta_backend_x11_sync_pointer (backend_x11);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_compositor_x11_grab_end (MetaCompositor *compositor)
|
||||
{
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (meta_get_backend ());
|
||||
|
||||
meta_backend_x11_sync_pointer (backend_x11);
|
||||
}
|
||||
|
||||
Window
|
||||
|
Loading…
Reference in New Issue
Block a user