diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-18 11:51:45 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-18 12:47:47 -0400 |
commit | 2e2336ffce5e0a3eae0059babfc36a9668166fe3 (patch) | |
tree | 6502771e49cf2610ba1e0765c93efcf01e42160a /gtk/gtktext.c | |
parent | 76d80ef516ed3cdcc8a8d92b2a5b599f4726e0b4 (diff) | |
download | gtk+-2e2336ffce5e0a3eae0059babfc36a9668166fe3.tar.gz |
text: Claim clicks when grabbing focus
If we don't, an ancestor (such a GtkListItemWidget)
may interpret the click as "I should grab focus!",
and still our focus away. This was causing hard-to-focus
entries in the property list in the inspector.
Diffstat (limited to 'gtk/gtktext.c')
-rw-r--r-- | gtk/gtktext.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 3dda4162cd..7e91afffab 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -2681,6 +2681,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, { priv->in_click = TRUE; gtk_widget_grab_focus (widget); + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); priv->in_click = FALSE; } @@ -2689,6 +2690,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, if (gdk_event_triggers_context_menu (event)) { gtk_text_do_popup (self, widget_x, widget_y); + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); } else if (n_press == 1 && button == GDK_BUTTON_MIDDLE && get_middle_click_paste (self)) @@ -2702,6 +2704,8 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, { gtk_widget_error_bell (widget); } + + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); } else if (button == GDK_BUTTON_PRIMARY) { @@ -2821,13 +2825,9 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, gtk_text_set_positions (self, end, start); } - gtk_text_update_handles (self); } - if (button != GDK_BUTTON_PRIMARY || n_press >= 3) - gtk_gesture_set_state (priv->drag_gesture, GTK_EVENT_SEQUENCE_CLAIMED); - if (n_press >= 3) gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture)); } |