[gtk/matthiasc/for-master: 15/15] text: Fix placing the cursor on click



commit 8a1a96a47efd0a168452ccfa9ff8031b9e61defd
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 12 09:16:51 2020 -0400

    text: Fix placing the cursor on click
    
    Commit c297d45b8a19d84e0 accidentally removed the
    check for the right modifier mask, causing us to
    always extend the selection.

 gtk/gtktext.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 1d56e7ea1f..a80a78b616 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2714,6 +2714,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
       gboolean have_selection;
       gboolean is_touchscreen, extend_selection;
       GdkDevice *source;
+      guint state;
 
       sel_start = priv->selection_bound;
       sel_end = priv->current_pos;
@@ -2729,7 +2730,9 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
       priv->select_words = FALSE;
       priv->select_lines = FALSE;
 
-      extend_selection = GDK_SHIFT_MASK;
+      state = gdk_event_get_modifier_state (event);
+
+      extend_selection = (state & GDK_SHIFT_MASK) != 0;
 
       /* Always emit reset when preedit is shown */
       priv->need_im_reset = TRUE;


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