To access other fields of the event structs, the pointer to the event can be cast to the appropriate event struct pointer, or the union member name can be used. For example if the event type is GDK_BUTTON_PRESS then the x coordinate of the button press can be accessed with:
|
or:
|
struct GdkEventAny
|
Contains the fields which are common to all event structs. Any event pointer can safely be cast to a pointer to a GdkEventAny to access these fields.
GdkEventType type the type of the event.
GdkWindow *window the window which received the event.
gint8 send_event TRUE if the event was sent explicitly (e.g. using XSendEvent).
struct GdkEventKey
|
Describes a key press or key release event.
GdkEventType type the type of the event (GDK_KEY_PRESS or GDK_KEY_RELEASE).
GdkWindow *window the window which received the event.
gint8 send_event TRUE if the event was sent explicitly (e.g. using XSendEvent).
guint32 time the time of the event in milliseconds.
guint state a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See GdkModifierType.
guint keyval the key that was pressed or released. See the <gdk/gdkkeysym.h> header file for a complete list of GDK key codes.
gint length the length of string.
gchar *string a null-terminated multi-byte string containing the composed characters resulting from the key press. When text is being input, in a GtkEntry for example, it is these characters which should be added to the input buffer. When using Input Methods to support internationalized text input, the composed characters appear here after the pre-editing has been completed.
struct GdkEventButton
|
Used for button press and button release events. The type field will be one of GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_3BUTTON_PRESS, and GDK_BUTTON_RELEASE.
Double and triple-clicks result in a sequence of events being received. For double-clicks the order of events will be:
|
Note that the first click is received just like a normal button press, while the second click results in a GDK_2BUTTON_PRESS being received just after the GDK_BUTTON_PRESS.
Triple-clicks are very similar to double-clicks, except that GDK_3BUTTON_PRESS is inserted after the third click. The order of the events is:
|
For a double click to occur, the second button press must occur within 1/4 of a second of the first. For a triple click to occur, the third button press must also occur within 1/2 second of the first button press.
GdkEventType type the type of the event (GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_3BUTTON_PRESS or GDK_BUTTON_RELEASE).
GdkWindow *window the window which received the event.
gint8 send_event TRUE if the event was sent explicitly (e.g. using XSendEvent).
guint32 time the time of the event in milliseconds.
gdouble x the x coordinate of the mouse relative to the window.