wayland: Add default event interface handling seat events

This is implemented at the MetaWaylandSeat level, and it governs
focus and event delivery for all devices, falling through each
of the MetaWaylandPointer/MetaWaylandKeyboard/etc components.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
This commit is contained in:
Carlos Garnacho
2023-11-16 14:09:55 +01:00
committed by Robert Mader
parent a2c11f0e87
commit 80ed79a0d3
4 changed files with 178 additions and 8 deletions

View File

@ -303,6 +303,9 @@ sync_focus_surface (MetaWaylandPointer *pointer)
{
MetaBackend *backend = backend_from_pointer (pointer);
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
MetaWaylandInput *input;
if (clutter_stage_get_grab_actor (stage) != NULL)
{
@ -310,8 +313,8 @@ sync_focus_surface (MetaWaylandPointer *pointer)
return;
}
const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface;
interface->focus (pointer->grab, pointer->current);
input = meta_wayland_seat_get_input (seat);
meta_wayland_input_invalidate_focus (input, pointer->device, NULL);
}
static void
@ -460,9 +463,6 @@ default_grab_focus (MetaWaylandPointerGrab *grab,
if (clutter_stage_get_grab_actor (stage) != NULL)
return;
if (pointer->button_count > 0)
return;
if (surface)
{
MetaWindow *window = NULL;
@ -1550,3 +1550,12 @@ meta_wayland_pointer_get_current_surface (MetaWaylandPointer *pointer)
{
return pointer->current;
}
MetaWaylandSurface *
meta_wayland_pointer_get_implicit_grab_surface (MetaWaylandPointer *pointer)
{
if (pointer->button_count > 0)
return pointer->focus_surface;
return NULL;
}