qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later


From: OGAWA Hirofumi
Subject: [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later
Date: Fri, 23 Dec 2016 23:50:41 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

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 <address@hidden>
---

 ui/gtk.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff -puN ui/gtk.c~mouse-wheel-fix ui/gtk.c
--- qemu/ui/gtk.c~mouse-wheel-fix       2016-12-23 23:39:24.419659012 +0900
+++ qemu-hirofumi/ui/gtk.c      2016-12-23 23:39:37.540735673 +0900
@@ -1015,6 +1015,16 @@ static gboolean gd_scroll_event(GtkWidge
         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;
     }
_

-- 
OGAWA Hirofumi <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]