spinbutton: Restore gtk3 focus behavior

Focus the spinbutton on button press, never focus the buttons.
This commit is contained in:
Timm Bäder 2017-01-13 15:24:44 +01:00
parent 132f2721ce
commit 3cfcbe2ccf

View File

@ -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));