mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
Merge branch 'focus-on-click' into 'main'
Focus-on-click improvements See merge request GNOME/gtk!6336
This commit is contained in:
commit
a5fdd1228f
@ -290,6 +290,9 @@ gtk_color_button_init (GtkColorButton *button)
|
||||
|
||||
button->button = gtk_button_new ();
|
||||
g_signal_connect (button->button, "clicked", G_CALLBACK (gtk_color_button_clicked), button);
|
||||
g_object_bind_property (button, "focus-on-click",
|
||||
button->button, "focus-on-click",
|
||||
0);
|
||||
gtk_widget_set_parent (button->button, GTK_WIDGET (button));
|
||||
|
||||
button->swatch = g_object_new (GTK_TYPE_COLOR_SWATCH,
|
||||
|
@ -594,6 +594,9 @@ gtk_font_button_init (GtkFontButton *font_button)
|
||||
|
||||
font_button->button = gtk_button_new ();
|
||||
g_signal_connect (font_button->button, "clicked", G_CALLBACK (gtk_font_button_clicked), font_button);
|
||||
g_object_bind_property (font_button, "focus-on-click",
|
||||
font_button->button, "focus-on-click",
|
||||
0);
|
||||
font_button->font_label = gtk_label_new (_("Font"));
|
||||
gtk_widget_set_hexpand (font_button->font_label, TRUE);
|
||||
font_button->size_label = gtk_label_new ("14");
|
||||
|
@ -2745,6 +2745,16 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
guint button;
|
||||
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));
|
||||
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), current);
|
||||
@ -2753,14 +2763,6 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
y = widget_y;
|
||||
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);
|
||||
|
||||
if (gdk_event_triggers_context_menu (event))
|
||||
|
Loading…
Reference in New Issue
Block a user