[gnome-documents] thumb-nav: handle GDK_SCROLL_SMOOTH events
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] thumb-nav: handle GDK_SCROLL_SMOOTH events
- Date: Thu, 8 Mar 2012 21:05:23 +0000 (UTC)
commit 66cd8f34401bbd0be79029f1a5d8cceaaa6c665b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Mar 8 16:04:39 2012 -0500
thumb-nav: handle GDK_SCROLL_SMOOTH events
Emulate a scroll instead of crashing.
src/lib/gd-thumb-nav.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/lib/gd-thumb-nav.c b/src/lib/gd-thumb-nav.c
index dce5b95..afed2be 100644
--- a/src/lib/gd-thumb-nav.c
+++ b/src/lib/gd-thumb-nav.c
@@ -71,6 +71,7 @@ gd_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer us
GdThumbNav *nav = GD_THUMB_NAV (user_data);
gint inc = GD_THUMB_NAV_SCROLL_INC * 3;
gdouble upper, page_size, value;
+ gdouble delta_x, delta_y;
switch (event->direction) {
case GDK_SCROLL_UP:
@@ -82,6 +83,20 @@ gd_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer us
case GDK_SCROLL_RIGHT:
break;
+ case GDK_SCROLL_SMOOTH:
+ gdk_event_get_scroll_deltas ((const GdkEvent *) event,
+ &delta_x, &delta_y);
+
+ if (delta_x == 0) {
+ /* we only moved in the y direction, look at which direction */
+ if (delta_y < 0)
+ inc *= -1;
+ } else if (delta_x < 0) {
+ /* if we moved in the x direction too, ignore the y */
+ inc *= -1;
+ }
+
+ break;
default:
g_assert_not_reached ();
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]