From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYYhB-00039Q-C0 for qemu-devel@nongnu.org; Tue, 31 Jan 2017 08:42:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYYh7-000606-P5 for qemu-devel@nongnu.org; Tue, 31 Jan 2017 08:42:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cYYh7-0005zE-Jq for qemu-devel@nongnu.org; Tue, 31 Jan 2017 08:42:01 -0500 From: Gerd Hoffmann Date: Tue, 31 Jan 2017 14:41:41 +0100 Message-Id: <1485870106-25016-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1485870106-25016-1-git-send-email-kraxel@redhat.com> References: <1485870106-25016-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 05/10] ui/gtk: Fix mouse wheel on 3.4.0 or later List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: OGAWA Hirofumi , Gerd Hoffmann From: OGAWA Hirofumi 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 Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 3f67a34..2f81863 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -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; } -- 1.8.3.1