From: Matthias Clasen Date: Wed, 19 Oct 2022 20:21:36 +0000 (-0400) Subject: label: Tweak selection behavior X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~9^2~152^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=60fb93e063fbc316264722fea1342d4bf800c733;p=gtk4.git label: Tweak selection behavior 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 --- diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index eaaec51bd1..5f8dd50d2d 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -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; }