Skip to content

Instantly share code, notes, and snippets.

@sergiobuj
Created February 7, 2012 04:28
Show Gist options
  • Save sergiobuj/1757173 to your computer and use it in GitHub Desktop.
Save sergiobuj/1757173 to your computer and use it in GitHub Desktop.
CGEventFlag bit mask and hotkey detection
if( ((flags & kCGEventFlagMaskAlphaShift) == 0 &&
(flags & kCGEventFlagMaskShift) == 0 &&
(flags & kCGEventFlagMaskControl) == 0 &&
(flags & kCGEventFlagMaskAlternate) == 0 &&
(flags & kCGEventFlagMaskCommand) == kCGEventFlagMaskCommand &&
(flags & kCGEventFlagMaskHelp) == 0 &&
(flags & kCGEventFlagMaskSecondaryFn) == kCGEventFlagMaskSecondaryFn &&
(flags & kCGEventFlagMaskNumericPad) == kCGEventFlagMaskNumericPad &&
(flags & kCGEventFlagMaskNonCoalesced) == kCGEventFlagMaskNonCoalesced) &&
(CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode) == 124)){
if(CGEventGetType(event) == kCGEventKeyUp){
localInput = !localInput;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment