wayland: Forward button press / touch down to Wayland text-input impls

These are ClutterInputFocus subclasses, so this will trigger reset of
the input method. As the .done event is possibly deferred in the
zwp_text_input_v3 implementation, ensure the changes caused by the
reset are flushed immediately, before the button press is forwarded
to the client by MetaWaylandPointer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1940>
This commit is contained in:
Carlos Garnacho 2021-07-27 16:50:50 +02:00 committed by Marge Bot
parent f4a32cb7cd
commit 405ec8edc2
2 changed files with 17 additions and 1 deletions

View File

@ -387,6 +387,14 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
!event_from_supported_hardware_device (seat, event))
return FALSE;
if (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN)
{
meta_wayland_text_input_handle_event (seat->text_input, event);
meta_wayland_gtk_text_input_handle_event (seat->gtk_text_input,
event);
}
switch (event->type)
{
case CLUTTER_MOTION:

View File

@ -753,6 +753,8 @@ gboolean
meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
const ClutterEvent *event)
{
gboolean retval;
if (!text_input->surface ||
!clutter_input_focus_is_focused (text_input->input_focus))
return FALSE;
@ -762,5 +764,11 @@ meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_INPUT_METHOD)
meta_wayland_text_input_focus_flush_done (text_input->input_focus);
return clutter_input_focus_filter_event (text_input->input_focus, event);
retval = clutter_input_focus_filter_event (text_input->input_focus, event);
if (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN)
meta_wayland_text_input_focus_flush_done (text_input->input_focus);
return retval;
}