typedef struct { GR_EVENT_TYPE type; GR_WINDOW_ID wid; GR_WINDOW_ID subwid; GR_COORD rootx; GR_COORD rooty; GR_COORD x; GR_COORD y; int buttons; int modifiers; } GR_EVENT_MOUSE;
The GR_EVENT_MOUSE structure is used by nano-X to report changes in the position of the mouse. When the mouse position changes only one mouse event is sent to a client. The event is sent to the highest window that has selected for the event. If the window's parent has also selected for mouse events, nano-X will not send an additional event for the parent window.
If a window has selected both GR_EVENT_TYPE_BUTTON_DOWN and GR_EVENT_TYPE_BUTTON_UP events, nano-X will grab the mouse for that window when a mouse button is first pressed down within that window. While the mouse is grabbed, no mouse button or position events will be delivered to any window besides the window that nano-X grabbed the mouse for. The mouse will remain grabbed until all of the mouse buttons are released.
Type | Name | Description |
---|---|---|
GR_EVENT_TYPE | type | The event type will be either a GR_EVENT_TYPE_MOUSE_MOTION or a GR_EVENT_TYPE_MOUSE_POSITION type. |
GR_WINDOW_ID | wid | The ID of the window that the mouse event is being sent to. If the mouse has been grabbed then this is the window that nano-X grabbed the mouse for. In this case the mouse may not actually be positioned over the window any longer. The mouse may be over a child window or it may be outside the window that grabbed the mouse. |
GR_WINDOW_ID | subwid | The ID of the window that the mouse event occurs in. Generally this field will be the same as wid, but in some cases if the mouse event occurs in a decendant of wid, then this field indicates that child window. |
GR_COORD | rootx | The X coordinate of the mouse pointer relative to the root window. |
GR_COORD | rooty | The Y coordinate of the mouse pointer relative to the root window. |
GR_COORD | x | The X coordinate of the mouse pointer relative to the window wid. |
GR_COORD | y | The Y coordinate of the mouse pointer relative to the window wid. |
int | buttons | Indicates the buttons that are being pressed. This field will be 0 if all buttons are released or a bitwise OR of GR_BUTTON_R, GR_BUTTON_M and/or GR_BUTTON_L if one or more buttons are pressed. |
int | modifiers | Indicates the status of the keyboard modifier keys. This field will be 0 if no modifiers are pressed, or a bitwise OR of one or more of GR_MODIFIER_CTRL, GR_MODIFIER_META, GR_MODIFIER_SHIFT, GR_MODIFIER_LOCK, GR_MODIFIER_NUMLOCK and/or GR_MODIFIER_SCROLLLOCK if one or more modifier keys is pressed. |