Type Alias


A client-supplied callback function that’s invoked whenever an associated event tap receives a Quartz event.


typealias CGEventTapCallBack = (CGEventTapProxy, CGEventType, CGEvent, UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>?



A proxy for the event tap. See CGEventTapProxy. This callback function may pass this proxy to other functions such as the event-posting routines.


The event type of this event. See CGEventType.


The incoming event. This event is owned by the caller, and you do not need to release it.


A pointer to user-defined data. You specify this pointer when you create the event tap. Several different event taps could use the same callback function, each tap with its own user-defined data.


If the event tap is an active filter, your callback function should return one of the following:

  • The (possibly modified) event that is passed in. This event is passed back to the event system.

  • A newly-constructed event. After the new event has been passed back to the event system, the new event will be released along with the original event.

  • NULL if the event passed in is to be deleted.

If the event tap is an passive listener, your callback function may return the event that is passed in, or NULL. In either case, the event stream is not affected.