Function

CGEventGetUnflippedLocation

Returns the location of a Quartz mouse event.

Declaration

CGPoint CGEventGetUnflippedLocation(CGEventRef event);

Parameters

event

The mouse event whose location you wish to obtain.

Return Value

The current location of the specified mouse event relative to the lower-left corner of the main display.

Discussion

This function returns the location of the mouse cursor associated with the event. The coordinate system used is relative to the lower-left corner of the main display, and is compatible with the global coordinate system used by the Application Kit.

Note that the y-coordinate of the returned location is off by one from an idealized coordinate system originating at the lower-left corner of the main display. Effectively, the function is defined as follows:

CGPoint p = CGEventGetLocation(event);
p.y = main_display_height - p.y;
/* not p.y = (main_display_height - 1) - p.y */
return p;

See Also

Working With Events

CGEventGetTypeID

Returns the type identifier for the opaque type CGEventRef.

CGEventCreate

Returns a new Quartz event.

CGEventCreateData

Returns a flattened data representation of a Quartz event.

CGEventCreateFromData

Returns a Quartz event created from a flattened data representation of the event.

CGEventCreateMouseEvent

Returns a new Quartz mouse event.

CGEventCreateKeyboardEvent

Returns a new Quartz keyboard event.

CGEventCreateScrollWheelEvent

Returns a new Quartz scrolling event.

CGEventCreateCopy

Returns a copy of an existing Quartz event.

CGEventCreateSourceFromEvent

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

CGEventSetSource

Sets the event source of a Quartz event.

CGEventGetType

Returns the event type of a Quartz event (left mouse down, for example).

CGEventSetType

Sets the event type of a Quartz event (left mouse down, for example).

CGEventGetTimestamp

Returns the timestamp of a Quartz event.

CGEventSetTimestamp

Sets the timestamp of a Quartz event.

CGEventGetLocation

Returns the location of a Quartz mouse event.

CGEventSetLocation

Sets the location of a Quartz mouse event.

CGEventGetFlags

Returns the event flags of a Quartz event.

CGEventSetFlags

Sets the event flags of a Quartz event.

CGEventKeyboardGetUnicodeString

Returns the Unicode string associated with a Quartz keyboard event.

CGEventKeyboardSetUnicodeString

Sets the Unicode string associated with a Quartz keyboard event.

CGEventGetIntegerValueField

Returns the integer value of a field in a Quartz event.

CGEventSetIntegerValueField

Sets the integer value of a field in a Quartz event.

CGEventGetDoubleValueField

Returns the floating-point value of a field in a Quartz event.

CGEventSetDoubleValueField

Sets the floating-point value of a field in a Quartz event.