Skip to content

Commit 04a1789

Browse files
z3ntuQbicz
authored andcommitted
testgui: fix deprecation warning
mac_support_cocoa.m:80:49: warning: 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations] NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask ^~~~~~~~~~~~~~ NSEventMaskAny /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:158:26: note: 'NSAnyEventMask' has been explicitly marked deprecated here static const NSEventMask NSAnyEventMask NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSEventMaskAny", 10_0, 10_12) = NSUIntegerMax; ^
1 parent a1d4982 commit 04a1789

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

testgui/mac_support_cocoa.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
#include <fx.h>
99
#import <Cocoa/Cocoa.h>
1010

11+
#ifndef MAC_OS_X_VERSION_10_12
12+
#define MAC_OS_X_VERSION_10_12 101200
13+
#endif
14+
15+
// macOS 10.12 deprecated NSAnyEventMask in favor of NSEventMaskAny
16+
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
17+
#define NSEventMaskAny NSAnyEventMask
18+
#endif
19+
1120
extern FXMainWindow *g_main_window;
1221

1322

@@ -77,7 +86,7 @@ - (void) handleQuitEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleE
7786

7887
NSAutoreleasePool *pool = [NSAutoreleasePool new];
7988
while (1) {
80-
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
89+
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
8190
untilDate:nil
8291
inMode:NSDefaultRunLoopMode
8392
dequeue:YES];

0 commit comments

Comments
 (0)