qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY
@ 2018-07-06  2:53 John Arbuckle
  2018-07-06  9:11 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: John Arbuckle @ 2018-07-06  2:53 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: John Arbuckle

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 <programmingkidx@gmail.com>
---
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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY
  2018-07-06  2:53 [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY John Arbuckle
@ 2018-07-06  9:11 ` Peter Maydell
  2018-07-06 14:22   ` G 3
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2018-07-06  9:11 UTC (permalink / raw)
  To: John Arbuckle; +Cc: QEMU Developers

On 6 July 2018 at 03:53, John Arbuckle <programmingkidx@gmail.com> wrote:
> 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.

Commit message doesn't match code change.

> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
> ---
> 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) {

This could use a comment about why we need to check it.

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

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY
  2018-07-06  9:11 ` Peter Maydell
@ 2018-07-06 14:22   ` G 3
  2018-07-06 14:30     ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: G 3 @ 2018-07-06 14:22 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers


On Jul 6, 2018, at 5:11 AM, Peter Maydell wrote:

> On 6 July 2018 at 03:53, John Arbuckle <programmingkidx@gmail.com>  
> wrote:
>> 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.
>
> Commit message doesn't match code change.

Did you want me to add information on dropping events with a
deltaY value of zero?

>
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> ---
>> 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) {
>
> This could use a comment about why we need to check it.

Sounds good.

>
>>              /* 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
>
> thanks
> -- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY
  2018-07-06 14:22   ` G 3
@ 2018-07-06 14:30     ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2018-07-06 14:30 UTC (permalink / raw)
  To: G 3; +Cc: QEMU Developers

On 6 July 2018 at 15:22, G 3 <programmingkidx@gmail.com> wrote:
>
> On Jul 6, 2018, at 5:11 AM, Peter Maydell wrote:
>
>> On 6 July 2018 at 03:53, John Arbuckle <programmingkidx@gmail.com> wrote:
>>>
>>> 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.
>>
>>
>> Commit message doesn't match code change.
>
>
> Did you want me to add information on dropping events with a
> deltaY value of zero?

Yes. The code is not doing a simple replace of one method
with the other, so the commit message shouldn't say it is.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-06 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-06  2:53 [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY John Arbuckle
2018-07-06  9:11 ` Peter Maydell
2018-07-06 14:22   ` G 3
2018-07-06 14:30     ` Peter Maydell

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