label: Tweak selection behavior
authorMatthias Clasen <mclasen@redhat.com>
Wed, 19 Oct 2022 20:21:36 +0000 (16:21 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 19 Oct 2022 20:22:55 +0000 (16:22 -0400)
Arrange for double-click-followed-by-drag to do
select by words, not select-and-dnd. This matches
the behavior in GtkTextView better and feels
intuitive.

Fixes: #2024
gtk/gtklabel.c

index eaaec51bd131894b65a15ad95a369e9bc7a674ac..5f8dd50d2d87e3155a9867c6a03cd16363a9de42 100644 (file)
@@ -4388,7 +4388,7 @@ gtk_label_click_gesture_released (GtkGestureClick *gesture,
 
   if (info->in_drag)
     {
-      info->in_drag = 0;
+      info->in_drag = FALSE;
       get_layout_index (self, x, y, &index);
       gtk_label_select_region_index (self, index, index);
     }
@@ -4457,7 +4457,7 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
   state_mask = gdk_event_get_modifier_state (event);
 
   if ((info->selection_anchor != info->selection_end) &&
-      (state_mask & GDK_SHIFT_MASK))
+      ((state_mask & GDK_SHIFT_MASK) != 0))
     {
       if (index > min && index < max)
         {
@@ -4488,7 +4488,8 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
     {
       if (min < max && min <= index && index <= max)
         {
-          info->in_drag = TRUE;
+          if (!info->select_words)
+            info->in_drag = TRUE;
           info->drag_start_x = start_x;
           info->drag_start_y = start_y;
         }