Having set the response to the event, I cannot determine which key was pressed using CGEvent.
CGEventFlags flagsP;
flagsP=CGEventGetFlags(event);
NSLog(@"flags: 0x%llX",flagsP);
NSLog(@"stored: 0x%llX",kCGEventFlagMaskCommand);
if (flagsP==kCGEventFlagMaskCommand) {
NSLog(@"command pressed");
}
Given the snippet above, the first NSLog returns a different value from the second NSLog. Not surprisingly, a conditional value never fires when a command modifier key is pressed.
I need to determine if a command, alternative, optional, control or shift, is pressed for a given CGEvent. At first, although I need help to understand why the above does not work.
Thank!
source
share