diff options
-rw-r--r-- | src/eom-thumb-nav.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/eom-thumb-nav.c b/src/eom-thumb-nav.c index 949c46a..702b4c5 100644 --- a/src/eom-thumb-nav.c +++ b/src/eom-thumb-nav.c @@ -30,6 +30,7 @@ #include <glib/gi18n.h> #include <glib-object.h> #include <gtk/gtk.h> +#include <math.h> #include <string.h> #define EOM_THUMB_NAV_GET_PRIVATE(object) \ @@ -82,6 +83,25 @@ eom_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer u case GDK_SCROLL_RIGHT: break; +#if GTK_CHECK_VERSION (3, 3, 18) + case GDK_SCROLL_SMOOTH: + { + /* Compatibility code to catch smooth events from mousewheels */ + gdouble x_delta, y_delta; + gboolean set = gdk_event_get_scroll_deltas ((GdkEvent*)event, + &x_delta, &y_delta); + + /* Propagate horizontal smooth scroll events further, + as well as non-mousewheel events. */ + if (G_UNLIKELY (!set) || x_delta != 0.0 || fabs(y_delta) != 1.0) + return FALSE; + + /* The y_delta is either +1.0 or -1.0 here */ + inc *= (gint) y_delta; + } + break; +#endif + default: g_assert_not_reached (); return FALSE; |