[mutter/wip/carlosg/im-update-preedit-with-mode: 4/4] wayland: Forward button press / touch down to Wayland text-input impls




commit 7ac624373e2cbf37e82375023316a7fedcdb81b3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 27 16:50:50 2021 +0200

    wayland: Forward button press / touch down to Wayland text-input impls
    
    These are ClutterInputFocus subclasses, so this will trigger reset of
    the input method. As the .done event is possibly deferred in the
    zwp_text_input_v3 implementation, ensure the changes caused by the
    reset are flushed immediately, before the button press is forwarded
    to the client by MetaWaylandPointer.

 src/wayland/meta-wayland-seat.c       |  8 ++++++++
 src/wayland/meta-wayland-text-input.c | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index abc0b4ddae..c6390dde78 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -387,6 +387,14 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
       !event_from_supported_hardware_device (seat, event))
     return FALSE;
 
+  if (event->type == CLUTTER_BUTTON_PRESS ||
+      event->type == CLUTTER_TOUCH_BEGIN)
+    {
+      meta_wayland_text_input_handle_event (seat->text_input, event);
+      meta_wayland_gtk_text_input_handle_event (seat->gtk_text_input,
+                                                event);
+    }
+
   switch (event->type)
     {
     case CLUTTER_MOTION:
diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c
index b471e8e1a3..c892ba752f 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -753,6 +753,8 @@ gboolean
 meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
                                       const ClutterEvent   *event)
 {
+  gboolean retval;
+
   if (!text_input->surface ||
       !clutter_input_focus_is_focused (text_input->input_focus))
     return FALSE;
@@ -762,5 +764,11 @@ meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
       clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_INPUT_METHOD)
     meta_wayland_text_input_focus_flush_done (text_input->input_focus);
 
-  return clutter_input_focus_filter_event (text_input->input_focus, event);
+  retval = clutter_input_focus_filter_event (text_input->input_focus, event);
+
+  if (event->type == CLUTTER_BUTTON_PRESS ||
+      event->type == CLUTTER_TOUCH_BEGIN)
+    meta_wayland_text_input_focus_flush_done (text_input->input_focus);
+
+  return retval;
 }


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