Merge branch 'label-selection-fix' into 'main'

label: Tweak selection behavior

Closes #2024

See merge request GNOME/gtk!5148
This commit is contained in:
Matthias Clasen 2022-10-19 21:37:08 +00:00
commit 4bb79decf3

View File

@ -4388,7 +4388,7 @@ gtk_label_click_gesture_released (GtkGestureClick *gesture,
if (info->in_drag) if (info->in_drag)
{ {
info->in_drag = 0; info->in_drag = FALSE;
get_layout_index (self, x, y, &index); get_layout_index (self, x, y, &index);
gtk_label_select_region_index (self, index, 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); state_mask = gdk_event_get_modifier_state (event);
if ((info->selection_anchor != info->selection_end) && if ((info->selection_anchor != info->selection_end) &&
(state_mask & GDK_SHIFT_MASK)) ((state_mask & GDK_SHIFT_MASK) != 0))
{ {
if (index > min && index < max) if (index > min && index < max)
{ {
@ -4488,6 +4488,7 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
{ {
if (min < max && min <= index && index <= max) if (min < max && min <= index && index <= max)
{ {
if (!info->select_words)
info->in_drag = TRUE; info->in_drag = TRUE;
info->drag_start_x = start_x; info->drag_start_x = start_x;
info->drag_start_y = start_y; info->drag_start_y = start_y;