forked from drinkmilk/directvnc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirectvnc-kbmapping.7
135 lines (109 loc) · 4.67 KB
/
directvnc-kbmapping.7
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
.TH directvnc-kbmapping 7 "Jul 30, 2011"
.SH NAME
directvnc-kbmapping - Details of keyboard mapping file syntax for directvnc(1)
.SH Xmodmap Keyboard Layout File Syntax
General syntax of the xmodmap keyboard layout file is described in the
xmodmap(1x) manual page. For the purposes of keyboard switching implementation
in directvnc, the following subset of its syntax is used:
Comments (lines starting with an exclamation mark) are recognized as such, and
ignored Expressions using keycode are recognized with up to four keysym values,
used as described in the mentioned manual page Other xmodmap expressions will
be ignored. So, the following is a valid syntax of an xmodmap file that can be
converted into a directvnc keyboard layout file:
.br
Key Base Shift Mode Mode+Shift
.br
.br
keycode 13 = 4 dollar 4 quotedbl
.br
keycode 14 = 5 percent 5 colon
.br
keycode 15 = 6 asciicircum 6 comma
.br
keycode 16 = 7 ampersand 7 period
.br
keycode 24 = q Q Cyrillic_shorti Cyrillic_SHORTI
.br
keycode 25 = w W Cyrillic_tse Cyrillic_TSE
.br
keycode 26 = e E Cyrillic_u Cyrillic_U
.br
keycode 27 = r R Cyrillic_ka Cyrillic_KA
An example of a xmodmap file for Cyrillic input can be found ????
.SH Directvnc Keyboard Layout File Syntax
The xmodmap file uses character identifiers to identify keysyms that keycodes
will be translated to. While this works in the original xmodmap program which
acts as a client to the X server it loads keyboard layout into (xmodmap queries
the X server to convert symbolic keysym identifiers into numeric), directvnc is
not supposed to interact with the remote Xvnc server this way. Instead, a
derivative format is used, which contains hexadecimal codes for keysyms:
keycode 13 0x034 0x024 0x034 0x022
.br
keycode 14 0x035 0x025 0x035 0x03a
.br
keycode 15 0x036 0x05e 0x036 0x02c
.br
keycode 16 0x037 0x026 0x037 0x02e
.br
keycode 24 0x071 0x051 0x6ca 0x6ea
.br
keycode 25 0x077 0x057 0x6c3 0x6e3
.br
keycode 26 0x065 0x045 0x6d5 0x6f5
.br
keycode 27 0x072 0x052 0x6cb 0x6eb
.br
keycode 28 0x074 0x054 0x6c5 0x6e5
.br
keycode 29 0x079 0x059 0x6ce 0x6ee
.br
keycode 30 0x075 0x055 0x6c7 0x6e7
The keycode keyword does not play any role at the moment, but is preserved for
the future extensions, when other xmodmap expressions may also be recognized.
.SH Conversion From One to Another
As noted above, directvnc does not query the remote Xvnc server for keysyms'
numeric values. There is the keysymdef.h include file which contains all the
necessary information. In particular, considering this (a small portion of the
keysymdef.h file):
#define XK_Q 0x051
.br
#define XK_q 0x071
.br
#define XK_Cyrillic_shorti 0x6ca
.br
#define XK_Cyrillic_SHORTI 0x6ea
it becomes clear how to convert
keycode 24 = q Q Cyrillic_shorti Cyrillic_SHORTI
into
keycode 24 0x071 0x051 0x6ca 0x6ea
The directvnc-xmapconv(1) utility reads an xmodmap syntax file from standard
input, and writes the directvnc compatible syntax file to standard output.
Inside, the script
runs its standard input through the C preprocessor including the keysymdef.h
file and prepending each keysym identifier with XK_. The directvnc keyboard
layout file mentioned earlier was produced exactly this way out of the xmodmap
file for Cyrillic input.
.SH Key Modifiers Logic
The directvnc's keyboard layout switching module holds an internal table where
the contents of the keyboard layout file is read into. The module intercepts
all keyboard input obtained from DirectFB, and uses keyboard scan code plus 8
(also known as the
.B MIN_KEYCODE
constant) as index into that table to determine whether any mapping exists for
a given keycode.
The directvnc's keyboard layout switching module uses the ScrollLock key as
mode lock: when its LED is on, the third or fourth keysym would be transmitted
(depending on the Shift and CapsLock status); when Scroll lock LED is off, the
first or the second keysym would be transmitted.
The Alt or AltGr keys are not used to control keyboard mode.
For letters, Shift and CapsLock are XORed. For numbers, CapsLock does not
apply.
If Ctrl is pressed, or there was no keyboard layout file specified, or the
keyboard layout file does not contain any mapping for a given keycode,
directvnc performs its default translation of keyboard code into a keysym using
its hardcoded ISO-8859-1 translation table.
.SH SEE ALSO
directvnc(1), directvnc-xmapconv(1), xmodmap(1)
.SH AUTHOR
Dimitry Golubovsky, Loris Boillet
.br