Synopsis#include <gdk/gdk.h> enum GdkEventType; enum GdkEventMask; #define GDK_CURRENT_TIME #define GDK_PRIORITY_EVENTS #define GDK_PRIORITY_REDRAW gboolean gdk_events_pending (void); GdkEvent* gdk_event_peek (void); GdkEvent* gdk_event_get (void); GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window); void gdk_event_put (const GdkEvent *event); GdkEvent* gdk_event_new (GdkEventType type); GdkEvent* gdk_event_copy (const GdkEvent *event); void gdk_event_free (GdkEvent *event); guint32 gdk_event_get_time (const GdkEvent *event); gboolean gdk_event_get_state (const GdkEvent *event, GdkModifierType *state); gboolean gdk_event_get_axis (const GdkEvent *event, GdkAxisUse axis_use, gdouble *value); gboolean gdk_event_get_coords (const GdkEvent *event, gdouble *x_win, gdouble *y_win); gboolean gdk_event_get_root_coords (const GdkEvent *event, gdouble *x_root, gdouble *y_root); void gdk_event_request_motions (const GdkEventMotion *event); void gdk_event_handler_set (GdkEventFunc func, gpointer data, GDestroyNotify notify); void (*GdkEventFunc) (GdkEvent *event, gpointer data); gboolean gdk_event_send_client_message (GdkEvent *event, GdkNativeWindow winid); gboolean gdk_event_send_client_message_for_display (GdkDisplay *display, GdkEvent *event, GdkNativeWindow winid); void gdk_event_send_clientmessage_toall (GdkEvent *event); void gdk_add_client_message_filter (GdkAtom message_type, GdkFilterFunc func, gpointer data); gboolean gdk_get_show_events (void); void gdk_set_show_events (gboolean show_events); void gdk_event_set_screen (GdkEvent *event, GdkScreen *screen); GdkScreen* gdk_event_get_screen (const GdkEvent *event); gboolean gdk_setting_get (const gchar *name, GValue *value); DescriptionThis section describes functions dealing with events from the window system.
In GTK+ applications the events are handled automatically in
Detailsenum GdkEventTypetypedef enum { GDK_NOTHING = -1, GDK_DELETE = 0, GDK_DESTROY = 1, GDK_EXPOSE = 2, GDK_MOTION_NOTIFY = 3, GDK_BUTTON_PRESS = 4, GDK_2BUTTON_PRESS = 5, GDK_3BUTTON_PRESS = 6, GDK_BUTTON_RELEASE = 7, GDK_KEY_PRESS = 8, GDK_KEY_RELEASE = 9, GDK_ENTER_NOTIFY = 10, GDK_LEAVE_NOTIFY = 11, GDK_FOCUS_CHANGE = 12, GDK_CONFIGURE = 13, GDK_MAP = 14, GDK_UNMAP = 15, GDK_PROPERTY_NOTIFY = 16, GDK_SELECTION_CLEAR = 17, GDK_SELECTION_REQUEST = 18, GDK_SELECTION_NOTIFY = 19, GDK_PROXIMITY_IN = 20, GDK_PROXIMITY_OUT = 21, GDK_DRAG_ENTER = 22, GDK_DRAG_LEAVE = 23, GDK_DRAG_MOTION = 24, GDK_DRAG_STATUS = 25, GDK_DROP_START = 26, GDK_DROP_FINISHED = 27, GDK_CLIENT_EVENT = 28, GDK_VISIBILITY_NOTIFY = 29, GDK_NO_EXPOSE = 30, GDK_SCROLL = 31, GDK_WINDOW_STATE = 32, GDK_SETTING = 33, GDK_OWNER_CHANGE = 34, GDK_GRAB_BROKEN = 35, GDK_DAMAGE = 36 } GdkEventType; Specifies the type of the event. Do not confuse these events with the signals that GTK+ widgets emit. Although many of these events result in corresponding signals being emitted, the events are often transformed or filtered along the way.
enum GdkEventMasktypedef enum { GDK_EXPOSURE_MASK = 1 << 1, GDK_POINTER_MOTION_MASK = 1 << 2, GDK_POINTER_MOTION_HINT_MASK = 1 << 3, GDK_BUTTON_MOTION_MASK = 1 << 4, GDK_BUTTON1_MOTION_MASK = 1 << 5, GDK_BUTTON2_MOTION_MASK = 1 << 6, GDK_BUTTON3_MOTION_MASK = 1 << 7, GDK_BUTTON_PRESS_MASK = 1 << 8, GDK_BUTTON_RELEASE_MASK = 1 << 9, GDK_KEY_PRESS_MASK = 1 << 10, GDK_KEY_RELEASE_MASK = 1 << 11, GDK_ENTER_NOTIFY_MASK = 1 << 12, GDK_LEAVE_NOTIFY_MASK = 1 << 13, GDK_FOCUS_CHANGE_MASK = 1 << 14, GDK_STRUCTURE_MASK = 1 << 15, GDK_PROPERTY_CHANGE_MASK = 1 << 16, GDK_VISIBILITY_NOTIFY_MASK = 1 << 17, GDK_PROXIMITY_IN_MASK = 1 << 18, GDK_PROXIMITY_OUT_MASK = 1 << 19, GDK_SUBSTRUCTURE_MASK = 1 << 20, GDK_SCROLL_MASK = 1 << 21, GDK_ALL_EVENTS_MASK = 0x3FFFFE } GdkEventMask; A set of bit-flags to indicate which events a window is to receive. Most of these masks map onto one or more of the GdkEventType event types above.
GDK_CURRENT_TIME#define GDK_CURRENT_TIME 0L Represents the current time, and can be used anywhere a time is expected. GDK_PRIORITY_EVENTS#define GDK_PRIORITY_EVENTS This is the priority that events from the X server are given in the GLib Main Loop. GDK_PRIORITY_REDRAW#define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20) This is the priority that the idle handler processing window updates is given in the GLib Main Loop. gdk_events_pending ()gboolean gdk_events_pending (void); Checks if any events are ready to be processed for any display.
gdk_event_peek ()GdkEvent* gdk_event_peek (void);
If there is an event waiting in the event queue of some open
display, returns a copy of it. See
gdk_event_get ()GdkEvent* gdk_event_get (void);
Checks all open displays for a GdkEvent to process,to be processed
on, fetching events from the windowing system if necessary.
See
gdk_event_get_graphics_expose ()GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window); Waits for a GraphicsExpose or NoExpose event from the X server. This is used in the GtkText and GtkCList widgets in GTK+ to make sure any GraphicsExpose events are handled before the widget is scrolled.
gdk_event_put ()void gdk_event_put (const GdkEvent *event);
Appends a copy of the given event onto the front of the event
queue for event->any.window's display, or the default event
queue if event->any.window is
gdk_event_new ()GdkEvent* gdk_event_new (GdkEventType type); Creates a new event of the given type. All fields are set to 0.
Since 2.2 gdk_event_copy ()GdkEvent* gdk_event_copy (const GdkEvent *event); Copies a GdkEvent, copying or incrementing the reference count of the resources associated with it (e.g. GdkWindow's and strings).
gdk_event_free ()void gdk_event_free (GdkEvent *event);
Frees a GdkEvent, freeing or decrementing any resources associated with it.
Note that this function should only be called with events returned from
functions such as
gdk_event_get_time ()guint32 gdk_event_get_time (const GdkEvent *event);
Returns the time stamp from
gdk_event_get_state ()gboolean gdk_event_get_state (const GdkEvent *event, GdkModifierType *state);
If the event contains a "state" field, puts that field in
gdk_event_get_axis ()gboolean gdk_event_get_axis (const GdkEvent *event, GdkAxisUse axis_use, gdouble *value); Extract the axis value for a particular axis use from an event structure.
gdk_event_get_coords ()gboolean gdk_event_get_coords (const GdkEvent *event, gdouble *x_win, gdouble *y_win); Extract the event window relative x/y coordinates from an event.
gdk_event_get_root_coords ()gboolean gdk_event_get_root_coords (const GdkEvent *event, gdouble *x_root, gdouble *y_root); Extract the root window relative x/y coordinates from an event.
gdk_event_request_motions ()void gdk_event_request_motions (const GdkEventMotion *event);
Request more motion notifies if
{ /* motion_event handler */ x = motion_event->x; y = motion_event->y; /* handle (x,y) motion */ gdk_event_request_motions (motion_event); /* handles is_hint events */ }
Since 2.12 gdk_event_handler_set ()void gdk_event_handler_set (GdkEventFunc func, gpointer data, GDestroyNotify notify); Sets the function to call to handle all events from GDK.
Note that GTK+ uses this to install its own event handler, so it is
usually not useful for GTK+ applications. (Although an application
can call this function then call
GdkEventFunc ()void (*GdkEventFunc) (GdkEvent *event, gpointer data);
Specifies the type of function passed to
gdk_event_send_client_message ()gboolean gdk_event_send_client_message (GdkEvent *event, GdkNativeWindow winid); Sends an X ClientMessage event to a given window (which must be on the default GdkDisplay.) This could be used for communicating between different applications, though the amount of data is limited to 20 bytes.
gdk_event_send_client_message_for_display ()gboolean gdk_event_send_client_message_for_display (GdkDisplay *display, GdkEvent *event, GdkNativeWindow winid); On X11, sends an X ClientMessage event to a given window. On Windows, sends a message registered with the name GDK_WIN32_CLIENT_MESSAGE. This could be used for communicating between different applications, though the amount of data is limited to 20 bytes on X11, and to just four bytes on Windows.
Since 2.2 gdk_event_send_clientmessage_toall ()void gdk_event_send_clientmessage_toall (GdkEvent *event); Sends an X ClientMessage event to all toplevel windows on the default GdkScreen. Toplevel windows are determined by checking for the WM_STATE property, as described in the Inter-Client Communication Conventions Manual (ICCCM). If no windows are found with the WM_STATE property set, the message is sent to all children of the root window.
gdk_add_client_message_filter ()void gdk_add_client_message_filter (GdkAtom message_type, GdkFilterFunc func, gpointer data);
Adds a filter to the default display to be called when X ClientMessage events
are received. See
gdk_get_show_events ()gboolean gdk_get_show_events (void); Gets whether event debugging output is enabled.
gdk_set_show_events ()void gdk_set_show_events (gboolean show_events);
Sets whether a trace of received events is output.
Note that GTK+ must be compiled with debugging (that is,
configured using the
gdk_event_set_screen ()void gdk_event_set_screen (GdkEvent *event, GdkScreen *screen);
Sets the screen for
Since 2.2 gdk_event_get_screen ()GdkScreen* gdk_event_get_screen (const GdkEvent *event);
Returns the screen for the event. The screen is
typically the screen for
Since 2.2 gdk_setting_get ()gboolean gdk_setting_get (const gchar *name, GValue *value);
Obtains a desktop-wide setting, such as the double-click time,
for the default screen. See
|