Enumeration

CGEventSourceStateID

Constants that specify the possible source states of an event source.

Declaration

typedef enum CGEventSourceStateID : int32_t {
    ...
} CGEventSourceStateID;

Overview

A source state refers to a global event state table. These tables contain accumulated information on modifier flag state, keyboard key state, mouse button state, and related internal parameters placed in effect by posting events with associated sources.

Two pre-existing event state tables are defined:

  • The kCGEventSourceStateCombinedSessionState table reflects the combined state of all event sources posting to the current user login session. If your program is posting events from within a login session, you should use this source state when you create an event source.

  • The kCGEventSourceStateHIDSystemState table reflects the combined state of all hardware event sources posting from the HID system. If your program is a daemon or a user space device driver interpreting hardware state and generating events, you should use this source state when you create an event source.

Specialized applications such as remote control programs may want to generate and track event source state independent of other processes. These programs should use the kCGEventSourceStatePrivate value in creating their event source. An independent state table and unique source state ID (CGEventSourceStateID) are created to track the event source's state. This independent state table is owned by the creating event source and released with it.

Topics

Constants

kCGEventSourceStatePrivate

Specifies that an event source should use a private event state table.

kCGEventSourceStateCombinedSessionState

Specifies that an event source should use the event state table that reflects the combined state of all event sources posting to the current user login session.

kCGEventSourceStateHIDSystemState

Specifies that an event source should use the event state table that reflects the combined state of all hardware event sources posting from the HID system.