summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-24 20:08:06 +0200
committerinfirit <[email protected]>2014-07-24 20:17:47 +0200
commit321cea66c5b65f3b4fe6cc89169a9c13b476c8d1 (patch)
treef31e477537e227e84cbd1de53dfa5416458192cd /src
parent31434612ce873fba3410bc38d9fbbb0a411b8a5e (diff)
downloadeom-321cea66c5b65f3b4fe6cc89169a9c13b476c8d1.tar.bz2
eom-321cea66c5b65f3b4fe6cc89169a9c13b476c8d1.tar.xz
EomThumbNav: Fix mousewheel scrolling with gtk-3.3.18 and xserver-1.12
Handle incoming smooth scroll events that are oviously caused by the scrollwheel just like legacy scroll events. Based on eog commit 22618a75bcf2a754f5fbe48b2d49c27b5e66ecd5 From Felix Riemann <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/eom-thumb-nav.c20
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;