summaryrefslogtreecommitdiff
path: root/gtk/gtkscalebutton.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-08-25 16:54:21 +0200
committerCarlos Garnacho <carlosg@gnome.org>2017-09-19 18:39:02 +0200
commit627a73cf57ad4e1c1b6156914d6b612f4ccd1d2f (patch)
tree65ccc991fc86352fc8224fe7acb95503ebd65e3e /gtk/gtkscalebutton.c
parente41844f7515ebdaad6739d2b635ea252ec162aa7 (diff)
downloadgtk+-627a73cf57ad4e1c1b6156914d6b612f4ccd1d2f.tar.gz
scalebutton: Update to using GdkEvent API
Diffstat (limited to 'gtk/gtkscalebutton.c')
-rw-r--r--gtk/gtkscalebutton.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 5cc939a1d8..e9ef4f2a3f 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -779,31 +779,36 @@ gtk_scale_button_scroll (GtkWidget *widget,
GtkScaleButton *button;
GtkScaleButtonPrivate *priv;
GtkAdjustment *adjustment;
+ GdkScrollDirection direction;
gdouble d;
button = GTK_SCALE_BUTTON (widget);
priv = button->priv;
adjustment = priv->adjustment;
- if (event->type != GDK_SCROLL)
+ if (gdk_event_get_event_type ((GdkEvent *) event) != GDK_SCROLL ||
+ !gdk_event_get_scroll_direction ((GdkEvent *) event, &direction))
return FALSE;
d = gtk_scale_button_get_value (button);
- if (event->direction == GDK_SCROLL_UP)
+ if (direction == GDK_SCROLL_UP)
{
d += gtk_adjustment_get_step_increment (adjustment);
if (d > gtk_adjustment_get_upper (adjustment))
d = gtk_adjustment_get_upper (adjustment);
}
- else if (event->direction == GDK_SCROLL_DOWN)
+ else if (direction == GDK_SCROLL_DOWN)
{
d -= gtk_adjustment_get_step_increment (adjustment);
if (d < gtk_adjustment_get_lower (adjustment))
d = gtk_adjustment_get_lower (adjustment);
}
- else if (event->direction == GDK_SCROLL_SMOOTH)
+ else if (direction == GDK_SCROLL_SMOOTH)
{
- d -= event->delta_y * gtk_adjustment_get_step_increment (adjustment);
+ gdouble delta_y;
+
+ gdk_event_get_scroll_deltas ((GdkEvent *) event, NULL, &delta_y);
+ d -= delta_y * gtk_adjustment_get_step_increment (adjustment);
d = CLAMP (d, gtk_adjustment_get_lower (adjustment),
gtk_adjustment_get_upper (adjustment));
}