[gtk+/wip/carlosg/private-event-structs: 16/41] fontchooser: Update to using GdkEvent API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/private-event-structs: 16/41] fontchooser: Update to using GdkEvent API
- Date: Fri, 25 Aug 2017 15:06:35 +0000 (UTC)
commit c64f15d16942ccc13864f25c8db8dcf47ecf2746
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 25 16:46:28 2017 +0200
fontchooser: Update to using GdkEvent API
gtk/gtkfontchooserwidget.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index d8a8f3a..72deac5 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -500,23 +500,30 @@ resize_by_scroll_cb (GtkWidget *scrolled_window,
GtkFontChooserWidget *fc = user_data;
GtkFontChooserWidgetPrivate *priv = fc->priv;
GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->size_spin));
+ GdkScrollDirection direction;
+ gdouble delta_x, delta_y;
- if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_RIGHT)
+ if (!gdk_event_get_scroll_direction ((GdkEvent *) event, &direction))
+ return GDK_EVENT_PROPAGATE;
+
+ gdk_event_get_scroll_deltas ((GdkEvent *) event, &delta_x, &delta_y);
+
+ if (direction == GDK_SCROLL_UP || direction == GDK_SCROLL_RIGHT)
gtk_adjustment_set_value (adj,
gtk_adjustment_get_value (adj) +
gtk_adjustment_get_step_increment (adj));
- else if (event->direction == GDK_SCROLL_DOWN || event->direction == GDK_SCROLL_LEFT)
+ else if (direction == GDK_SCROLL_DOWN || direction == GDK_SCROLL_LEFT)
gtk_adjustment_set_value (adj,
gtk_adjustment_get_value (adj) -
gtk_adjustment_get_step_increment (adj));
- else if (event->direction == GDK_SCROLL_SMOOTH && event->delta_x != 0.0)
+ else if (direction == GDK_SCROLL_SMOOTH && delta_x != 0.0)
gtk_adjustment_set_value (adj,
gtk_adjustment_get_value (adj) +
- gtk_adjustment_get_step_increment (adj) * event->delta_x);
- else if (event->direction == GDK_SCROLL_SMOOTH && event->delta_y != 0.0)
+ gtk_adjustment_get_step_increment (adj) * delta_x);
+ else if (direction == GDK_SCROLL_SMOOTH && delta_y != 0.0)
gtk_adjustment_set_value (adj,
gtk_adjustment_get_value (adj) -
- gtk_adjustment_get_step_increment (adj) * event->delta_y);
+ gtk_adjustment_get_step_increment (adj) * delta_y);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]