mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
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:
parent
ff4953caa6
commit
7716b62fa2
@ -190,7 +190,22 @@ clutter_input_focus_filter_event (ClutterInputFocus *focus,
|
||||
{
|
||||
return clutter_input_method_filter_key_event (priv->im, &event->key);
|
||||
}
|
||||
else if (event->type == CLUTTER_IM_COMMIT)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_input_focus_process_event (ClutterInputFocus *focus,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
ClutterInputFocusPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_FOCUS (focus), FALSE);
|
||||
g_return_val_if_fail (clutter_input_focus_is_focused (focus), FALSE);
|
||||
|
||||
priv = clutter_input_focus_get_instance_private (focus);
|
||||
|
||||
if (event->type == CLUTTER_IM_COMMIT)
|
||||
{
|
||||
clutter_input_focus_commit (focus, event->im.text);
|
||||
return TRUE;
|
||||
|
@ -75,6 +75,11 @@ void clutter_input_focus_set_content_purpose (ClutterInputFocus *focus,
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_focus_filter_event (ClutterInputFocus *focus,
|
||||
const ClutterEvent *event);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_focus_process_event (ClutterInputFocus *focus,
|
||||
const ClutterEvent *event);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
|
||||
gboolean can_show_preedit);
|
||||
|
@ -3080,7 +3080,7 @@ clutter_text_event (ClutterActor *self,
|
||||
event->type == CLUTTER_IM_DELETE ||
|
||||
event->type == CLUTTER_IM_PREEDIT))
|
||||
{
|
||||
return clutter_input_focus_filter_event (priv->input_focus, event);
|
||||
return clutter_input_focus_process_event (priv->input_focus, event);
|
||||
}
|
||||
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
@ -384,7 +384,7 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
|
||||
break;
|
||||
case CLUTTER_KEY_PRESS:
|
||||
case CLUTTER_KEY_RELEASE:
|
||||
if (meta_wayland_text_input_handle_event (seat->text_input, event))
|
||||
if (meta_wayland_text_input_update (seat->text_input, event))
|
||||
return TRUE;
|
||||
|
||||
if (meta_wayland_seat_has_keyboard (seat))
|
||||
|
@ -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)
|
||||
|
@ -41,6 +41,9 @@ gboolean meta_wayland_text_input_init (MetaWaylandCompositor *compositor);
|
||||
void meta_wayland_text_input_set_focus (MetaWaylandTextInput *text_input,
|
||||
MetaWaylandSurface *surface);
|
||||
|
||||
gboolean meta_wayland_text_input_update (MetaWaylandTextInput *text_input,
|
||||
const ClutterEvent *event);
|
||||
|
||||
gboolean meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
|
||||
const ClutterEvent *event);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user