[Qemu-devel] [PATCH] ui/cocoa.m: Fix compatibility issue with Mac OS 10.9 and under

Programmingkid posted 1 patch 8 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/F6C36C1A-4661-48F4-BEA6-3994889927D0@gmail.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
ui/cocoa.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] ui/cocoa.m: Fix compatibility issue with Mac OS 10.9 and under
Posted by Programmingkid 8 years, 4 months ago
The [NSEvent modifierFlags] method returns an NSEventModifierFlags type value in Mac OS 10.10. It use to be of type NSUInteger. Replacing NSEventModifierFlags with NSUInteger allows for the cooca.m file to be compiled on older versions of Mac OS. This patch was been tested on Mac OS 10.6 and Mac OS 10.12 without problem.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
 ui/cocoa.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 9e81285..93e56d0 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -571,7 +571,7 @@ QemuCocoaView *cocoaView;
                 // bitmask.
 
                 if (qemu_console_is_graphic(NULL)) {
-                    NSEventModifierFlags modifiers = [event modifierFlags];
+                    NSUInteger modifiers = [event modifierFlags];
 
                     if (!!(modifiers & NSEventModifierFlagCapsLock) != !!modifiers_state[Q_KEY_CODE_CAPS_LOCK]) {
                         [self toggleStatefulModifier:Q_KEY_CODE_CAPS_LOCK];
-- 
2.7.2



Re: [Qemu-devel] [PATCH] ui/cocoa.m: Fix compatibility issue with Mac OS 10.9 and under
Posted by Peter Maydell 8 years, 4 months ago
On 28 June 2017 at 20:37, Programmingkid <programmingkidx@gmail.com> wrote:
> The [NSEvent modifierFlags] method returns an NSEventModifierFlags type value in Mac OS 10.10. It use to be of type NSUInteger. Replacing NSEventModifierFlags with NSUInteger allows for the cooca.m file to be compiled on older versions of Mac OS. This patch was been tested on Mac OS 10.6 and Mac OS 10.12 without problem.
>
> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
> ---
>  ui/cocoa.m | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 9e81285..93e56d0 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -571,7 +571,7 @@ QemuCocoaView *cocoaView;
>                  // bitmask.
>
>                  if (qemu_console_is_graphic(NULL)) {
> -                    NSEventModifierFlags modifiers = [event modifierFlags];
> +                    NSUInteger modifiers = [event modifierFlags];
>
>                      if (!!(modifiers & NSEventModifierFlagCapsLock) != !!modifiers_state[Q_KEY_CODE_CAPS_LOCK]) {
>                          [self toggleStatefulModifier:Q_KEY_CODE_CAPS_LOCK];
> --

Applied to master, thanks.

-- PMM