diff options
author | Timm Bäder <mail@baedert.org> | 2017-01-13 15:24:44 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2017-01-16 17:22:45 +0100 |
commit | 3cfcbe2ccfee857d28a5ec02ecc5ef98686ff58b (patch) | |
tree | ac7844427f150e1334d73f9b68bc128beacc5f9f /gtk | |
parent | 132f2721ce49c2d5b8af3842655773b9c5c70039 (diff) | |
download | gtk+-3cfcbe2ccfee857d28a5ec02ecc5ef98686ff58b.tar.gz |
spinbutton: Restore gtk3 focus behavior
Focus the spinbutton on button press, never focus the buttons.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkspinbutton.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 6eb7eb1e15..4fbb655ec6 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -759,6 +759,8 @@ button_pressed_cb (GtkGestureMultiPress *gesture, GtkWidget *pressed_button = GTK_GESTURE (gesture) == priv->up_click_gesture ? priv->up_button : priv->down_button; + gtk_widget_grab_focus (GTK_WIDGET (spin_button)); + if (gtk_editable_get_editable (GTK_EDITABLE (spin_button))) { int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)); @@ -848,9 +850,9 @@ gtk_spin_button_init (GtkSpinButton *spin_button) TRUE, GTK_ALIGN_FILL); priv->down_button = gtk_button_new_from_icon_name ("list-remove-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_can_focus (priv->down_button, FALSE); gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "down"); gtk_widget_set_parent (priv->down_button, GTK_WIDGET (spin_button)); - gtk_widget_show (priv->down_button); gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget), -1, priv->down_button); priv->down_click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (priv->down_button)); @@ -861,9 +863,9 @@ gtk_spin_button_init (GtkSpinButton *spin_button) g_signal_connect (priv->down_click_gesture, "released", G_CALLBACK (button_released_cb), spin_button); priv->up_button = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_can_focus (priv->up_button, FALSE); gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up"); gtk_widget_set_parent (priv->up_button, GTK_WIDGET (spin_button)); - gtk_widget_show (priv->up_button); gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget), -1, priv->up_button); priv->up_click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (priv->up_button)); |