[mutter/wip/carlosg/no-toggle-panel-across-focus: 2/3] wayland: Only enable OSK if receiving .enable when already active



commit f55d23d7237719a1b8eab7e86a7254ba4d1282fe
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 8 22:51:28 2019 +0100

    wayland: Only enable OSK if receiving .enable when already active
    
    Enable the OSK if receiving .enable consecutively (i.e. the
    ClutterInputFocus was already focused). We specifically want to avoid
    enabling the panel just because of focus changes within a surface (where
    the .disable request across focus change would previously unfocus the
    ClutterInputFocus). Prior state should be preserved if possible in that
    situation.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/432

 src/wayland/meta-wayland-text-input.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c
index 6f0191553..c65c063a6 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -471,7 +471,7 @@ text_input_commit_state (struct wl_client   *client,
 {
   MetaWaylandTextInput *text_input = wl_resource_get_user_data (resource);
   ClutterInputFocus *focus = text_input->input_focus;
-  gboolean toggle_panel = FALSE;
+  gboolean enable_panel = FALSE;
 
   increment_serial (text_input, resource);
 
@@ -493,9 +493,12 @@ text_input_commit_state (struct wl_client   *client,
               else
                 return;
             }
+          else
+            {
+              enable_panel = TRUE;
+            }
 
           clutter_input_focus_set_can_show_preedit (focus, TRUE);
-          toggle_panel = TRUE;
         }
       else if (clutter_input_focus_is_focused (focus))
         {
@@ -548,8 +551,8 @@ text_input_commit_state (struct wl_client   *client,
 
   meta_wayland_text_input_reset (text_input);
 
-  if (toggle_panel)
-    clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_TOGGLE);
+  if (enable_panel)
+    clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_ON);
 }
 
 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]