Skip to content

Commit 135ba70

Browse files
committedApr 24, 2021
SSYEventInfo now supports more modifier keys.
1 parent cbc63c2 commit 135ba70

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
 

‎SSYEventInfo.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
@interface SSYEventInfo : NSObject {
1919
}
2020

21-
+ (BOOL)alternateKeyDown ;
22-
23-
+ (BOOL)shiftKeyDown ;
21+
+ (BOOL)alternateKeyDown;
22+
+ (BOOL)shiftKeyDown;
23+
+ (BOOL)commandKeyDown;
24+
+ (BOOL)controlKeyDown;
2425

2526
@end

‎SSYEventInfo.m

+10
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,14 @@ + (BOOL)shiftKeyDown {
1313
return (modifiers & kCGEventFlagMaskShift) != 0 ;
1414
}
1515

16+
+ (BOOL)commandKeyDown {
17+
CGEventFlags modifiers = (CGEventFlags)CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) ;
18+
return (modifiers & kCGEventFlagMaskCommand) != 0 ;
19+
}
20+
21+
+ (BOOL)controlKeyDown {
22+
CGEventFlags modifiers = (CGEventFlags)CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) ;
23+
return (modifiers & kCGEventFlagMaskControl) != 0 ;
24+
}
25+
1626
@end

0 commit comments

Comments
 (0)