gpm: Getting Events
4.2.3 Getting Events
--------------------
-- Function: int Gpm_GetEvent (Gpm_Event *EVENT);
Reads an event form 'gpm_fd'. It should be called only when the
'gpm_fd' descriptor is reported as readable by a 'select()' system
call, or it will block until an event arrives (unless you put the
mouse file in non-blocking mode). It returns 1 on success, -1 on
failure, and 0 after closing the connection. Failure can happen if
a signal interrupted the read system call. This function doesn't
work with xterm mouse reporting and is meant for internal use by
the library.
-- Function: int Gpm_CharsQueued (void);
It returns the number of characters (contained in 'nbprevchar'
index) queued into the array 'prevchar' by function 'Gpm_Getc'.
This call is useful i.e. in recognition of function or arrow keys,
when we need to know the next character read by 'Gpm_getc' in order
to subsequently get it.
-- Function: int Gpm_CharsQueued (void);
It returns the number of characters (contained in 'nbprevchar'
index) queued into the array 'prevchar' by function 'Gpm_Getc'.
This call is useful i.e. in recognition of function or arrow keys,
when we need to know the next character read by 'Gpm_getc' in order
to subsequently get it.
-- Function: int Gpm_Getc (FILE *F);
-- Function: int Gpm_Getchar (void);
These are intended to be replacements for 'getc()' and 'getchar()'
to be used by applications which are interested in the mouse.
Their external behaviour is the same as 'getc()', but a mouse
handler gets invoked whenever an event is available.
Handling Functions. A mouse handler can force 'Gpm_Getc' to
return a specific value to the caller, and the "simulated"
character is signaled by setting 'gpm_hflag' to 1.
-- Function: int Gpm_Wgetch (WINDOW *WIN);
-- Function: int Gpm_Getch (void);
These are intended to be replacements for 'wgetch()' and 'getch()'
to be used by applications which are interested in the mouse. They
are the curses equivalent of 'Gpm_Getchar'.