clutter: Make ClutterInputFocus API to set panel state explicit

Before we just had API to toggle the OSK panel state. Make this API
generic so the upper layers may set the state as they see fit.
All callers have been updated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/432
This commit is contained in:
Carlos Garnacho 2019-02-08 22:48:43 +01:00 committed by Carlos Garnacho
parent 033a771e8c
commit 3fd0e23ed9
7 changed files with 14 additions and 10 deletions

View File

@ -175,7 +175,8 @@ clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
} }
void void
clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus) clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus,
ClutterInputPanelState state)
{ {
ClutterInputFocusPrivate *priv; ClutterInputFocusPrivate *priv;
@ -184,7 +185,7 @@ clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus)
priv = clutter_input_focus_get_instance_private (focus); priv = clutter_input_focus_get_instance_private (focus);
clutter_input_method_toggle_input_panel (priv->im); clutter_input_method_set_input_panel_state (priv->im, state);
} }
void void

View File

@ -78,6 +78,7 @@ CLUTTER_EXPORT
void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus, void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
gboolean can_show_preedit); gboolean can_show_preedit);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus); void clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus,
ClutterInputPanelState state);
#endif /* __CLUTTER_INPUT_FOCUS_H__ */ #endif /* __CLUTTER_INPUT_FOCUS_H__ */

View File

@ -363,12 +363,12 @@ clutter_input_method_notify_key_event (ClutterInputMethod *im,
} }
void void
clutter_input_method_toggle_input_panel (ClutterInputMethod *im) clutter_input_method_set_input_panel_state (ClutterInputMethod *im,
ClutterInputPanelState state)
{ {
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im)); g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
g_signal_emit (im, signals[INPUT_PANEL_STATE], 0, g_signal_emit (im, signals[INPUT_PANEL_STATE], 0, state);
CLUTTER_INPUT_PANEL_STATE_TOGGLE);
} }
void void

View File

@ -83,7 +83,8 @@ void clutter_input_method_notify_key_event (ClutterInputMethod *im,
const ClutterEvent *event, const ClutterEvent *event,
gboolean filtered); gboolean filtered);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_method_request_toggle_input_panel (ClutterInputMethod *im); void clutter_input_method_set_input_panel_state (ClutterInputMethod *im,
ClutterInputPanelState state);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_method_forward_key (ClutterInputMethod *im, void clutter_input_method_forward_key (ClutterInputMethod *im,

View File

@ -2186,7 +2186,8 @@ clutter_text_press (ClutterActor *actor,
return CLUTTER_EVENT_PROPAGATE; return CLUTTER_EVENT_PROPAGATE;
clutter_actor_grab_key_focus (actor); clutter_actor_grab_key_focus (actor);
clutter_input_focus_request_toggle_input_panel (priv->input_focus); clutter_input_focus_set_input_panel_state (priv->input_focus,
CLUTTER_INPUT_PANEL_STATE_TOGGLE);
/* if the actor is empty we just reset everything and not /* if the actor is empty we just reset everything and not
* set up the dragging of the selection since there's nothing * set up the dragging of the selection since there's nothing

View File

@ -309,7 +309,7 @@ text_input_enable (struct wl_client *client,
clutter_input_focus_set_can_show_preedit (focus, show_preedit); clutter_input_focus_set_can_show_preedit (focus, show_preedit);
if (flags & GTK_TEXT_INPUT_ENABLE_FLAGS_TOGGLE_INPUT_PANEL) if (flags & GTK_TEXT_INPUT_ENABLE_FLAGS_TOGGLE_INPUT_PANEL)
clutter_input_focus_request_toggle_input_panel (focus); clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_TOGGLE);
} }
static void static void

View File

@ -549,7 +549,7 @@ text_input_commit_state (struct wl_client *client,
meta_wayland_text_input_reset (text_input); meta_wayland_text_input_reset (text_input);
if (toggle_panel) if (toggle_panel)
clutter_input_focus_request_toggle_input_panel (focus); clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_TOGGLE);
} }
static struct zwp_text_input_v3_interface meta_text_input_interface = { static struct zwp_text_input_v3_interface meta_text_input_interface = {