1keyboard_translatekeys(3) Svgalib User Manual keyboard_translatekeys(3)
2
3
4
6 keyboard_translatekeys - modify scancode mappings in raw keyboard mode
7
9 #include <vgakeyboard.h>
10
11 void keyboard_translatekeys(int mask);
12
13
15 This function sets several flags which control how certain scancodes
16 are mapped. At startup a mask value of 0 is active.
17
18 mask must be a logical or of zero or more of the following #predefined
19 integers to turn the features listed on:
20
21
22 TRANSLATE_CURSORKEYS
23 Translate the scancodes of the SCANCODE_CURSORBLOCK* keys to
24 those of the cursor keys on the number pad, s.t. keyboard_get‐
25 state(3) and keyboard_keypressed(3) report a keypress of the
26 corresponding number pad cursor key and not the one on the cur‐
27 sor block.
28
29 TRANSLATE_DIAGONAL
30 Translates the scancodes of diagonal cursor keys (keypad 7, 9,
31 1, 3) to presses of two of the ordinary up, down, left, right
32 keys. For example, instead of reporting a press of SCANCODE_CUR‐
33 SORUPRIGHT keyboard_getstate(3) and keyboard_keypressed(3)
34 report a simultaneous press of SCANCODE_CURSORUP and SCAN‐
35 CODE_CURSORRIGHT.
36
37 TRANSLATE_KEYPADENTER
38 The scancode of the keypad enter key is mapped to that of the
39 ordinary enter key, s.t. keyboard_getstate(3) and keyboard_key‐
40 pressed(3) report a press of SCANCODE_ENTER regardless if keypad
41 enter or ordinary enter is pressed.
42
43 DONT_CATCH_CTRLC
44 Pressing <Ctrl>-C does not raise a SIGINT. On contrary to the
45 other flags this has also effect when a user defined keyboard
46 event handler is used. Svgalib will always process <Alt>-F1 -
47 <Alt>-F10 and perform console switches accordingly.
48
49
51 The TRANSLATE_* options above do really do simple scancode transla‐
52 tions. For example, when TRANSLATE_KEYPADENTER is active and the user
53 presses both enter and keypad enter. Then, if he releases one of them
54 (say keypad enter), it's release event will clear the common keyboard
55 state, s.t. no keypress is reported even though enter is still
56 pressed.
57
58 Similarly, if TRANSLATE_DIAGONAL is active, the user holds cursor
59 upleft (keypad 7) down and then presses and release cursor up (keypad
60 8), svgalib will only report a pressed cursor left but the simulated
61 cursor up will be lost. You can easily try this with the keytest(6)
62 demo to make the effect more clear to you.
63
64
66 svgalib(7), vgagl(7), libvga.config(5), keytest(6), eventtest(6), key‐
67 board_seteventhandler(3), keyboard_init(3), keyboard_init_return_fd(3),
68 keyboard_close(3), keyboard_update(3), keyboard_waitforupdate(3), key‐
69 board_setdefaulteventhandler(3), keyboard_getstate(3), key‐
70 board_clearstate(3), keyboard_keypressed(3), vga_waitevent(3)
71
72
74 This manual page was edited by Michael Weller <eowmob@exp-math.uni-
75 essen.de>. The exact source of the referenced function as well as of
76 the original documentation is unknown.
77
78 It is very likely that both are at least to some extent are due to Harm
79 Hanemaayer <H.Hanemaayer@inter.nl.net>.
80
81 Occasionally this might be wrong. I hereby asked to be excused by the
82 original author and will happily accept any additions or corrections to
83 this first version of the svgalib manual.
84
85
86
87Svgalib (>= 1.2.11) 29 July 1997 keyboard_translatekeys(3)