[mutter/wip/carlosg/no-toggle-panel-across-focus: 1/3] clutter: Make ClutterInputFocus API to set panel state explicit



commit c6c83077329b3b865be21a1dba31936c342a5e84
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 8 22:48:43 2019 +0100

    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.

 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 cb5364b21..8f0c4b07c 100644
--- a/clutter/clutter/clutter-input-method.c
+++ b/clutter/clutter/clutter-input-method.c
@@ -361,12 +361,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 2c7c10203..16249e2dc 100644
--- a/clutter/clutter/clutter-text.c
+++ b/clutter/clutter/clutter-text.c
@@ -1998,7 +1998,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 7de9b91e2..f121bb069 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -547,7 +547,7 @@ text_input_commit_state (struct wl_client   *client,
   text_input->pending_state = META_WAYLAND_PENDING_STATE_NONE;
 
   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 = {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]