[gtk/label-selection-fix] label: Tweak selection behavior
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/label-selection-fix] label: Tweak selection behavior
- Date: Wed, 19 Oct 2022 20:23:11 +0000 (UTC)
commit 60fb93e063fbc316264722fea1342d4bf800c733
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 19 16:21:36 2022 -0400
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
gtk/gtklabel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]