From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL v2 05/11] ui/gtk: Fix mouse wheel on 3.4.0 or later
Date: Tue, 31 Jan 2017 16:50:25 +0100 [thread overview]
Message-ID: <1485877831-28786-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1485877831-28786-1-git-send-email-kraxel@redhat.com>
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
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>
---
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
next prev parent reply other threads:[~2017-01-31 15:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 15:50 [Qemu-devel] [PULL v2 00/11] ui patch queue Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 01/11] qapi: add support for mice with extra/side buttons Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 02/11] ps2: " Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 03/11] ui: " Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 04/11] vnc: track LED state separately Gerd Hoffmann
2017-01-31 15:50 ` Gerd Hoffmann [this message]
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 06/11] ui: fix format specfier in vnc to avoid break in build Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 07/11] ui/gtk.c: add ctrl-alt-= support for zoom in acceleration Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 08/11] spice: wakeup QXL worker to pick up mouse changes Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 09/11] vnc: fix overflow in vnc_update_stats Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 10/11] gtk: Hardcode LC_CTYPE as C.utf-8 Gerd Hoffmann
2017-01-31 15:50 ` [Qemu-devel] [PULL v2 11/11] console: fix console resize Gerd Hoffmann
2017-01-31 16:22 ` [Qemu-devel] [PULL v2 00/11] ui patch queue Peter Maydell
2017-01-31 16:34 ` Gerd Hoffmann
2017-02-02 9:49 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485877831-28786-6-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).