Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

giieventread(3) [debian man page]

giiEventPoll(3) 							GGI							   giiEventPoll(3)

NAME
giiEventPoll, giiEventSelect, giiEventsQueued, giiEventRead - Wait for and receive events SYNOPSIS
#include <ggi/gii.h> gii_event_mask giiEventPoll(gii_input_t inp, gii_event_mask mask, struct timeval *t); int giiEventSelect(gii_input_t inp, gii_event_mask *mask, int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); int giiEventsQueued(gii_input_t inp, gii_event_mask mask); int giiEventRead(gii_input_t inp, gii_event *ev, gii_event_mask mask); DESCRIPTION
giiEventPoll waits for specific events to become available on an input. This call somewhat resembles the Unix select(2) call, but only for LibGII events and is more portable. The function returns after an event matching the given event mask is available or after the amount of time specified by t has elapsed, whichever occurs first. If t is NULL, there is no timeout. The timeout value on return is updated to the time that would have been remaining. So make sure to re-setup this value when calling giiEventPoll in a loop. giiEventSelect is the combination of giiEventPoll and select(2) allowing to wait for both LibGII events and arbitrary file descriptors in any of the three states. However, this function is not available if the operating system does not support the select(2) call, not even as a stub. giiEventsQueued returns the number of events matching the specified event mask that are currently queued in the input. giiEventRead blocks for and transfers an event from the given input to the location pointed to by ev. The event with the earliest timestamp that matches the given mask is returned to the application. RETURN VALUE
giiEventPoll returns a mask of available events (constrained by the given mask). It is 0 if no events are available. On error, an nega- tive gii-error(3) code is returned. giiEventSelect returns the same values as select(2). Unlike other LibGGI/LibGII functions, it also uses errno. It will update the timeout regardless of whether or not the system call does so. giiEventsQueued returns the number of events. giiEventRead returns the size of event on success, and 0 on error. EXAMPLES
This is one of the various ways of coding an event-polling loop: for(;;) { tv.tv_sec = 0; tv.tv_usec = 100; /* change to 0 for non-blocking behaviour */ ggiEventPoll(vis, emAll, &tv); n = ggiEventsQueued(vis, emAll); /* Process events in one gulp, when available */ while(n--) { ggiEventRead(vis, &ggievent, emAll); switch(ggievent.any.type) { /* ... */ } } /* Do other stuff */ } Note: This code uses the LibGGI functions and types instead of the LibGII ones, since the former is the more common case. libgii-1.0.x 2006-12-30 giiEventPoll(3)

Check Out this Related Man Page

gii_event(3)								GGI							      gii_event(3)

NAME
gii_event, gii_any_event, gii_event_type, gii_event_mask - LibGII event structures SYNOPSIS
#include <ggi/events.h> typedef union gii_event { uint8_t size; gii_any_event any; gii_cmd_event cmd; gii_expose_event expose; gii_val_event val; gii_key_event key; gii_pmove_event pmove; gii_pbutton_event pbutton; } gii_event; #define COMMON_DATA uint8_t size; /* size of event in bytes */ uint8_t type; /* type of this event */ int16_t error; /* error (for replies) */ uint32_t origin; /* origin device (etc) */ uint32_t target; /* target device (etc) */ struct timeval time /* timestamp */ typedef struct { COMMON_DATA; } gii_any_event; DESCRIPTION
Events are of type gii_event. It is an union of all of the structures for each specific type of event. STRUCTURE MEMBERS
All of the event structures contains housekeeping information at the beginning, as defined by COMMON_DATA. Thus, by analyzing the contents of any.type, you can determine what the given event is, and select the appropriate member of the gii_event union to access to get at the event The common fields found in any event structure are: size Specifies the size of the given event (in bytes). type An enumeration of the possible types of LibGII events (see next section). error Mainly there to round things up to a 32-bit boundary, but could be used to signal an error in a send-reply sequence. origin A device handle: it distinguishes one input device from another. Other than that there's no real meaning to the number. target Also a device handle, but for distinguishes input devices when sending events to an input device via giiEventSend(3). time Indicates when the event in question has been generated. See gettimeofday(2) for more info on the timeval structure. EVENT TYPES
The different types of events are defined as an enumeration of type gii_event_type. The possible values are: o evNothing : event is not valid. o evCommand : report command or do action. o evInformation : notification of new information. o evExposure : exposure event. o evKeyPress : a key has been pressed. o evKeyRelease : a key has been released. o evKeyRepeat : automatically repeated keypress. o evPtrRelative : pointer movement reported in relative coordinates. o evPtrAbsolute : pointer movement reported in absolute coordinates. o evPtrButtonPress : a pointer button has been pressed. o evPtrButtonRelease : a pointer button has been released. o evValRelative : valuator change reported as a relative value. o evValAbsolute : valuator change reported as an absolute value. EVENT MASKS
gii_event_mask is passed to various event handling functions to indicate which types of events the program is interested in. The list below sums the available event masks: o emCommand : evCommand o emInformation : evInformation o emExpose : evExpose o emKeyPress : evKeyPress o emKeyRelease : evKeyRelease o emKeyRepeat : evKeyRepeat o emKey : Any of evKeyPress, evKeyRelease or evKeyRepeat o emPtrRelative : evPtrRelative o emPtrAbsolute : evPtrAbsolute o emPtrButtonPress : evPtrButtonPress o emButtonRelease : evButtonRelease o emPtrMove : Any of evPtrRelative or evPtrAbsolute o emPtrButton : Any of evPtrButtonPress or evPtrButtonRelease o emPointer : All pointer events o emValRelative : evValRelative o emValAbsolute : evValAbsolute o emValuator : Any of evValRelative or evValAbsolute o emAll : Any event type o emNothing : Matches no event type SEE ALSO
gii_key_event(3), gii_pmove_event(3), gii_pbutton_event(3), gii_cmd_event(3), gii_val_event(3), gii_expose_event(3) libgii-1.0.x 2006-12-30 gii_event(3)
Man Page