Class

CGEventSource

Defines an opaque type that represents the source of a Quartz event.

Declaration

class CGEventSource

Overview

A Quartz event source is an object that contains accumulated state related to event generation and event posting. Every event source has an associated global event state table called a source state. When you call init(stateID:) to create an event source, you specify which source state to use. For more information about source states, see CGEventSourceStateID.

A typical use of an event source would be to obtain the source from a Quartz event received by an event tap callback function, and then to use that source for any new events created as a result of the received event. This has the effect of marking the events as being related.

This opaque type is derived from CFType and inherits the properties that all Core Foundation types have in common. For more information, see CFType.

Topics

Initializers

init?(event: CGEvent?)

Returns a Quartz event source created from an existing Quartz event.

init?(stateID: CGEventSourceStateID)

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

Instance Properties

var keyboardType: CGEventSourceKeyboardType

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

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.

var sourceStateID: CGEventSourceStateID

Returns the source state associated with a Quartz event source.

var userData: Int64

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

Type Properties

class var typeID: CFTypeID

Returns the type identifier for the opaque type CGEventSourceRef.

Instance Methods

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.

Type Methods

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

Returns a Boolean value indicating the current button state of 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.

class func flagsState(CGEventSourceStateID) -> CGEventFlags

Returns the current flags 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 secondsSinceLastEventType(CGEventSourceStateID, eventType: CGEventType) -> CFTimeInterval

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