These functions allow to define a keyboard event handler which is called by
keyboard_update (3) and
keyboard_waitforupdate (3)
when a keyboard event occured.
press
is
KEY_EVENTRELEASE or KEY_EVENTPRESS
if key
scancode
was released or pressed. Actually the first value is 0 and the second is 1 which are
so intuitive s.t. you may use them in your program.
Even you specify an own handler, svgalib will check for
<Alt>-F* or <Ctrl>-C
for console switches or generation of
SIGINT
if allowed by
keyboard_translatekeys (3).
Calling
keyboard_setdefaulteventhandler()
reinstates the default handler which maintains the tables used by
keyboard_getstate (3) and
keyboard_keypressed (3).
It is probably a good idea to call
keyboard_clearstate (3)
after reenabling the default handler.
Here are the supported scancodes. The names of the
#defines
originate from the US keyboard layout, for other countries, they'll refer to the key
in the same physical location, but the keycap will have a different inscription. For
the list below, add
SCANCODE_
in front of the names to get the right name for your C source. That means, if it lists
BACKSLASH
below, you shall use
SCANCODE_BACKSLASH
as symbol in your program. In addition to the names below we also have
SCANCODE_0 - SCANCODE_9 ,
SCANCODE_KEYPAD0 - SCANCODE_KEYPAD9 ,
SCANCODE_A - SCANCODE_Z , and
SCANCODE_F1 - SCANCODE_F12 .
The other key names are
ESCAPE ,
MINUS ,
EQUAL ,
BACKSPACE ,
TAB ,
BRACKET_LEFT ,
BRACKET_RIGHT ,
ENTER ,
LEFTCONTROL ,
SEMICOLON ,
APOSTROPHE ,
GRAVE ,
LEFTSHIFT ,
BACKSLASH ,
COMMA ,
PERIOD ,
SLASH ,
RIGHTSHIFT ,
KEYPADMULTIPLY ,
LEFTALT ,
SPACE ,
CAPSLOCK ,
NUMLOCK ,
SCROLLLOCK ,
CURSORUPLEFT ,
CURSORUP ,
CURSORUPRIGHT ,
KEYPADMINUS ,
CURSORLEFT ,
CURSORRIGHT ,
KEYPADPLUS ,
CURSORDOWNLEFT ,
CURSORDOWN ,
CURSORDOWNRIGHT ,
KEYPADPERIOD ,
LESS ,
KEYPADENTER ,
RIGHTCONTROL ,
CONTROL ,
KEYPADDIVIDE ,
PRINTSCREEN ,
RIGHTALT ,
BREAK ,
BREAK_ALTERNATIVE ,
HOME ,
CURSORBLOCKUP ,
PAGEUP ,
CURSORBLOCKLEFT ,
CURSORBLOCKRIGHT ,
END ,
CURSORBLOCKDOWN ,
PAGEDOWN ,
INSERT , and
REMOVE .