All of lore.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later
Date: Fri, 23 Dec 2016 23:50:41 +0900	[thread overview]
Message-ID: <87bmw2vgvy.fsf@mail.parknet.co.jp> (raw)

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>
---

 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 <hirofumi@mail.parknet.co.jp>

             reply	other threads:[~2016-12-23 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23 14:50 OGAWA Hirofumi [this message]
2017-01-04  8:48 ` [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later Gerd Hoffmann
2017-01-04 20:39   ` OGAWA Hirofumi
2017-01-04 20:41     ` [Qemu-devel] [PATCH v2] " OGAWA Hirofumi
2017-01-10 11:43       ` Gerd Hoffmann

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=87bmw2vgvy.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=kraxel@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.