typedef union { GR_EVENT_TYPE type; GR_EVENT_ERROR error; GR_EVENT_GENERAL general; GR_EVENT_BUTTON button; GR_EVENT_KEYSTROKE keystroke; GR_EVENT_EXPOSURE exposure; GR_EVENT_MOUSE mouse; GR_EVENT_FDINPUT fdinput; GR_EVENT_UPDATE update; } GR_EVENT;
The GR_EVENT structure is used to retrieve event information from the nano-X event queue. When you pull an event out of the event queue you don't know what type of event it is until after you have the event. Various events are different sizes, this structure is a union of all event types. Since this structure is a union, it is guarenteed to be large enough to hold the largest possible event when you get an event from the event queue.
The type field identifies the structure type. After receiving an event it is common for an application to switch on type.
Type | Name | Description |
---|---|---|
GR_EVENT_TYPE | type | The type of event that this structure corresponds too. |
GR_EVENT_ERROR | error | Additional event data, if the event type is GR_EVENT_TYPE_ERROR. |
GR_EVENT_GENERAL | general | Additional event data, if the event type is GR_EVENT_TYPE_CLOSE_REQ, GR_EVENT_TYPE_MOUSE_EXIT, GR_EVENT_TYPE_MOUSE_ENTER, GR_EVENT_TYPE_FOCUS_OUT or GR_EVENT_TYPE_FOCUS_IN. |
GR_EVENT_BUTTON | button | Additional event data, if the event type is GR_EVENT_TYPE_BUTTON_UP or GR_EVENT_TYPE_BUTTON_DOWN. |
GR_EVENT_KEYSTROKE | keystroke | Additional event data, if the event type is GR_EVENT_TYPE_KEY_DOWN or GR_EVENT_TYPE_KEY_UP. |
GR_EVENT_EXPOSURE | exposure | Additional event data, if the event type is GR_EVENT_TYPE_EXPOSURE. |
GR_EVENT_MOUSE | mouse | Additional event data, if the event type is GR_EVENT_TYPE_MOUSE_ENTER, GR_EVENT_TYPE_MOUSE_EXIT, GR_EVENT_TYPE_MOUSE_MOTION or GR_EVENT_TYPE_Mouse_POSITION. |
GR_EVENT_FDINPUT | fdinput | Additional event data, if the event type is GR_EVENT_TYPE_FDINPUT. |
GR_EVENT_UPDATE | update | Additional event data, if the event type is GR_EVENT_TYPE_UPDATE. |