summaryrefslogtreecommitdiff
path: root/gtk/gtkmenu.c
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2016-05-03 16:44:14 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2016-05-10 15:58:02 +0200
commitc134d52dd789d2f8b43e15e51fa72d9586a151ec (patch)
treea591d950f257b9f5ee7fbc4042dcdea234a0306f /gtk/gtkmenu.c
parente405c27eee99f9dbfd5ebf83c93dacee18e568d5 (diff)
downloadgtk+-c134d52dd789d2f8b43e15e51fa72d9586a151ec.tar.gz
gtkmenu: ignore emulated scroll events
On X11, we get both smooth and emulated scroll events, whereas other backends such as wayland will give smooth events only with touchpad scrolling. Discard emulated scroll events so that we get consistent behaviours between backends. Allow for both horizontal and vertical smooth events for scrolling so that horizontal scrolling still works without emulated scroll events as well, again for consistency between gdk backends. https://bugzilla.gnome.org/show_bug.cgi?id=765939
Diffstat (limited to 'gtk/gtkmenu.c')
-rw-r--r--gtk/gtkmenu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index c4c84313cc..ee24b724cc 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -105,6 +105,8 @@
#include <gobject/gvaluecollector.h>
+#include <gdk/gdkprivate.h> /* for _gdk_event_get_pointer_emulated() */
+
#include "gtkaccellabel.h"
#include "gtkaccelmap.h"
#include "gtkadjustment.h"
@@ -3554,6 +3556,9 @@ gtk_menu_scroll (GtkWidget *widget,
{
GtkMenu *menu = GTK_MENU (widget);
+ if (_gdk_event_get_pointer_emulated ((GdkEvent *) event))
+ return FALSE;
+
switch (event->direction)
{
case GDK_SCROLL_RIGHT:
@@ -3565,7 +3570,7 @@ gtk_menu_scroll (GtkWidget *widget,
gtk_menu_scroll_by (menu, - MENU_SCROLL_STEP2);
break;
case GDK_SCROLL_SMOOTH:
- gtk_menu_scroll_by (menu, event->delta_y);
+ gtk_menu_scroll_by (menu, event->delta_y * MENU_SCROLL_STEP2);
break;
}