Function

CGEnableEventStateCombining

Enables or disables the merging of actual key and mouse state with the application-specified state in a synthetic event.

Declaration

CGError CGEnableEventStateCombining(boolean_t combineState);

Parameters

doCombineState

Pass true to specify that the actual key and mouse state are merged with the application-specified state in a synthetic event; otherwise, pass false.

Return Value

A result code. See the result codes described in Quartz Display Services.

Discussion

By default, the flags that indicate modifier key state (Command, Option, Shift, Control, and so on) from the system's keyboard and from other event sources are ORed together as an event is posted into the system, and current key and mouse button state is considered in generating new events. This function allows your application to enable or disable the merging of event state. When combining is turned off, the event state propagated in the events posted by your application reflect state built up only by your application. The state within your application’s generated event will not be combined with the system's current state, so the system-wide state reflecting key and mouse button state will remain unchanged. When called with doCombineState equal to false, this function initializes local (per application) state tracking information to a state of all keys, modifiers, and mouse buttons up. When called with doCombineState equal to true, the current global state of keys, modifiers, and mouse buttons are used in generating events.

This function is not recommended for general use because of undocumented special cases and undesirable side effects. The recommended replacement for this function is to use Quartz events and Quartz event sources. This allows you to control exactly which, if any, external event sources will contribute to the state used to create an event.

See Also

Deprecated Functions

CGEventGetSource

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

CGPostKeyboardEvent

Synthesizes a low-level keyboard event on the local machine.

Deprecated
CGPostMouseEvent

Synthesizes a low-level mouse-button event on the local machine.

Deprecated
CGPostScrollWheelEvent

Synthesizes a low-level scrolling event on the local machine.

Deprecated
CGInhibitLocalEvents

Turns off local hardware events in the current session.

Deprecated
CGSetLocalEventsFilterDuringSuppressionState

Filters local hardware events from the keyboard and mouse during the short interval after a synthetic event is posted.

Deprecated
CGSetLocalEventsSuppressionInterval

Sets the time interval in seconds that local hardware events are suppressed after posting a synthetic event.

Deprecated