gpm: Events
3.1 Events
==========
Whenever the mouse generates an event, the event is dispatched to the
active client for the current console, or to the default handler, if
present. Otherwise selection is run. A default handler is a client
process which gets mouse events form all the virtual consoles.
Default Handlers.
When a client is involved, it is handled a 'Gpm_Event' structure,
built by the server. The fields for 'Gpm_Event' are the following:
'unsigned char buttons;'
An or-mask of the values 'GPM_B_LEFT', 'GPM_B_MIDDLE' and
'GPM_B_RIGHT'. It corresponds to the state of the mouse buttons
when the event is reported. The current implementation of gpm
allows at most three buttons.
'unsigned char modifiers;'
The value of the kernel variable 'shift_state', as of 'keyboard.c',
when the event is reported. It is a bitmask value, and corresponds
to the least significant byte of the value used by the 'loadkeys'
program. Use of symbolic names in source code is available after
inclusion of 'linux/keyboard.h', as exemplified in 'mev.c'.
'unsigned short vc;'
The number of the active virtual console when the event is
reported. The client is not expected to use this value, which
corresponds to the controlling terminal of the client process,
unless it gets events form multiple consoles. Default
Handlers.
'short x, y;'
The position of the mouse pointer where the event is reported. It
is 1-based by default, to be compatible with 'selection' and
'libcurses'. This behavior can be overriden, though, by setting
the library variable 'gpm_zerobased'. Variables.
'short dx, dy;'
The change in position since the last reported event.
'enum Gpm_Etype type;'
A bit-mask, representing the type of reported event, as described
later. Event Types.
'int clicks;'
A counter, which is valid at button-down, drag or button-up. It
can be 0, 1 or 2 to mean single, double or triple click.
'enum Gpm_Margin margin;'
A bit-mask, telling if the pointer has gone out of the visible
screen. The indivudual bits are named 'GPM_TOP', 'GPM_BOT',
'GPM_LFT', 'GPM_RGT'. Only one of them is active at a time, to
allow using 'switch' on the value. Vertical outrun takes
precedence on horizontal outrun. Margins.