clutter: Separate ClutterInputFocus event processing and filtering

Currently, we let the same function handle key event filtering as they
are passed to the IM, and the IM events resulting in actions like text
commit or preedit changes.

Split these two aspects into filter/process functions, and port
ClutterText to it. MetaWaylandTextInput still handles everything in
a single place, but that will be split in later commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
This commit is contained in:
Carlos Garnacho
2023-06-01 19:42:22 +02:00
committed by Marge Bot
parent ff4953caa6
commit 7716b62fa2
6 changed files with 42 additions and 4 deletions

View File

@ -800,6 +800,21 @@ meta_wayland_text_input_init (MetaWaylandCompositor *compositor)
bind_text_input) != NULL);
}
gboolean
meta_wayland_text_input_update (MetaWaylandTextInput *text_input,
const ClutterEvent *event)
{
if (!text_input->surface ||
!clutter_input_focus_is_focused (text_input->input_focus))
return FALSE;
if (event->type == CLUTTER_KEY_PRESS ||
event->type == CLUTTER_KEY_RELEASE)
return clutter_input_focus_filter_event (text_input->input_focus, event);
return FALSE;
}
gboolean
meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
const ClutterEvent *event)
@ -815,7 +830,7 @@ 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);
retval = clutter_input_focus_filter_event (text_input->input_focus, event);
retval = clutter_input_focus_process_event (text_input->input_focus, event);
if (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN)