(gdk.info) Events
Info Catalog
(gdk.info) Initialization
(gdk.info) Top
(gdk.info) Visuals
Event handling
**************
Events are the means by which GDK lets the programmer know of user
interaction. An event is normally a button or key press or some other
indirect user action, such as a the mouse cursor entering or leaving a
window.
There exist only a few functions for getting events and event
information. These are `gdk_events_pending', `gdk_event_get',
`gdk_events_record' and `gdk_events_playback'. The latter two functions
are useful for automatic testing of a software package and should
normally not be needed in a program.
- Function: gint gdk_events_pending (void)
Returns the number of events pending on the event queue.
- Function: gint gdk_event_get (GdkEvent *EVENT)
Return the next available event in the EVENT structure.
`gdk_event_get' will return `TRUE' on success and `FALSE' on
failure. Success and failure is determined by whether an event
arrived before the timeout period expired.
- Function: void gdk_events_record (char *FILENAME)
Turn on recording of events. User events and certain system events
will be saved in the file named by the variable FILENAME. This
stream of events can later be played back and "should" produce the
same results as when the original events were handled. However, the
programmer does need to be careful in that the state of the
program must be the same when `gdk_events_record' is called and
when `gdk_events_playback' is called. For this reason,
`gdk_events_record' is normally not called directly, but is instead
invoked indirectly by specifying the "-record" command line option.
- Function: void gdk_events_playback (char *FILENAME)
Start playback of events from a file. (See the above description of
`gdk_events_record'). Normally this function is not called directly
but is invoked by the "-playback" command line option.
- Function: void gdk_events_stop (void)
Stop recording and playback of events.
void
handle_event ()
{
GdkEvent event;
if (gdk_event_get (&event))
{
switch (event.type)
{
...
}
}
}
Info Catalog
(gdk.info) Initialization
(gdk.info) Top
(gdk.info) Visuals
automatically generated byinfo2html