gpm: Extra Functions
4.2.5 Extra Functions
---------------------
-- Function: char* Gpm_GetLibVersion (int *WHERE);
This function returns a pointer to a static storage representing
the version number of the library. It is only available from
0.98.2 onward, and returns a string like '"0.98.2"'. The third
number is optional. All numbers may be one or two digits. This
behaviour changed in version 2.1.0 of libgpm. In releases before
2.1.0 the second number was always reported as two digits. The
WHERE pointer, if not null, is used to store a decimal number
representing the version - 0.98.2 is 9802 and 2.1.1 is 20101.
-- Function: char* Gpm_GetServerVersion (int *WHERE);
This function returns a pointer to a static storage representing
the version number of the server. The version is retrieved through
'popen()', so it could fail (and return 'NULL')if no 'gpm' program
is in the current path. Alternatively, it could fail (and return a
wrong value) if the 'gpm' in the path is not the currently running
one. The function is only available in the clientlibrary version
0.98.2 or newer, but it works with any daemon, from 0.01 onward.
The string returned can be parsed in the same way as for
'Gpm_GetLibVersion()'. A preparsed version is stored in *WHERE if
WHERE is not null. Both these functions do their calculations only
the first time they are invoked.
-- Function: int Gpm_GetSnapshot (Gpm_Event *EPTR);
This function gives a non-blocking snapshot of the current
situation: it returns the number of mouse buttons, as known to the
server, or -1 if that information is not available (under Xterm, or
before connecting). If EPTR is not null, it is filled with
information about the current state of the mouse. The fields have
the following meaning: 'x,y': current position of the cursor;
'dx,dy' size of the window; 'vc,modifiers' the current console and
the current shift state; 'buttons' which buttons are currently help
down; 'clicks' the number of clicks (0,1,2). This function is only
available from 0.98.2 onward, and will return -1 if run with an
older server.
Since this information travels on the same file descriptor as the
events, and applications usually don't want to lose events, the
function returns 0 if the input queue is not empty.