Initializer

init(stateID:)

Returns a Quartz event source created with a specified source state.

Declaration

init?(stateID: CGEventSourceStateID)

Parameters

sourceState

The event state table to use for this event source. Pass one of the constants listed in CGEventSourceStateID.

Return Value

A new event source, or NULL if the specified source state is not valid. When you no longer need the event source, you should release it using the function CFRelease.

Discussion

If two or more event sources are using the same source state and one of them is released, the remaining event sources will behave as if all keys and buttons on input devices are up in generating new events from this source.

See Also

Working With Event Sources

class var typeID: CFTypeID

Returns the type identifier for the opaque type CGEventSourceRef.

var keyboardType: CGEventSourceKeyboardType

Returns the keyboard type to be used with a Quartz event source.

var sourceStateID: CGEventSourceStateID

Returns the source state associated with a Quartz event source.

class func buttonState(CGEventSourceStateID, button: CGMouseButton) -> Bool

Returns a Boolean value indicating the current button state of a Quartz event source.

class func keyState(CGEventSourceStateID, key: CGKeyCode) -> Bool

Returns a Boolean value indicating the current keyboard state of a Quartz event source.

class func flagsState(CGEventSourceStateID) -> CGEventFlags

Returns the current flags of a Quartz event source.

class func secondsSinceLastEventType(CGEventSourceStateID, eventType: CGEventType) -> CFTimeInterval

Returns the elapsed time since the last event for a Quartz event source.

class func counterForEventType(CGEventSourceStateID, eventType: CGEventType) -> UInt32

Returns a count of events of a given type seen since the window server started.

var userData: Int64

Returns the 64-bit user-specified data for a Quartz event source.

func getLocalEventsFilterDuringSuppressionState(CGEventSuppressionState) -> CGEventFilterMask

Returns the mask that indicates which classes of local hardware events are enabled during event suppression.

func setLocalEventsFilterDuringSuppressionState(CGEventFilterMask, state: CGEventSuppressionState)

Sets the mask that indicates which classes of local hardware events are enabled during event suppression.

var localEventsSuppressionInterval: CFTimeInterval

Returns the interval that local hardware events may be suppressed following the posting of a Quartz event.

var pixelsPerLine: Double

Gets the scale of pixels per line in a scrolling event source.