[gtk+/wip/baedert/visible-widgets: 11/11] spinbutton: Restore gtk3 focus behavior
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/visible-widgets: 11/11] spinbutton: Restore gtk3 focus behavior
- Date: Fri, 13 Jan 2017 16:12:32 +0000 (UTC)
commit 43cda3fd4d4122675cbbe64cfbaad046f35e7f0a
Author: Timm Bäder <mail baedert org>
Date: Fri Jan 13 15:24:44 2017 +0100
spinbutton: Restore gtk3 focus behavior
Focus the spinbutton on button press, never focus the buttons.
gtk/gtkspinbutton.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 6eb7eb1..4fbb655 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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]