[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY
From: |
John Arbuckle |
Subject: |
[Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY |
Date: |
Thu, 5 Jul 2018 22:53:52 -0400 |
The NSEvent class method scrollingDeltaY is available
for Mac OS 10.7 and newer. Since QEMU supports Mac OS
10.5 and up, we need to be using a method that is
available on these version of Mac OS X. The deltaY
method is a method that does the same thing as
scrollingDeltaY and is available on Mac OS 10.5 and
up. So we simply replace scrollingDeltaY with deltaY.
Signed-off-by: John Arbuckle <address@hidden>
---
v2 changes:
- Added a condition that drops scroll events that have a deltaY value of zero.
ui/cocoa.m | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 2991ed4..f371469 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -802,14 +802,15 @@ QemuCocoaView *cocoaView;
* This is in-line with standard Mac OS X UI behaviour.
*/
+ if ([event deltaY] != 0) {
/* Determine if this is a scroll up or scroll down event */
- buttons = ([event scrollingDeltaY] > 0) ?
- INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN;
- qemu_input_queue_btn(dcl->con, buttons, true);
- qemu_input_event_sync();
- qemu_input_queue_btn(dcl->con, buttons, false);
- qemu_input_event_sync();
-
+ buttons = ([event deltaY] > 0) ?
+ INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN;
+ 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
* movement code from executing.
--
2.7.2
- [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY,
John Arbuckle <=