Skip to contentSkip to conversation

ui/cocoa.m: Fix compatibility issue with Mac OS 10.9 and under

PATCH Applied Programmingkid 2 participants 2 messages Jun 28, 2017 – Jun 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/cocoa.m: Fix compatibility issue with Mac OS 10.9 and under

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.

---
 ui/cocoa.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/cocoa.m +1 -1
index 9e81285..93e56d0 100644
@@ -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];
Signature · 1 line
2.7.2
#1 lore raw
Quoted 12 lines · Programmingkid

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.

---
 ui/cocoa.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/cocoa.m +0 -0
index 9e81285..93e56d0 100644

ui/cocoa.m QemuCocoaView *cocoaView;

Quoted 9 lines
ui/cocoa.m +1 -2
@@ -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