From: Dmitry Petrov <dpetroff@gmail.com>
To: qemu-devel@nongnu.org, dpetroff@gmail.com
Subject: [PATCH v4 2/5] ui/cocoa: pass horizontal scroll information to the device code
Date: Sat, 8 Jan 2022 16:39:44 +0100 [thread overview]
Message-ID: <20220108153947.171861-3-dpetroff@gmail.com> (raw)
In-Reply-To: <20220108153947.171861-1-dpetroff@gmail.com>
Signed-off-by: Dmitry Petrov <dpetroff@gmail.com>
---
ui/cocoa.m | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 69745c483b..ac18e14ce0 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -970,21 +970,27 @@ QemuCocoaView *cocoaView;
*/
/*
- * When deltaY is zero, it means that this scrolling event was
- * either horizontal, or so fine that it only appears in
- * scrollingDeltaY. So we drop the event.
+ * We shouldn't have got a scroll event when deltaY and delta Y
+ * are zero, hence no harm in dropping the event
*/
- if ([event deltaY] != 0) {
+ if ([event deltaY] != 0 || [event deltaX] != 0) {
/* Determine if this is a scroll up or scroll down event */
- buttons = ([event deltaY] > 0) ?
+ if ([event deltaY] != 0) {
+ buttons = ([event deltaY] > 0) ?
INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN;
+ } else if ([event deltaX] != 0) {
+ buttons = ([event deltaX] > 0) ?
+ INPUT_BUTTON_WHEEL_LEFT : INPUT_BUTTON_WHEEL_RIGHT;
+ }
+
qemu_input_queue_btn(dcl.con, buttons, true);
qemu_input_event_sync();
qemu_input_queue_btn(dcl.con, buttons, false);
qemu_input_event_sync();
}
+
/*
- * Since deltaY also reports scroll wheel events we prevent mouse
+ * Since deltaX/deltaY also report scroll wheel events we prevent mouse
* movement code from executing.
*/
mouse_event = false;
--
2.32.0
next prev parent reply other threads:[~2022-01-08 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-08 15:39 [PATCH v4 0/5] Add horizontal mouse scroll support Dmitry Petrov
2022-01-08 15:39 ` [PATCH v4 1/5] ps2: Initial horizontal " Dmitry Petrov
2022-01-08 15:39 ` Dmitry Petrov [this message]
2022-01-08 15:39 ` [PATCH v4 3/5] ui/gtk: pass horizontal scroll information to the device code Dmitry Petrov
2022-01-08 15:39 ` [PATCH v4 4/5] ui/sdl2: " Dmitry Petrov
2022-01-08 15:39 ` [PATCH v4 5/5] ui/input-legacy: pass horizontal scroll information Dmitry Petrov
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=20220108153947.171861-3-dpetroff@gmail.com \
--to=dpetroff@gmail.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.