Return to site

Q chat for mac

broken image
broken image

If (((type = kCGEventKeyDown) || (type = kCGEventKeyUp)))Įvent, kCGKeyboardEventKeycode, (int64_t)-1) ĬGKe圜ode keycode = (CGKe圜ode)CGEventGetIntegerValueField( type will be key down or key up, you can discard the command + q by setting the kecode to be -1 like this Then in your class, you can implement the call back function called m圜GEventCallback like this CGEventRef m圜GEventCallback(CGEventTapProxy proxy, CGEventType type, RunLoopSource = CFMachPortCreateRunLoopSource(ĬFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, We are interested in key presses.ĮventMask = ((1 << kCGEventKeyDown) | (1 << kCGEventKeyUp)) ĮventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, 0,įprintf(stderr, 'failed to create event tap\n')

broken image

This is the best answer for this questionįirst in your applicationDidFinishedLoad function, add this peace of code to create an event tap and add the event tap in the current run loop CFMachPortRef eventTap