diff options
| author | Teddy Wing | 2021-03-07 14:48:22 +0100 |
|---|---|---|
| committer | Teddy Wing | 2021-03-07 14:48:22 +0100 |
| commit | 13297ddeb7d89356f75e0e21f123a69a3f692f3d (patch) | |
| tree | 81c13c74302d40c7e4a919da1cc6e21a88b39d05 | |
| parent | 6e0ef3885378f25f13fbc0cab8f7c5e547aa86a9 (diff) | |
| download | DDHotKey-13297ddeb7d89356f75e0e21f123a69a3f692f3d.tar.bz2 | |
Fix `-Wdeprecated-declarations` warnings for NSEvent constants
Use the new constants on Mac OS X 10.13 and higher.
Fix these deprecation warnings:
clang -x objective-c \
-fobjc-arc \
-c \
DDHotKeyAppDelegate.m
DDHotKeyAppDelegate.m:43:61: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (![c registerHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:NSControlKeyMask target:self action:@selector(hotkeyWithEvent:) object:nil]) {
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyAppDelegate.m:54:62: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (![c registerHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask) target:self action:@selector(hotkeyWithEvent:object:) object:@"hello, world!"]) {
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyAppDelegate.m:54:81: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (![c registerHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask) target:self action:@selector(hotkeyWithEvent:object:) object:@"hello, world!"]) {
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyAppDelegate.m:72:62: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (![c registerHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) task:task]) {
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyAppDelegate.m:72:81: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (![c registerHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) task:task]) {
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyAppDelegate.m:72:102: warning: 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (![c registerHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) task:task]) {
^~~~~~~~~~~~~~~~
NSEventModifierFlagCommand
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:180:35: note: 'NSCommandKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand;
^
DDHotKeyAppDelegate.m:85:58: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
[c unregisterHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:NSControlKeyMask];
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyAppDelegate.m:91:59: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
[c unregisterHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask)];
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyAppDelegate.m:91:78: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
[c unregisterHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask)];
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyAppDelegate.m:97:59: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
[c unregisterHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)];
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyAppDelegate.m:97:78: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
[c unregisterHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)];
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyAppDelegate.m:97:99: warning: 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
[c unregisterHotKeyWithKeyCode:kVK_ANSI_V modifierFlags:(NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)];
^~~~~~~~~~~~~~~~
NSEventModifierFlagCommand
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:180:35: note: 'NSCommandKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand;
^
12 warnings generated.
mv *.o
clang -x objective-c \
-fobjc-arc \
-c \
DDHotKeyCenter.m
DDHotKeyCenter.m:68:27: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((_modifierFlags & NSControlKeyMask) > 0) { [bits addObject:@"NSControlKeyMask"]; }
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyCenter.m:69:27: warning: 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((_modifierFlags & NSCommandKeyMask) > 0) { [bits addObject:@"NSCommandKeyMask"]; }
^~~~~~~~~~~~~~~~
NSEventModifierFlagCommand
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:180:35: note: 'NSCommandKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand;
^
DDHotKeyCenter.m:70:27: warning: 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((_modifierFlags & NSShiftKeyMask) > 0) { [bits addObject:@"NSShiftKeyMask"]; }
^~~~~~~~~~~~~~
NSEventModifierFlagShift
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:177:35: note: 'NSShiftKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagShift", macos(10.0,10.12)) = NSEventModifierFlagShift;
^
DDHotKeyCenter.m:71:27: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((_modifierFlags & NSAlternateKeyMask) > 0) { [bits addObject:@"NSAlternateKeyMask"]; }
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyCenter.m:188:85: warning: expression which evaluates to zero treated as a null pointer constant of type 'DDHotKey *' [-Wnon-literal-null-conversion]
if ([self hasRegisteredHotKeyWithKeyCode:keyCode modifierFlags:flags]) { return NO; }
^~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/objc.h:90:13: note: expanded from macro 'NO'
#define NO __objc_no
^~~~~~~~~
DDHotKeyCenter.m:200:85: warning: expression which evaluates to zero treated as a null pointer constant of type 'DDHotKey *' [-Wnon-literal-null-conversion]
if ([self hasRegisteredHotKeyWithKeyCode:keyCode modifierFlags:flags]) { return NO; }
^~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/objc.h:90:13: note: expanded from macro 'NO'
#define NO __objc_no
^~~~~~~~~
DDHotKeyCenter.m:269:55: warning: 'NSKeyUp' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
NSEvent *keyEvent = [NSEvent keyEventWithType:NSKeyUp
^~~~~~~
NSEventTypeKeyUp
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:74:26: note: 'NSKeyUp' has been explicitly marked deprecated here
static const NSEventType NSKeyUp API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeKeyUp", macos(10.0,10.12)) = NSEventTypeKeyUp;
^
7 warnings generated.
mv *.o
clang -x objective-c \
-fobjc-arc \
-c \
DDHotKeyTextField.m
DDHotKeyTextField.m:85:34: warning: 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
BOOL hasModifier = (flags & (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask | NSFunctionKeyMask)) > 0;
^~~~~~~~~~~~~~~~
NSEventModifierFlagCommand
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:180:35: note: 'NSCommandKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand;
^
DDHotKeyTextField.m:85:53: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
BOOL hasModifier = (flags & (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask | NSFunctionKeyMask)) > 0;
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyTextField.m:85:74: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
BOOL hasModifier = (flags & (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask | NSFunctionKeyMask)) > 0;
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyTextField.m:85:93: warning: 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
BOOL hasModifier = (flags & (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask | NSFunctionKeyMask)) > 0;
^~~~~~~~~~~~~~
NSEventModifierFlagShift
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:177:35: note: 'NSShiftKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagShift", macos(10.0,10.12)) = NSEventModifierFlagShift;
^
DDHotKeyTextField.m:85:110: warning: 'NSFunctionKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
BOOL hasModifier = (flags & (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask | NSFunctionKeyMask)) > 0;
^~~~~~~~~~~~~~~~~
NSEventModifierFlagFunction
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:183:35: note: 'NSFunctionKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSFunctionKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagFunction", macos(10.0,10.12)) = NSEventModifierFlagFunction;
^
DDHotKeyTextField.m:87:23: warning: 'NSKeyDown' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (event.type == NSKeyDown) {
^~~~~~~~~
NSEventTypeKeyDown
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:73:26: note: 'NSKeyDown' has been explicitly marked deprecated here
static const NSEventType NSKeyDown API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeKeyDown", macos(10.0,10.12)) = NSEventTypeKeyDown;
^
DDHotKeyTextField.m:105:24: warning: 'NSKeyDown' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((event.type == NSKeyDown || (event.type == NSFlagsChanged && _hasSeenKeyDown == NO)) && hasModifier) {
^~~~~~~~~
NSEventTypeKeyDown
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:73:26: note: 'NSKeyDown' has been explicitly marked deprecated here
static const NSEventType NSKeyDown API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeKeyDown", macos(10.0,10.12)) = NSEventTypeKeyDown;
^
DDHotKeyTextField.m:105:52: warning: 'NSFlagsChanged' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((event.type == NSKeyDown || (event.type == NSFlagsChanged && _hasSeenKeyDown == NO)) && hasModifier) {
^~~~~~~~~~~~~~
NSEventTypeFlagsChanged
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:75:26: note: 'NSFlagsChanged' has been explicitly marked deprecated here
static const NSEventType NSFlagsChanged API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeFlagsChanged", macos(10.0,10.12)) = NSEventTypeFlagsChanged;
^
DDHotKeyTextField.m:117:73: warning: 'NSKeyDownMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
_globalMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:(NSKeyDownMask | NSFlagsChangedMask) handler:^NSEvent*(NSEvent *event){
^~~~~~~~~~~~~
NSEventMaskKeyDown
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:143:26: note: 'NSKeyDownMask' has been explicitly marked deprecated here
static const NSEventMask NSKeyDownMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskKeyDown", macos(10.0,10.12)) = NSEventMaskKeyDown;
^
DDHotKeyTextField.m:117:89: warning: 'NSFlagsChangedMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
_globalMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:(NSKeyDownMask | NSFlagsChangedMask) handler:^NSEvent*(NSEvent *event){
^~~~~~~~~~~~~~~~~~
NSEventMaskFlagsChanged
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:145:26: note: 'NSFlagsChangedMask' has been explicitly marked deprecated here
static const NSEventMask NSFlagsChangedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskFlagsChanged", macos(10.0,10.12)) = NSEventMaskFlagsChanged;
^
10 warnings generated.
mv *.o
clang -x objective-c \
-fobjc-arc \
-c \
DDHotKeyUtilities.m
DDHotKeyUtilities.m:76:21: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (modifiers & NSControlKeyMask) {
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyUtilities.m:79:21: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (modifiers & NSAlternateKeyMask) {
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyUtilities.m:82:21: warning: 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (modifiers & NSShiftKeyMask) {
^~~~~~~~~~~~~~
NSEventModifierFlagShift
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:177:35: note: 'NSShiftKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagShift", macos(10.0,10.12)) = NSEventModifierFlagShift;
^
DDHotKeyUtilities.m:85:21: warning: 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if (modifiers & NSCommandKeyMask) {
^~~~~~~~~~~~~~~~
NSEventModifierFlagCommand
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:180:35: note: 'NSCommandKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand;
^
DDHotKeyUtilities.m:138:18: warning: 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((flags & NSControlKeyMask) > 0) { newFlags |= controlKey; }
^~~~~~~~~~~~~~~~
NSEventModifierFlagControl
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:178:35: note: 'NSControlKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl;
^
DDHotKeyUtilities.m:139:18: warning: 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((flags & NSCommandKeyMask) > 0) { newFlags |= cmdKey; }
^~~~~~~~~~~~~~~~
NSEventModifierFlagCommand
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:180:35: note: 'NSCommandKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand;
^
DDHotKeyUtilities.m:140:18: warning: 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((flags & NSShiftKeyMask) > 0) { newFlags |= shiftKey; }
^~~~~~~~~~~~~~
NSEventModifierFlagShift
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:177:35: note: 'NSShiftKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagShift", macos(10.0,10.12)) = NSEventModifierFlagShift;
^
DDHotKeyUtilities.m:141:18: warning: 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((flags & NSAlternateKeyMask) > 0) { newFlags |= optionKey; }
^~~~~~~~~~~~~~~~~~
NSEventModifierFlagOption
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:179:35: note: 'NSAlternateKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption;
^
DDHotKeyUtilities.m:142:18: warning: 'NSAlphaShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
if ((flags & NSAlphaShiftKeyMask) > 0) { newFlags |= alphaLock; }
^~~~~~~~~~~~~~~~~~~
NSEventModifierFlagCapsLock
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:176:35: note: 'NSAlphaShiftKeyMask' has been explicitly marked deprecated here
static const NSEventModifierFlags NSAlphaShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCapsLock", macos(10.0,10.12)) = NSEventModifierFlagCapsLock;
^
9 warnings generated.
| -rw-r--r-- | Compatibility.h | 22 | ||||
| -rw-r--r-- | DDHotKeyAppDelegate.h | 2 | ||||
| -rw-r--r-- | DDHotKeyCenter.h | 2 | ||||
| -rw-r--r-- | DDHotKeyTextField.h | 2 | ||||
| -rw-r--r-- | DDHotKeyUtilities.h | 2 |
5 files changed, 30 insertions, 0 deletions
diff --git a/Compatibility.h b/Compatibility.h new file mode 100644 index 0000000..893e65d --- /dev/null +++ b/Compatibility.h @@ -0,0 +1,22 @@ +#import <AppKit/AppKit.h> + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 + +#define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock +#define NSShiftKeyMask NSEventModifierFlagShift +#define NSControlKeyMask NSEventModifierFlagControl +#define NSAlternateKeyMask NSEventModifierFlagOption +#define NSCommandKeyMask NSEventModifierFlagCommand +#define NSNumericPadKeyMask NSEventModifierFlagNumericPad +#define NSHelpKeyMask NSEventModifierFlagHelp +#define NSFunctionKeyMask NSEventModifierFlagFunction +#define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask + +#define NSFlagsChanged NSEventTypeFlagsChanged +#define NSFlagsChangedMask NSEventMaskFlagsChanged + +#define NSKeyUp NSEventTypeKeyUp +#define NSKeyDown NSEventTypeKeyDown +#define NSKeyDownMask NSEventMaskKeyDown + +#endif diff --git a/DDHotKeyAppDelegate.h b/DDHotKeyAppDelegate.h index e6959d8..c4a139e 100644 --- a/DDHotKeyAppDelegate.h +++ b/DDHotKeyAppDelegate.h @@ -10,6 +10,8 @@ #import <Cocoa/Cocoa.h> +#import "Compatibility.h" + @interface DDHotKeyAppDelegate : NSObject /*<NSApplicationDelegate>*/ @property (assign) IBOutlet NSWindow *window; diff --git a/DDHotKeyCenter.h b/DDHotKeyCenter.h index 6f79bbb..7488b4b 100644 --- a/DDHotKeyCenter.h +++ b/DDHotKeyCenter.h @@ -10,6 +10,8 @@ #import <Cocoa/Cocoa.h> +#import "Compatibility.h" + //a convenient typedef for the required signature of a hotkey block callback typedef void (^DDHotKeyTask)(NSEvent*); diff --git a/DDHotKeyTextField.h b/DDHotKeyTextField.h index c399d62..4898c08 100644 --- a/DDHotKeyTextField.h +++ b/DDHotKeyTextField.h @@ -11,6 +11,8 @@ #import <Foundation/Foundation.h> #import "DDHotKeyCenter.h" +#import "Compatibility.h" + @interface DDHotKeyTextField : NSTextField @property (nonatomic, strong) DDHotKey *hotKey; diff --git a/DDHotKeyUtilities.h b/DDHotKeyUtilities.h index a42e772..a8429c6 100644 --- a/DDHotKeyUtilities.h +++ b/DDHotKeyUtilities.h @@ -10,5 +10,7 @@ #import <Cocoa/Cocoa.h> +#import "Compatibility.h" + extern NSString *DDStringFromKeyCode(unsigned short keyCode, NSUInteger modifiers); extern UInt32 DDCarbonModifierFlagsFromCocoaModifiers(NSUInteger flags); |
