mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
text: Respect focus-on-click property
It does make sense to have GtkText not focus on click in some cases, such as when its editable property is set to false. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
This commit is contained in:
parent
a8613377a5
commit
271d7632cb
@ -2745,6 +2745,16 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
|
|||||||
guint button;
|
guint button;
|
||||||
int tmp_pos;
|
int tmp_pos;
|
||||||
|
|
||||||
|
if (!gtk_widget_has_focus (widget))
|
||||||
|
{
|
||||||
|
if (!gtk_widget_get_focus_on_click (widget))
|
||||||
|
return;
|
||||||
|
priv->in_click = TRUE;
|
||||||
|
gtk_widget_grab_focus (widget);
|
||||||
|
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||||
|
priv->in_click = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
|
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
|
||||||
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), current);
|
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), current);
|
||||||
@ -2753,14 +2763,6 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
|
|||||||
y = widget_y;
|
y = widget_y;
|
||||||
gtk_text_reset_blink_time (self);
|
gtk_text_reset_blink_time (self);
|
||||||
|
|
||||||
if (!gtk_widget_has_focus (widget))
|
|
||||||
{
|
|
||||||
priv->in_click = TRUE;
|
|
||||||
gtk_widget_grab_focus (widget);
|
|
||||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
|
||||||
priv->in_click = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp_pos = gtk_text_find_position (self, x);
|
tmp_pos = gtk_text_find_position (self, x);
|
||||||
|
|
||||||
if (gdk_event_triggers_context_menu (event))
|
if (gdk_event_triggers_context_menu (event))
|
||||||
|
Loading…
Reference in New Issue
Block a user