Skip to content

Commit 1b30954

Browse files
committed
Replaced constants deprecated in macOS 10.12 with new NSEventModifierXxxxxx constants that require macOS 10.12 or later.
1 parent a627e14 commit 1b30954

8 files changed

+18
-18
lines changed

NSFancyPanel.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ - (BOOL) canBecomeKeyWindow
3636
- (void) sendEvent:(NSEvent *) theEvent
3737
{
3838
// Offer key-down events to the delegats
39-
if ([theEvent type] == NSKeyDown)
39+
if ([theEvent type] == NSEventTypeKeyDown)
4040
if ([[self delegate] respondsToSelector: @selector(handlesKeyDown:inWindow:)])
4141
if ([(id)[self delegate] handlesKeyDown: theEvent inWindow: self])
4242
return;
4343

4444
// Offer mouse-down events (lefty or righty) to the delegate
45-
if ( ([theEvent type] == NSLeftMouseDown) || ([theEvent type] == NSRightMouseDown) )
45+
if ( ([theEvent type] == NSEventTypeLeftMouseDown) || ([theEvent type] == NSEventTypeRightMouseDown) )
4646
if ([[self delegate] respondsToSelector: @selector(handlesMouseDown:inWindow:)])
4747
if ([(id)[self delegate] handlesMouseDown: theEvent inWindow: self])
4848
return;

SSButton.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ - (BOOL)performKeyEquivalent:(NSEvent *)event {
147147
if ([self keyEquivalentWithOrWithoutAltKey]) {
148148
tweakedEvent = [NSEvent keyEventWithType:[event type]
149149
location:[event locationInWindow]
150-
modifierFlags:[event modifierFlags] & ~NSAlternateKeyMask
150+
modifierFlags:[event modifierFlags] & ~NSEventModifierFlagOption
151151
timestamp:[event timestamp]
152152
windowNumber:[event windowNumber]
153153
context:[event context]

SSYAlert.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ - (NSInteger)checkboxState {
231231
// broken in a programmatically-created window.
232232
/* - (void)sendEvent:(NSEvent *)event {
233233
int tab = 0 ;
234-
if ([event type] == NSKeyDown) {
234+
if ([event type] == NSEventTypeKeyDown) {
235235
unichar character = [[event characters] characterAtIndex:0] ;
236236
if (character == 9) {
237237
tab = 1 ;

SSYDragTableView.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ - (NSDragOperation) draggingSession:(NSDraggingSession *)session
2525
- (void)keyDown:(NSEvent*)event {
2626
NSString *s = [event charactersIgnoringModifiers] ;
2727
NSUInteger modifierFlags = [event modifierFlags] ;
28-
BOOL cmdKeyDown = ((modifierFlags & NSCommandKeyMask) != 0) ;
28+
BOOL cmdKeyDown = ((modifierFlags & NSEventModifierFlagCommand) != 0) ;
2929
unichar keyChar = 0 ;
3030
BOOL didHandle = NO ;
3131
if ([s length] == 1) {
@@ -115,4 +115,4 @@ - (void)viewDidMoveToWindow {
115115
}
116116
*/
117117

118-
@end
118+
@end

SSYHintArrow.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,13 @@ + (void)remove {
336336
+ (void)removeIfEvent:(NSEvent*)event {
337337
NSEventType eventType = [event type] ;
338338
if (
339-
(eventType == NSLeftMouseDown)
339+
(eventType == NSEventTypeLeftMouseDown)
340340
||
341-
(eventType == NSRightMouseDown)
341+
(eventType == NSEventTypeRightMouseDown)
342342
||
343343
(eventType == NSOtherMouseDown)
344344
||
345-
(eventType == NSKeyDown)
345+
(eventType == NSEventTypeKeyDown)
346346
) {
347347
[static_helpArrow endWithNote:nil] ;
348348
}

SSYShortcutActuator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ extern NSString* const SSYShortcutActuatorDidChangeShortcutsNotification ;
9090
@param keyCode The key code for the new handler, or -1
9191
to remove the handler
9292
@param modifierFlags The Cocoa modifier keys for the new handler, for
93-
example NSShiftKeyMask+NSCommandKeyMask+NSAlternateKeyMask+NSControlKeyMask
93+
example NSEventModifierFlagShift+NSEventModifierFlagCommand+NSEventModifierFlagOption+NSEventModifierFlagControl
9494
@param selectorName The name of the selector of the message which
9595
will be sent to [NSApp delegate], if it responds, when the user
9696
presses the shortcut. This selector's signature must take 0 parameters.

SSYShortcutActuator.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ + (NSString*)stringForKeyCode:(NSInteger)keyCode {
171171

172172
+ (NSString*)descriptionOfModifiers:(NSUInteger)modifiers {
173173
NSMutableString* string = [[NSMutableString alloc] init] ;
174-
if (modifiers & NSCommandKeyMask) [string appendString:@"cmnd+"] ;
175-
if (modifiers & NSAlternateKeyMask) [string appendString:@"optn+"] ;
176-
if (modifiers & NSControlKeyMask) [string appendString:@"ctrl+"] ;
177-
if (modifiers & NSShiftKeyMask) [string appendString:@"shft+"] ;
174+
if (modifiers & NSEventModifierFlagCommand) [string appendString:@"cmnd+"] ;
175+
if (modifiers & NSEventModifierFlagOption) [string appendString:@"optn+"] ;
176+
if (modifiers & NSEventModifierFlagControl) [string appendString:@"ctrl+"] ;
177+
if (modifiers & NSEventModifierFlagShift) [string appendString:@"shft+"] ;
178178
if (modifiers & NSFunctionKeyMask) [string appendString:@"func+"] ;
179179

180180
NSString* answer = [NSString stringWithString:string] ;
@@ -335,9 +335,9 @@ - (BOOL)isValidInfo:(NSDictionary*)info {
335335
// keys: command, control, option. An argument could be made that
336336
// the option key by itself is not good enough, but we led that
337337
// one slide.
338-
if (!(modifiers & NSCommandKeyMask)) {
339-
if (!(modifiers & NSControlKeyMask)) {
340-
if (!(modifiers & NSAlternateKeyMask)) {
338+
if (!(modifiers & NSEventModifierFlagCommand)) {
339+
if (!(modifiers & NSEventModifierFlagControl)) {
340+
if (!(modifiers & NSEventModifierFlagOption)) {
341341
return NO ;
342342
}
343343
}

SSYStarRatingView.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ -(void)mouseDown:(NSEvent *)theEvent {
244244
if( ![self editable] )
245245
return;
246246

247-
if ([theEvent type] == NSLeftMouseDown) {
247+
if ([theEvent type] == NSEventTypeLeftMouseDown) {
248248

249249
NSPoint pointInView = [self convertPoint:[theEvent locationInWindow] fromView:nil];
250250

0 commit comments

Comments
 (0)