[gtk+/wip/baedert/children: 3/3] spinbutton: Use widgets for up/down buttons
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children: 3/3] spinbutton: Use widgets for up/down buttons
- Date: Tue, 22 Nov 2016 21:13:56 +0000 (UTC)
commit 68de4f2c5bf991c34f101ae9abe61e50d7080ef4
Author: Timm Bäder <mail baedert org>
Date: Tue Nov 22 22:14:45 2016 +0100
spinbutton: Use widgets for up/down buttons
WIP
gtk/gtkspinbutton.c | 385 ++++++++-------------------------------------------
1 files changed, 60 insertions(+), 325 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 954e1de..82f19ba 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -175,24 +175,16 @@
* ]|
*/
-enum {
- UP_PANEL,
- DOWN_PANEL
-};
-
struct _GtkSpinButtonPrivate
{
GtkAdjustment *adjustment;
- GdkWindow *down_panel;
- GdkWindow *up_panel;
-
GtkCssGadget *gadget;
- GtkCssGadget *down_button;
- GtkCssGadget *up_button;
- GdkWindow *click_child;
- GdkWindow *in_child;
+ GtkWidget *up_button;
+ GtkWidget *down_button;
+
+ GtkWidget *click_child;
guint32 timer;
@@ -249,10 +241,7 @@ static void gtk_spin_button_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gtk_spin_button_destroy (GtkWidget *widget);
-static void gtk_spin_button_map (GtkWidget *widget);
-static void gtk_spin_button_unmap (GtkWidget *widget);
static void gtk_spin_button_realize (GtkWidget *widget);
-static void gtk_spin_button_unrealize (GtkWidget *widget);
static void gtk_spin_button_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
@@ -264,16 +253,10 @@ static void gtk_spin_button_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_spin_button_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static gint gtk_spin_button_button_press (GtkWidget *widget,
- GdkEventButton *event);
static gint gtk_spin_button_button_release (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_spin_button_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
-static gint gtk_spin_button_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_spin_button_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
static gint gtk_spin_button_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static void gtk_spin_button_grab_notify (GtkWidget *widget,
@@ -308,7 +291,8 @@ static void gtk_spin_button_real_change_value (GtkSpinButton *spin,
static gint gtk_spin_button_default_input (GtkSpinButton *spin_button,
gdouble *new_val);
static void gtk_spin_button_default_output (GtkSpinButton *spin_button);
-static void update_node_state (GtkSpinButton *spin_button);
+static void gtk_spin_button_clicked_cb (GtkButton *button, gpointer user_data);
+
static guint spinbutton_signals[LAST_SIGNAL] = {0};
@@ -336,20 +320,14 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
gobject_class->get_property = gtk_spin_button_get_property;
widget_class->destroy = gtk_spin_button_destroy;
- widget_class->map = gtk_spin_button_map;
- widget_class->unmap = gtk_spin_button_unmap;
widget_class->realize = gtk_spin_button_realize;
- widget_class->unrealize = gtk_spin_button_unrealize;
widget_class->measure = gtk_spin_button_measure;
widget_class->size_allocate = gtk_spin_button_size_allocate;
widget_class->snapshot = gtk_spin_button_snapshot;
widget_class->scroll_event = gtk_spin_button_scroll;
- widget_class->button_press_event = gtk_spin_button_button_press;
widget_class->button_release_event = gtk_spin_button_button_release;
widget_class->motion_notify_event = gtk_spin_button_motion_notify;
widget_class->key_release_event = gtk_spin_button_key_release;
- widget_class->enter_notify_event = gtk_spin_button_enter_notify;
- widget_class->leave_notify_event = gtk_spin_button_leave_notify;
widget_class->focus_out_event = gtk_spin_button_focus_out;
widget_class->grab_notify = gtk_spin_button_grab_notify;
widget_class->state_flags_changed = gtk_spin_button_state_flags_changed;
@@ -682,10 +660,6 @@ swipe_gesture_begin (GtkGesture *gesture,
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (gesture, current);
- if (event->any.window == spin_button->priv->up_panel ||
- event->any.window == spin_button->priv->down_panel)
- gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_DENIED);
-
gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_grab_focus (GTK_WIDGET (spin_button));
}
@@ -727,14 +701,12 @@ update_node_ordering (GtkSpinButton *spin_button)
}
gtk_box_gadget_set_orientation (GTK_BOX_GADGET (priv->gadget), priv->orientation);
- gtk_box_gadget_remove_gadget (GTK_BOX_GADGET (priv->gadget), priv->up_button);
- gtk_box_gadget_remove_gadget (GTK_BOX_GADGET (priv->gadget), priv->down_button);
- gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget),
- up_button_pos, priv->up_button,
- FALSE, GTK_ALIGN_FILL);
- gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget),
- down_button_pos, priv->down_button,
- FALSE, GTK_ALIGN_FILL);
+ gtk_box_gadget_remove_widget (GTK_BOX_GADGET (priv->gadget), priv->up_button);
+ gtk_box_gadget_remove_widget (GTK_BOX_GADGET (priv->gadget), priv->down_button);
+ gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget),
+ up_button_pos, priv->up_button);
+ gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget),
+ down_button_pos, priv->down_button);
}
static void
@@ -747,13 +719,10 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
priv = spin_button->priv;
priv->adjustment = NULL;
- priv->down_panel = NULL;
- priv->up_panel = NULL;
priv->timer = 0;
priv->climb_rate = 0.0;
priv->timer_step = 0.0;
priv->update_policy = GTK_UPDATE_ALWAYS;
- priv->in_child = NULL;
priv->click_child = NULL;
priv->button = 0;
priv->need_timer = FALSE;
@@ -766,6 +735,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (spin_button));
+ gtk_widget_set_focus_on_click (GTK_WIDGET (spin_button), TRUE);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (spin_button));
@@ -781,32 +751,23 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
-1, gtk_entry_get_gadget (GTK_ENTRY (spin_button)),
TRUE, GTK_ALIGN_FILL);
- priv->down_button = gtk_icon_helper_new_named ("button",
- GTK_WIDGET (spin_button));
- _gtk_icon_helper_set_use_fallback (GTK_ICON_HELPER (priv->down_button), TRUE);
- _gtk_icon_helper_set_icon_name (GTK_ICON_HELPER (priv->down_button), "list-remove-symbolic",
GTK_ICON_SIZE_MENU);
- gtk_css_gadget_add_class (priv->down_button, "down");
- gtk_css_node_set_parent (gtk_css_gadget_get_node (priv->down_button), widget_node);
- gtk_css_node_set_state (gtk_css_gadget_get_node (priv->down_button), gtk_css_node_get_state (widget_node));
- gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget),
- -1, priv->down_button,
- FALSE, GTK_ALIGN_FILL);
-
- priv->up_button = gtk_icon_helper_new_named ("button",
- GTK_WIDGET (spin_button));
- _gtk_icon_helper_set_use_fallback (GTK_ICON_HELPER (priv->up_button), TRUE);
- _gtk_icon_helper_set_icon_name (GTK_ICON_HELPER (priv->up_button), "list-add-symbolic",
GTK_ICON_SIZE_MENU);
- gtk_css_gadget_add_class (priv->up_button, "up");
- gtk_css_node_set_parent (gtk_css_gadget_get_node (priv->up_button), widget_node);
- gtk_css_node_set_state (gtk_css_gadget_get_node (priv->up_button), gtk_css_node_get_state (widget_node));
- gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget),
- -1, priv->up_button,
- FALSE, GTK_ALIGN_FILL);
+ priv->down_button = gtk_button_new_from_icon_name ("list-remove-symbolic", GTK_ICON_SIZE_BUTTON);
+ gtk_widget_set_parent (priv->down_button, GTK_WIDGET (spin_button));
+ g_signal_connect (priv->down_button, "clicked", G_CALLBACK (gtk_spin_button_clicked_cb), spin_button);
+ gtk_widget_show (priv->down_button);
+ gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget),
+ -1, priv->down_button);
+
+ priv->up_button = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON);
+ gtk_widget_set_parent (priv->up_button, GTK_WIDGET (spin_button));
+ g_signal_connect (priv->up_button, "clicked", G_CALLBACK (gtk_spin_button_clicked_cb), spin_button);
+ gtk_widget_show (priv->up_button);
+ gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget),
+ -1, priv->up_button);
gtk_spin_button_set_adjustment (spin_button, NULL);
update_node_ordering (spin_button);
- update_node_state (spin_button);
gtk_widget_add_events (GTK_WIDGET (spin_button), GDK_SCROLL_MASK);
@@ -828,8 +789,6 @@ gtk_spin_button_finalize (GObject *object)
gtk_spin_button_unset_adjustment (spin_button);
g_clear_object (&priv->gadget);
- g_clear_object (&priv->down_button);
- g_clear_object (&priv->up_button);
g_object_unref (priv->swipe_gesture);
@@ -845,134 +804,15 @@ gtk_spin_button_destroy (GtkWidget *widget)
}
static void
-gtk_spin_button_map (GtkWidget *widget)
-{
- GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin_button->priv;
-
- if (gtk_widget_get_realized (widget) && !gtk_widget_get_mapped (widget))
- {
- GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->map (widget);
- gdk_window_show (priv->down_panel);
- gdk_window_show (priv->up_panel);
- }
-}
-
-static void
-gtk_spin_button_unmap (GtkWidget *widget)
-{
- GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin_button->priv;
-
- if (gtk_widget_get_mapped (widget))
- {
- gtk_spin_button_stop_spinning (GTK_SPIN_BUTTON (widget));
-
- gdk_window_hide (priv->down_panel);
- gdk_window_hide (priv->up_panel);
- GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->unmap (widget);
- }
-}
-
-static gboolean
-gtk_spin_button_panel_at_limit (GtkSpinButton *spin_button,
- gint panel)
-{
- GtkSpinButtonPrivate *priv = spin_button->priv;
-
- if (priv->wrap)
- return FALSE;
-
- if (panel == UP_PANEL &&
- (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value (priv->adjustment) <= EPSILON))
- return TRUE;
-
- if (panel == DOWN_PANEL &&
- (gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) <= EPSILON))
- return TRUE;
-
- return FALSE;
-}
-
-static GtkStateFlags
-gtk_spin_button_panel_get_state (GtkSpinButton *spin_button,
- gint panel)
-{
- GtkStateFlags state;
- GtkSpinButtonPrivate *priv = spin_button->priv;
-
- state = gtk_widget_get_state_flags (GTK_WIDGET (spin_button));
-
- state &= ~(GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_DROP_ACTIVE);
-
- if ((state & GTK_STATE_FLAG_INSENSITIVE) ||
- gtk_spin_button_panel_at_limit (spin_button, panel) ||
- !gtk_editable_get_editable (GTK_EDITABLE (spin_button)))
- {
- state |= GTK_STATE_FLAG_INSENSITIVE;
- }
- else
- {
- GdkWindow *panel_win;
-
- panel_win = panel == UP_PANEL ? priv->up_panel : priv->down_panel;
-
- if (priv->click_child &&
- priv->click_child == panel_win)
- state |= GTK_STATE_FLAG_ACTIVE;
- else if (priv->in_child &&
- priv->in_child == panel_win &&
- priv->click_child == NULL)
- state |= GTK_STATE_FLAG_PRELIGHT;
- }
-
- return state;
-}
-
-static void
-update_node_state (GtkSpinButton *spin_button)
-{
- GtkSpinButtonPrivate *priv = spin_button->priv;
-
- gtk_css_gadget_set_state (priv->up_button, gtk_spin_button_panel_get_state (spin_button, UP_PANEL));
- gtk_css_gadget_set_state (priv->down_button, gtk_spin_button_panel_get_state (spin_button, DOWN_PANEL));
-}
-
-static void
gtk_spin_button_realize (GtkWidget *widget)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin_button->priv;
- GtkAllocation down_allocation, up_allocation;
gboolean return_val;
gtk_widget_set_events (widget, gtk_widget_get_events (widget) |
GDK_KEY_RELEASE_MASK);
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->realize (widget);
- gtk_css_gadget_get_border_allocation (priv->up_button, &up_allocation, NULL);
- gtk_css_gadget_get_border_allocation (priv->down_button, &down_allocation, NULL);
-
- priv->down_panel = gdk_window_new_input (gtk_widget_get_window (widget),
- gtk_widget_get_events (widget)
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_POINTER_MOTION_MASK,
- &down_allocation);
- gtk_widget_register_window (widget, priv->down_panel);
-
- priv->up_panel = gdk_window_new_input (gtk_widget_get_window (widget),
- gtk_widget_get_events (widget)
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_POINTER_MOTION_MASK,
- &up_allocation);
- gtk_widget_register_window (widget, priv->up_panel);
-
return_val = FALSE;
g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val);
@@ -986,29 +826,6 @@ gtk_spin_button_realize (GtkWidget *widget)
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
}
-static void
-gtk_spin_button_unrealize (GtkWidget *widget)
-{
- GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin->priv;
-
- GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->unrealize (widget);
-
- if (priv->down_panel)
- {
- gtk_widget_unregister_window (widget, priv->down_panel);
- gdk_window_destroy (priv->down_panel);
- priv->down_panel = NULL;
- }
-
- if (priv->up_panel)
- {
- gtk_widget_unregister_window (widget, priv->up_panel);
- gdk_window_destroy (priv->up_panel);
- priv->up_panel = NULL;
- }
-}
-
/* Callback used when the spin button's adjustment changes.
* We need to redraw the arrows when the adjustment’s range
* changes, and reevaluate our size request.
@@ -1020,7 +837,6 @@ adjustment_changed_cb (GtkAdjustment *adjustment, gpointer data)
GtkSpinButtonPrivate *priv = spin_button->priv;
priv->timer_step = gtk_adjustment_get_step_increment (priv->adjustment);
- update_node_state (spin_button);
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
}
@@ -1167,21 +983,6 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
&clip);
gtk_widget_set_clip (widget, &clip);
-
- if (gtk_widget_get_realized (widget))
- {
- GtkAllocation button_alloc;
-
- gtk_css_gadget_get_border_allocation (priv->down_button, &button_alloc, NULL);
- gdk_window_move_resize (priv->down_panel,
- button_alloc.x, button_alloc.y,
- button_alloc.width, button_alloc.height);
-
- gtk_css_gadget_get_border_allocation (priv->up_button, &button_alloc, NULL);
- gdk_window_move_resize (priv->up_panel,
- button_alloc.x, button_alloc.y,
- button_alloc.width, button_alloc.height);
- }
}
static void
@@ -1192,41 +993,6 @@ gtk_spin_button_snapshot (GtkWidget *widget,
}
static gint
-gtk_spin_button_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin->priv;
-
- if (event->window == priv->down_panel ||
- event->window == priv->up_panel)
- {
- priv->in_child = event->window;
- update_node_state (spin);
- gtk_widget_queue_draw (GTK_WIDGET (spin));
- }
-
- return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->enter_notify_event (widget, event);
-}
-
-static gint
-gtk_spin_button_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin->priv;
-
- if (priv->in_child != NULL)
- {
- priv->in_child = NULL;
- update_node_state (spin);
- gtk_widget_queue_draw (GTK_WIDGET (spin));
- }
-
- return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->leave_notify_event (widget, event);
-}
-
-static gint
gtk_spin_button_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
@@ -1262,7 +1028,6 @@ gtk_spin_button_state_flags_changed (GtkWidget *widget,
}
gtk_css_gadget_set_state (gtk_entry_get_gadget (GTK_ENTRY (widget)), gtk_widget_get_state_flags (widget));
- update_node_state (spin);
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->state_flags_changed (widget, previous_state);
}
@@ -1318,7 +1083,7 @@ gtk_spin_button_stop_spinning (GtkSpinButton *spin)
static void
start_spinning (GtkSpinButton *spin,
- GdkWindow *click_child,
+ GtkWidget *click_child,
gdouble step)
{
GtkSpinButtonPrivate *priv;
@@ -1327,6 +1092,7 @@ start_spinning (GtkSpinButton *spin,
priv->click_child = click_child;
+ g_message ("timer: %u", priv->timer);
if (!priv->timer)
{
priv->timer_step = step;
@@ -1336,47 +1102,30 @@ start_spinning (GtkSpinButton *spin,
(gpointer) spin);
g_source_set_name_by_id (priv->timer, "[gtk+] gtk_spin_button_timer");
}
- gtk_spin_button_real_spin (spin, click_child == priv->up_panel ? step : -step);
+ gtk_spin_button_real_spin (spin, click_child == priv->up_button ? step : -step);
gtk_widget_queue_draw (GTK_WIDGET (spin));
}
-static gint
-gtk_spin_button_button_press (GtkWidget *widget,
- GdkEventButton *event)
+static void
+gtk_spin_button_clicked_cb (GtkButton *button, gpointer user_data)
{
- GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = spin->priv;
+ GtkSpinButton *spin_button = user_data;
+ GtkSpinButtonPrivate *priv = spin_button->priv;
- if (!priv->button)
+ if (gtk_editable_get_editable (GTK_EDITABLE (spin_button)))
{
- if ((event->window == priv->down_panel) ||
- (event->window == priv->up_panel))
- {
- if (!gtk_widget_has_focus (widget))
- gtk_widget_grab_focus (widget);
- priv->button = event->button;
-
- if (gtk_editable_get_editable (GTK_EDITABLE (widget))) {
- gtk_spin_button_update (spin);
-
- if (event->button == GDK_BUTTON_PRIMARY)
- start_spinning (spin, event->window, gtk_adjustment_get_step_increment (priv->adjustment));
- else if (event->button == GDK_BUTTON_MIDDLE)
- start_spinning (spin, event->window, gtk_adjustment_get_page_increment (priv->adjustment));
- else
- priv->click_child = event->window;
- } else
- gtk_widget_error_bell (widget);
-
- return TRUE;
- }
- else
- {
- return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->button_press_event (widget, event);
- }
+ gtk_spin_button_update (spin_button);
+
+ /*if (event->button == GDK_BUTTON_PRIMARY)*/
+ start_spinning (spin_button, GTK_WIDGET (button), gtk_adjustment_get_step_increment
(priv->adjustment));
+ /*else if (event->button == GDK_BUTTON_MIDDLE)*/
+ /*start_spinning (spin_button, event->window, gtk_adjustment_get_page_increment
(priv->adjustment));*/
+ }
+ else
+ {
+ gtk_widget_error_bell (GTK_WIDGET (spin_button));
}
- return FALSE;
}
static gint
@@ -1388,7 +1137,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
if (event->button == priv->button)
{
- GdkWindow *click_child = priv->click_child;
+ /*GdkWindow *click_child = priv->click_child;*/
gtk_spin_button_stop_spinning (spin);
@@ -1396,23 +1145,22 @@ gtk_spin_button_button_release (GtkWidget *widget,
{
gdouble diff;
- if (event->window == priv->down_panel &&
- click_child == event->window)
- {
- diff = gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower
(priv->adjustment);
- if (diff > EPSILON)
- gtk_spin_button_real_spin (spin, -diff);
- }
- else if (event->window == priv->up_panel &&
- click_child == event->window)
- {
- diff = gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value
(priv->adjustment);
- if (diff > EPSILON)
- gtk_spin_button_real_spin (spin, diff);
- }
+ /*if (event->window == priv->down_panel &&*/
+ /*click_child == event->window)*/
+ /*{*/
+ /*diff = gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower
(priv->adjustment);*/
+ /*if (diff > EPSILON)*/
+ /*gtk_spin_button_real_spin (spin, -diff);*/
+ /*}*/
+ /*else if (event->window == priv->up_panel &&*/
+ /*click_child == event->window)*/
+ /*{*/
+ /*diff = gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value
(priv->adjustment);*/
+ /*if (diff > EPSILON)*/
+ /*gtk_spin_button_real_spin (spin, diff);*/
+ /*}*/
}
- update_node_state (spin);
gtk_widget_queue_draw (GTK_WIDGET (spin));
return TRUE;
@@ -1433,17 +1181,6 @@ gtk_spin_button_motion_notify (GtkWidget *widget,
if (priv->button)
return FALSE;
- if (event->window == priv->down_panel ||
- event->window == priv->up_panel)
- {
- gdk_event_request_motions (event);
-
- priv->in_child = event->window;
- gtk_widget_queue_draw (widget);
-
- return FALSE;
- }
-
if (gtk_gesture_is_recognized (priv->swipe_gesture))
return TRUE;
@@ -1458,7 +1195,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
if (priv->timer)
{
- if (priv->click_child == priv->up_panel)
+ if (priv->click_child == priv->up_button)
gtk_spin_button_real_spin (spin_button, priv->timer_step);
else
gtk_spin_button_real_spin (spin_button, -priv->timer_step);
@@ -1506,8 +1243,6 @@ gtk_spin_button_value_changed (GtkAdjustment *adjustment,
g_signal_emit (spin_button, spinbutton_signals[VALUE_CHANGED], 0);
- update_node_state (spin_button);
-
gtk_widget_queue_draw (GTK_WIDGET (spin_button));
g_object_notify (G_OBJECT (spin_button), "value");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]