[mutter/wip/carlosg/no-toggle-panel-across-focus: 3/3] wayland: Minor refactor



commit 88b1927c257e7827fbfa8962f66417b1db2c97b1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 25 19:39:14 2019 +0100

    wayland: Minor refactor
    
    We use the input_method on both branches, but only check for its existence
    when enabling the text_input. The case of focusing out shouldn't happen in
    practice as we couldn't have focused in ever before, but still make the
    check one level above so it's clearer that the text_input's IM focus cannot
    be enabled without an IM implementation.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/432

 src/wayland/meta-wayland-text-input.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c
index c65c063a6..d9e1e36b1 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -472,31 +472,24 @@ text_input_commit_state (struct wl_client   *client,
   MetaWaylandTextInput *text_input = wl_resource_get_user_data (resource);
   ClutterInputFocus *focus = text_input->input_focus;
   gboolean enable_panel = FALSE;
+  ClutterInputMethod *input_method;
 
   increment_serial (text_input, resource);
 
   if (text_input->surface == NULL)
     return;
 
-  if (text_input->pending_state & META_WAYLAND_PENDING_STATE_ENABLED)
-    {
-      ClutterInputMethod *input_method;
-
-      input_method = clutter_backend_get_input_method (clutter_get_default_backend ());
+  input_method = clutter_backend_get_input_method (clutter_get_default_backend ());
 
+  if (input_method &&
+      text_input->pending_state & META_WAYLAND_PENDING_STATE_ENABLED)
+    {
       if (text_input->enabled)
         {
           if (!clutter_input_focus_is_focused (focus))
-            {
-              if (input_method)
-                clutter_input_method_focus_in (input_method, focus);
-              else
-                return;
-            }
+            clutter_input_method_focus_in (input_method, focus);
           else
-            {
-              enable_panel = TRUE;
-            }
+            enable_panel = TRUE;
 
           clutter_input_focus_set_can_show_preedit (focus, TRUE);
         }


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