diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2017-01-05 05:41:16 +0900 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-01-31 08:14:52 +0100 |
commit | e229d1efd7323504f90127bbf52e63f4773dc382 (patch) | |
tree | 8179ed24ff38696a91d4c60ee220438bd0168d56 /ui/gtk.c | |
parent | a54f0d2ba3094ca43e85a465c7c4ae58c589efc4 (diff) |
ui/gtk: Fix mouse wheel on 3.4.0 or later
On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of
GDK_SCROLL_UP/DOWN.
This fixes it by converting any smooth scroll to up/down.
(I.e. without smooth support)
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r-- | ui/gtk.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1031,6 +1031,19 @@ static gboolean gd_scroll_event(GtkWidget *widget, GdkEventScroll *scroll, btn = INPUT_BUTTON_WHEEL_UP; } else if (scroll->direction == GDK_SCROLL_DOWN) { btn = INPUT_BUTTON_WHEEL_DOWN; +#if GTK_CHECK_VERSION(3, 4, 0) + } else if (scroll->direction == GDK_SCROLL_SMOOTH) { + gdouble delta_x, delta_y; + if (!gdk_event_get_scroll_deltas((GdkEvent *)scroll, + &delta_x, &delta_y)) { + return TRUE; + } + if (delta_y > 0) { + btn = INPUT_BUTTON_WHEEL_DOWN; + } else { + btn = INPUT_BUTTON_WHEEL_UP; + } +#endif } else { return TRUE; } |