From 3fd0e23ed9fca6cb18b630aea471756c10fa6485 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 8 Feb 2019 22:48:43 +0100 Subject: [PATCH] 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 --- clutter/clutter/clutter-input-focus.c | 5 +++-- clutter/clutter/clutter-input-focus.h | 3 ++- clutter/clutter/clutter-input-method.c | 6 +++--- clutter/clutter/clutter-input-method.h | 3 ++- clutter/clutter/clutter-text.c | 3 ++- src/wayland/meta-wayland-text-input-legacy.c | 2 +- src/wayland/meta-wayland-text-input.c | 2 +- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/clutter/clutter/clutter-input-focus.c b/clutter/clutter/clutter-input-focus.c index 51381ace6..d54494b0f 100644 --- a/clutter/clutter/clutter-input-focus.c +++ b/clutter/clutter/clutter-input-focus.c @@ -175,7 +175,8 @@ clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus, } void -clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus) +clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus, + ClutterInputPanelState state) { ClutterInputFocusPrivate *priv; @@ -184,7 +185,7 @@ clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *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 diff --git a/clutter/clutter/clutter-input-focus.h b/clutter/clutter/clutter-input-focus.h index 619060382..3f971fec4 100644 --- a/clutter/clutter/clutter-input-focus.h +++ b/clutter/clutter/clutter-input-focus.h @@ -78,6 +78,7 @@ CLUTTER_EXPORT void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus, gboolean can_show_preedit); 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__ */ diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c index de58d5087..5b6311878 100644 --- a/clutter/clutter/clutter-input-method.c +++ b/clutter/clutter/clutter-input-method.c @@ -363,12 +363,12 @@ clutter_input_method_notify_key_event (ClutterInputMethod *im, } 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_signal_emit (im, signals[INPUT_PANEL_STATE], 0, - CLUTTER_INPUT_PANEL_STATE_TOGGLE); + g_signal_emit (im, signals[INPUT_PANEL_STATE], 0, state); } void diff --git a/clutter/clutter/clutter-input-method.h b/clutter/clutter/clutter-input-method.h index be0dee7b6..ba1bc223a 100644 --- a/clutter/clutter/clutter-input-method.h +++ b/clutter/clutter/clutter-input-method.h @@ -83,7 +83,8 @@ void clutter_input_method_notify_key_event (ClutterInputMethod *im, const ClutterEvent *event, gboolean filtered); 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 void clutter_input_method_forward_key (ClutterInputMethod *im, diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index b6f054863..fb9d926df 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -2186,7 +2186,8 @@ clutter_text_press (ClutterActor *actor, return CLUTTER_EVENT_PROPAGATE; 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 * set up the dragging of the selection since there's nothing diff --git a/src/wayland/meta-wayland-text-input-legacy.c b/src/wayland/meta-wayland-text-input-legacy.c index ddd2cce80..d4caa9aad 100644 --- a/src/wayland/meta-wayland-text-input-legacy.c +++ b/src/wayland/meta-wayland-text-input-legacy.c @@ -309,7 +309,7 @@ text_input_enable (struct wl_client *client, clutter_input_focus_set_can_show_preedit (focus, show_preedit); 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 diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c index c87f5a1e8..6f0191553 100644 --- a/src/wayland/meta-wayland-text-input.c +++ b/src/wayland/meta-wayland-text-input.c @@ -549,7 +549,7 @@ text_input_commit_state (struct wl_client *client, meta_wayland_text_input_reset (text_input); 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 = {