1keyboard_seteventhandler(3)   Svgalib User Manual  keyboard_seteventhandler(3)
2
3
4

NAME

6       keyboard_seteventhandler,  keyboard_setdefaulteventhandler  - define an
7       event handler for keyboard events in raw mode
8

SYNOPSIS

10       #include <vgakeyboard.h>
11
12       typedef void (*__keyboard_handler) (int scancode, int press);
13
14       void keyboard_seteventhandler(__keyboard_handler handler);
15       void keyboard_setdefaulteventhandler(void);
16
17

DESCRIPTION

19       These functions allow to define  a  keyboard  event  handler  which  is
20       called  by keyboard_update(3) and keyboard_waitforupdate(3) when a key‐
21       board event occured.
22
23       press  is  KEY_EVENTRELEASE  or  KEY_EVENTPRESS  if  key  scancode  was
24       released  or pressed. Actually the first value is 0 and the second is 1
25       which are so intuitive s.t. you may use them in your program.
26
27       Even you specify an own handler, svgalib will  check  for  <Alt>-F*  or
28       <Ctrl>-C  for  console  switches  or generation of SIGINT if allowed by
29       keyboard_translatekeys(3).
30
31       Calling keyboard_setdefaulteventhandler() reinstates the  default  han‐
32       dler  which  maintains the tables used by keyboard_getstate(3) and key‐
33       board_keypressed(3).   It  is  probably  a  good  idea  to  call   key‐
34       board_clearstate(3) after reenabling the default handler.
35
36       Here  are  the supported scancodes. The names of the #defines originate
37       from the US keyboard layout, for other countries, they'll refer to  the
38       key in the same physical location, but the keycap will have a different
39       inscription. For the list below, add SCANCODE_ in front of the names to
40       get the right name for your C source. That means, if it lists BACKSLASH
41       below, you shall use SCANCODE_BACKSLASH as symbol in your  program.  In
42       addition to the names below we also have SCANCODE_0 - SCANCODE_9, SCAN‐
43       CODE_KEYPAD0 - SCANCODE_KEYPAD9, SCANCODE_A  -  SCANCODE_Z,  and  SCAN‐
44       CODE_F1 - SCANCODE_F12.
45
46       The   other  key  names  are  ESCAPE,  MINUS,  EQUAL,  BACKSPACE,  TAB,
47       BRACKET_LEFT, BRACKET_RIGHT, ENTER, LEFTCONTROL, SEMICOLON, APOSTROPHE,
48       GRAVE,  LEFTSHIFT, BACKSLASH, COMMA, PERIOD, SLASH, RIGHTSHIFT, KEYPAD‐
49       MULTIPLY, LEFTALT, SPACE, CAPSLOCK, NUMLOCK, SCROLLLOCK,  CURSORUPLEFT,
50       CURSORUP,  CURSORUPRIGHT, KEYPADMINUS, CURSORLEFT, CURSORRIGHT, KEYPAD‐
51       PLUS, CURSORDOWNLEFT, CURSORDOWN, CURSORDOWNRIGHT, KEYPADPERIOD,  LESS,
52       KEYPADENTER,  RIGHTCONTROL,  CONTROL,  KEYPADDIVIDE, PRINTSCREEN, RIGH‐
53       TALT, BREAK, BREAK_ALTERNATIVE, HOME,  CURSORBLOCKUP,  PAGEUP,  CURSOR‐
54       BLOCKLEFT,  CURSORBLOCKRIGHT,  END,  CURSORBLOCKDOWN, PAGEDOWN, INSERT,
55       and REMOVE.
56
57

SEE ALSO

59       svgalib(7), vgagl(7), libvga.config(5), keytest(6), eventtest(6),  key‐
60       board_init(3),   keyboard_init_return_fd(3),   keyboard_close(3),  key‐
61       board_getstate(3), keyboard_keypressed(3), keyboard_clearstate(3), key‐
62       board_translatekeys(3),  keyboard_update(3), keyboard_waitforupdate(3),
63       vga_waitevent(3)
64
65

AUTHOR

67       This manual page was edited  by  Michael  Weller  <eowmob@exp-math.uni-
68       essen.de>.  The  exact  source of the referenced function as well as of
69       the original documentation is unknown.
70
71       It is very likely that both are at least to some extent are due to Harm
72       Hanemaayer <H.Hanemaayer@inter.nl.net>.
73
74       Occasionally  this  might be wrong. I hereby asked to be excused by the
75       original author and will happily accept any additions or corrections to
76       this first version of the svgalib manual.
77
78
79
80Svgalib (>= 1.2.11)              27 July 1997      keyboard_seteventhandler(3)
Impressum