[gtk: 1/2] Always emit reset for IM preedit with mouse click



commit 4b2e4f6628ac2505d8db155e00f6d2a430766d30
Author: Takao Fujiwara <tfujiwar redhat com>
Date:   Wed Feb 20 18:58:51 2019 +0900

    Always emit reset for IM preedit with mouse click
    
    Hangul inputs treat pre-edit text as output text and the pre-edit
    text won't be moved with mouse click.
    Now the reset signal is always emitted simply with mouse click and
    each IM engine could handle the signal whether the preedit is committed,
    cleared or kept.
    
    Closes #1534

 gtk/gtktext.c     | 5 +++--
 gtk/gtktextview.c | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 0d54525daa..36dedc0758 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2518,8 +2518,9 @@ gtk_text_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
          gtk_widget_get_modifier_mask (widget,
                                        GDK_MODIFIER_INTENT_EXTEND_SELECTION));
 
-      if (extend_selection)
-        gtk_text_reset_im_context (self);
+      /* Always emit reset when preedit is shown */
+      priv->need_im_reset = TRUE;
+      gtk_text_reset_im_context (self);
 
       switch (n_press)
         {
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 083d181e02..8e50f05aaa 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5103,7 +5103,11 @@ gtk_text_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
                    gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
 
   if (n_press == 1)
-    gtk_text_view_reset_im_context (text_view);
+    {
+      /* Always emit reset when preedit is shown */
+      priv->need_im_reset = TRUE;
+      gtk_text_view_reset_im_context (text_view);
+    }
 
   if (n_press == 1 &&
       gdk_event_triggers_context_menu (event))


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