ggiEventRead(3) Event management for LibGGI visual

Other Alias

ggiJoinInputs, ggiEventPoll, ggiEventSelect, ggiEventsQueued, ggiSetEventMask, ggiGetEventMask, ggiAddEventMask, ggiRemoveEventMask


#include <ggi/ggi.h>
gii_event_mask ggiEventPoll(ggi_visual_t vis, gii_event_mask mask,
struct timeval *t);
int ggiEventsQueued(ggi_visual_t vis, gii_event_mask mask);
int ggiEventRead(ggi_visual_t vis, gii_event *ev,
gii_event_mask mask);
int ggiSetEventMask(ggi_visual_t vis, gii_event_mask evm);
gii_event_mask ggiGetEventMask(ggi_visual_t vis);
gii_input_t ggiJoinInputs(ggi_visual_t vis, gii_input_t inp);
#define ggiAddEventMask(vis,mask) \
ggiSetEventMask((vis), ggiGetEventMask((vis)) | (mask))
#define ggiRemoveEventMask(vis,mask) \
ggiSetEventMask((vis), ggiGetEventMask((vis)) & ~(mask))


LibGGI provides input facilities through an auxiliary library, LibGII. Each LibGGI visual internally contains a gii_input_t input, and all LibGII functions are available to manipulate and process inputs. The LibGGI versions provided of most LibGII functions simply take a ggi_visual_t rather than gii_input_t for convenience during everyday usage. Events are LibGII types. All other semantics are the same; see libgii(7) for details.
Important: By default LibGGI visuals autodetect and open the appropriate inputs, including mouse and keyboard and any other inputs that are intrinsic to the visual e.g. any registered X11 input device under the X target. Thus in the usual cases there is no need to open a LibGII gii_input_t directly (and that may in fact fail because an input device is already open). The LibGGI ggiEvent* functions must be used to do event handling with LibGGI visuals, and provide adequate support for most everyday, single-visual usage.

Advanced management of input sources is accomplished by detaching the input from the visual and using LibGII functions on the separate visual handle (see ggiDetachInput(3)). This is encouraged, for example, when joining inputs from multiple visuals, because when two visuals share the same joined input, you cannot ggiClose both of the visuals (a fatal error will result, because closing the first visual closes both of the joined inputs and leaves the second closed visual with a stale input handle.)