[mutter/wip/carlosg/committed-and-done: 3/3] wayland: Always acknowledge state changing .commit() events with .done()




commit 90ba6a8b31bdc31a067aab75c1aad92c4206fa34
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 6 13:32:32 2022 +0200

    wayland: Always acknowledge state changing .commit() events with .done()
    
    As of currently, we only emit .done() on actual changes coming from the
    ClutterInputMethod/ClutterInputFocus. With the recent changes in the
    interpretation of serials, it becomes more important now that the
    compositor acknowledges other state changes that do not necessarily
    trigger IM activity (e.g. cursor navigation), so that the client gets
    a recent enough .done() event and can keep feeding updates.
    
    Handle surrounding text and caret position changes as .done() worthy,
    so that these changes are acknowledged independently of IM changes.

 src/wayland/meta-wayland-text-input.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c
index b29c62b87d..c0fbc7279c 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -575,7 +575,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 enable_panel = FALSE;
+  gboolean enable_panel = FALSE, ack_commit = FALSE;
   ClutterInputMethod *input_method;
 
   increment_serial (text_input, resource);
@@ -625,6 +625,7 @@ text_input_commit_state (struct wl_client   *client,
                                            text_input->surrounding.text,
                                            text_input->surrounding.cursor,
                                            text_input->surrounding.anchor);
+      ack_commit = TRUE;
     }
 
   if (text_input->pending_state & META_WAYLAND_PENDING_STATE_INPUT_RECT)
@@ -644,12 +645,16 @@ text_input_commit_state (struct wl_client   *client,
       graphene_rect_init (&cursor_rect, x1, y1, x2 - x1, y2 - y1);
       clutter_input_focus_set_cursor_location (text_input->input_focus,
                                                &cursor_rect);
+      ack_commit = TRUE;
     }
 
   meta_wayland_text_input_reset (text_input);
 
   if (enable_panel)
     clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_ON);
+
+  if (ack_commit)
+    meta_wayland_text_input_focus_defer_done (focus);
 }
 
 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]