1
0
Fork 0

core: Change MetaWaylandTextInput event forwarding to IMs

We need to juggle with some things here to keep key event ordering
and accounting consistent.

The keyboard internal state changes (and maybe modifier event emission)
happening through meta_wayland_seat_update() should ideally happen
from the same key events that reach the client through wl_keyboard.key,
so that wl_keyboard.modifier events are emitted in the right relative
order to other key events.

In order to fix this, we need to decide at an earlier point whether
the event will get processed through IM (and maybe be reinjected),
thus ignored in wait of IM-postprocessed events.

This means we pay less attention to whether events are first-hand
hardware events for some things and go with the event that does
eventually reach to us (hardware or IM).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5890
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
This commit is contained in:
Carlos Garnacho 2023-06-07 12:58:36 +02:00 committed by Marge Bot
parent eaa09be17c
commit bc04fcb89d
2 changed files with 15 additions and 3 deletions

View file

@ -226,10 +226,16 @@ meta_display_handle_event (MetaDisplay *display,
gboolean has_grab;
#ifdef HAVE_WAYLAND
MetaWaylandCompositor *wayland_compositor;
MetaWaylandTextInput *wayland_text_input = NULL;
#endif
#ifdef HAVE_WAYLAND
wayland_compositor = meta_context_get_wayland_compositor (context);
if (wayland_compositor)
{
wayland_text_input =
meta_wayland_compositor_get_text_input (wayland_compositor);
}
#endif
COGL_TRACE_BEGIN_SCOPED (MetaDisplayHandleEvent,
@ -278,6 +284,15 @@ meta_display_handle_event (MetaDisplay *display,
}
#ifdef HAVE_WAYLAND
if (wayland_text_input &&
!has_grab &&
!meta_compositor_get_current_window_drag (compositor) &&
meta_wayland_text_input_update (wayland_text_input, event))
{
bypass_wayland = bypass_clutter = TRUE;
goto out;
}
if (wayland_compositor)
meta_wayland_compositor_update (wayland_compositor, event);
#endif

View file

@ -384,9 +384,6 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
break;
case CLUTTER_KEY_PRESS:
case CLUTTER_KEY_RELEASE:
if (meta_wayland_text_input_update (seat->text_input, event))
return TRUE;
if (meta_wayland_seat_has_keyboard (seat))
return meta_wayland_keyboard_handle_event (seat->keyboard,
(const ClutterKeyEvent *) event);