File: keyboard_seteventhandler.3

package info (click to toggle)
svgalib 1%3A1.4.3-33
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,012 kB
  • sloc: ansic: 60,381; makefile: 1,138; asm: 630; sh: 86; perl: 54; pascal: 49
file content (145 lines) | stat: -rw-r--r-- 3,903 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
.TH keyboard_seteventhandler 3 "27 July 1997" "Svgalib (>= 1.2.11)" "Svgalib User Manual"
.SH NAME
keyboard_seteventhandler, keyboard_setdefaulteventhandler \- define an event handler for keyboard events in raw mode
.SH SYNOPSIS

.B "#include <vgakeyboard.h>"

.BI "typedef void (*" __keyboard_handler ") (int " scancode ", int " press ");"

.BI "void keyboard_seteventhandler(__keyboard_handler " handler ");"
.br
.BI "void keyboard_setdefaulteventhandler(void);"

.SH DESCRIPTION
These functions allow to define a keyboard event handler which is called by
.BR keyboard_update "(3) and "
.BR keyboard_waitforupdate (3)
when a keyboard event occured.

.I press
is
.BR KEY_EVENTRELEASE " or " KEY_EVENTPRESS
if key
.I 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
.BR "<Alt>-F*" " or " "<Ctrl>-C"
for console switches or generation of
.BR SIGINT
if allowed by
.BR keyboard_translatekeys (3).

Calling
.B keyboard_setdefaulteventhandler()
reinstates the default handler which maintains the tables used by
.BR keyboard_getstate "(3) and "
.BR keyboard_keypressed (3).
It is probably a good idea to call
.BR keyboard_clearstate (3)
after reenabling the default handler.

Here are the supported scancodes. The names of the
.B #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
.BR SCANCODE_
in front of the names to get the right name for your C source. That means, if it lists
.BR BACKSLASH
below, you shall use
.BR SCANCODE_BACKSLASH
as symbol in your program. In addition to the names below we also have
.BR SCANCODE_0 " - " SCANCODE_9 ", "
.BR SCANCODE_KEYPAD0 " - " SCANCODE_KEYPAD9 ", "
.BR SCANCODE_A " - " SCANCODE_Z ", and "
.BR SCANCODE_F1 " - " SCANCODE_F12 "."

The other key names are
.BR ESCAPE ", "
.BR MINUS ", "
.BR EQUAL ", "
.BR BACKSPACE ", "
.BR TAB ", "
.BR BRACKET_LEFT ", "
.BR BRACKET_RIGHT ", "
.BR ENTER ", "
.BR LEFTCONTROL ", "
.BR SEMICOLON ", "
.BR APOSTROPHE ", "
.BR GRAVE ", "
.BR LEFTSHIFT ", "
.BR BACKSLASH ", "
.BR COMMA ", "
.BR PERIOD ", "
.BR SLASH ", "
.BR RIGHTSHIFT ", "
.BR KEYPADMULTIPLY ", "
.BR LEFTALT ", "
.BR SPACE ", "
.BR CAPSLOCK ", "
.BR NUMLOCK ", "
.BR SCROLLLOCK ", "
.BR CURSORUPLEFT ", "
.BR CURSORUP ", "
.BR CURSORUPRIGHT ", "
.BR KEYPADMINUS ", "
.BR CURSORLEFT ", "
.BR CURSORRIGHT ", "
.BR KEYPADPLUS ", "
.BR CURSORDOWNLEFT ", "
.BR CURSORDOWN ", "
.BR CURSORDOWNRIGHT ", "
.BR KEYPADPERIOD ", "
.BR LESS ", "
.BR KEYPADENTER ", "
.BR RIGHTCONTROL ", "
.BR CONTROL ", "
.BR KEYPADDIVIDE ", "
.BR PRINTSCREEN ", "
.BR RIGHTALT ", "
.BR BREAK ", "
.BR BREAK_ALTERNATIVE ", "
.BR HOME ", "
.BR CURSORBLOCKUP ", "
.BR PAGEUP ", "
.BR CURSORBLOCKLEFT ", "
.BR CURSORBLOCKRIGHT ", "
.BR END ", "
.BR CURSORBLOCKDOWN ", "
.BR PAGEDOWN ", "
.BR INSERT ", and "
.BR REMOVE "."

.SH SEE ALSO

.BR svgalib (7),
.BR vgagl (7),
.BR libvga.config (5),
.BR keytest (6),
.BR eventtest (6),
.BR keyboard_init (3),
.BR keyboard_init_return_fd (3),
.BR keyboard_close (3),
.BR keyboard_getstate (3),
.BR keyboard_keypressed (3),
.BR keyboard_clearstate (3),
.BR keyboard_translatekeys (3),
.BR keyboard_update (3),
.BR keyboard_waitforupdate (3),
.BR vga_waitevent (3)

.SH AUTHOR

This manual page was edited by Michael Weller <eowmob@exp-math.uni-essen.de>. The
exact source of the referenced function as well as of the original documentation is
unknown.

It is very likely that both are at least to some extent are due to
Harm Hanemaayer <H.Hanemaayer@inter.nl.net>.

Occasionally this might be wrong. I hereby
asked to be excused by the original author and will happily accept any additions or corrections
to this first version of the svgalib manual.