Next: , Previous: Windows, Up: Top


18 Events

Functions for handling events from the window system

18.1 Overview

This section describes functions dealing with events from the window system.

In GTK+ applications the events are handled automatically in gtk-main-do-event and passed on to the appropriate widgets, so these functions are rarely needed. Though some of the fields in the Event Structures are useful.

18.2 Usage

— Function: gdk-events-pending ⇒  (ret bool)

Checks if any events are ready to be processed for any display.

ret
#t’ if any events are pending.
— Function: gdk-event-peek ⇒  (ret <gdk-event>)

If there is an event waiting in the event queue of some open display, returns a copy of it. See gdk-display-peek-event.

ret
a copy of the first <gdk-event> on some event queue, or ‘#f’ if no events are in any queues. The returned <gdk-event> should be freed with gdk-event-free.
— Function: gdk-event-get ⇒  (ret <gdk-event>)

Checks all open displays for a <gdk-event> to process,to be processed on, fetching events from the windowing system if necessary. See gdk-display-get-event.

ret
the next <gdk-event> to be processed, or ‘#f’ if no events are pending. The returned <gdk-event> should be freed with gdk-event-free.
— Function: gdk-event-get-graphics-expose (window <gdk-window>) ⇒  (ret <gdk-event>)

Waits for a GraphicsExpose or NoExpose event from the X server. This is used in the <gtk-text> and <gtk-clist> widgets in GTK+ to make sure any GraphicsExpose events are handled before the widget is scrolled.

window
the <gdk-window> to wait for the events for.
ret
a <gdk-event-expose> if a GraphicsExpose was received, or ‘#f’ if a NoExpose event was received.
— Function: gdk-event-put (self <gdk-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 ‘#f’. See gdk-display-put-event.

event
a <gdk-event>.
— Function: gdk-event-copy (self <gdk-event>) ⇒  (ret <gdk-event>)

Copies a <gdk-event>, copying or incrementing the reference count of the resources associated with it (e.g. <gdk-window>'s and strings).

event
a <gdk-event>
ret
a copy of event. The returned <gdk-event> should be freed with gdk-event-free.
— Function: gdk-event-get-time (self <gdk-event>) ⇒  (ret unsigned-int32)

Returns the time stamp from event, if there is one; otherwise returns <gdk-current-time>. If event is ‘#f’, returns <gdk-current-time>.

event
a <gdk-event>
ret
time stamp field from event
— Function: gdk-event-get-axis (self <gdk-event>) (axis_use <gdk-axis-use>) ⇒  (ret bool) (value double)

Extract the axis value for a particular axis use from an event structure.

event
a <gdk-event>
axis-use
the axis use to look for
value
location to store the value found
ret
#t’ if the specified axis was found, otherwise ‘#f
— Function: gdk-event-get-coords (self <gdk-event>) ⇒  (ret bool) (x_win double) (y_win double)

Extract the event window relative x/y coordinates from an event.

event
a <gdk-event>
x-win
location to put event window x coordinate
y-win
location to put event window y coordinate
ret
#t’ if the event delivered event window coordinates
— Function: gdk-event-get-root-coords (self <gdk-event>) ⇒  (ret bool) (x_root double) (y_root double)

Extract the root window relative x/y coordinates from an event.

event
a <gdk-event>
x-root
location to put root window x coordinate
y-root
location to put root window y coordinate
ret
#t’ if the event delivered root window coordinates
— Function: gdk-get-show-events ⇒  (ret bool)

Gets whether event debugging output is enabled.

ret
#t’ if event debugging output is enabled.
— Function: gdk-set-show-events (show_events bool)

Sets whether a trace of received events is output. Note that GTK+ must be compiled with debugging (that is, configured using the "–enable-debug") option) to use this option.

show-events
#t’ to output event debugging information.
— Function: gdk-event-get-screen (self <gdk-event>) ⇒  (ret <gdk-screen>)

Returns the screen for the event. The screen is typically the screen for ‘event->any.window’, but for events such as mouse events, it is the screen where the pointer was when the event occurs - that is, the screen which has the root window to which ‘event->motion.x_root’ and ‘event->motion.y_root’ are relative.

event
a <gdk-event>
ret
the screen for the event

Since 2.2