1XGetDeviceKeyMapping(3) X FUNCTIONS XGetDeviceKeyMapping(3)
2
3
4
6 XGetDeviceKeyMapping, XChangeDeviceKeyMapping - query or change device
7 key mappings
8
10 int XChangeDeviceKeyMapping(Display *display, XDevice *device, int
11 first_keycode, int keysyms_per_keycode, KeySym *keysyms, int key‐
12 code_count);
13
14 KeySym *XGetDeviceKeyMapping(Display *display, XDevice *device, KeyCode
15 first_keycode, int keycode_count, int *keysyms_per_key‐
16 code_return);
17
18
20 display Specifies the connection to the X server.
21
22 device Specifies the device whose key mapping is to be queried or
23 modified.
24
25 first_keycode
26 Specifies the first KeyCode to be returned.
27
28 keycode_count
29 Specifies the number of KeyCodes to be returned or modi‐
30 fied.
31
32 keysyms_per_keycode
33 Specifies the number of KeySyms per KeyCode.
34
35 keysyms_per_keycode_return
36 Specifies the address of a variable into which the number
37 of KeySyms per KeyCode will be returned.
38
39 keysyms Specifies the address of an array of KeySyms.
40
42 For the specified device, the XGetDeviceKeyMapping request returns the
43 symbols for the specified number of KeyCodes starting with first_key‐
44 code. The value specified in first_keycode must be greater than or
45 equal to min_keycode as returned by XListInputDevices, or a BadValue
46 error results. In addition, the following expression must be less than
47 or equal to max_keycode as returned by XListInputDevices:
48
49 first_keycode + keycode_count - 1
50
51 If this is not the case, a BadValue error results. The number of ele‐
52 ments in the KeySyms list is:
53
54 keycode_count * keysyms_per_keycode_return
55
56 KeySym number N, counting from zero, for KeyCode K has the following
57 index in the list, counting from zero: (K - first_code) *
58 keysyms_per_code_return + N
59
60 The X server arbitrarily chooses the keysyms_per_keycode_return value
61 to be large enough to report all requested symbols. A special KeySym
62 value of NoSymbol is used to fill in unused elements for individual
63 KeyCodes. To free the storage returned by XGetDeviceKeyMapping, use
64 XFree.
65
66 If the specified device does not support input class keys, a BadMatch
67 error will result.
68
69 XGetDeviceKeyMapping can generate a BadDevice, BadMatch, or BadValue
70 error.
71
72 For the specified device, the XChangeDeviceKeyMapping request defines
73 the symbols for the specified number of KeyCodes starting with
74 first_keycode. The symbols for KeyCodes outside this range remain
75 unchanged. The number of elements in keysyms must be:
76
77 num_codes * keysyms_per_keycode
78
79 The specified first_keycode must be greater than or equal to min_key‐
80 code returned by XListInputDevices, or a BadValue error results. In
81 addition, the following expression must be less than or equal to
82 max_keycode as returned by XListInputDevices, or a BadValue error
83 results:
84
85 first_keycode + num_codes - 1
86
87 KeySym number N, counting from zero, for KeyCode K has the following
88 index in keysyms, counting from zero:
89
90 (K - first_keycode) * keysyms_per_keycode + N
91
92 The specified keysyms_per_keycode can be chosen arbitrarily by the
93 client to be large enough to hold all desired symbols. A special
94 KeySym value of NoSymbol should be used to fill in unused elements for
95 individual KeyCodes. It is legal for NoSymbol to appear in nontrailing
96 positions of the effective list for a KeyCode. XChangeDeviceKeyMapping
97 generates a DeviceMappingNotify event that is sent to all clients that
98 have selected that type of event.
99
100 There is no requirement that the X server interpret this mapping. It
101 is merely stored for reading and writing by clients.
102
103 If the specified device does not support input class keys, a BadMatch
104 error results.
105
106 XChangeDeviceKeyMapping can generate a BadDevice, BadMatch, BadAlloc,
107 or BadValue error.
108
110 BadDevice An invalid device was specified. The specified device does
111 not exist or has not been opened by this client via XOpen‐
112 InputDevice. This error may also occur if the specified
113 device is the X keyboard or X pointer device.
114
115 BadMatch This error may occur if an XGetDeviceKeyMapping or
116 XChangeDeviceKeyMapping request was made specifying a
117 device that has no keys.
118
119 BadValue Some numeric value falls outside the range of values
120 accepted by the request. Unless a specific range is speci‐
121 fied for an argument, the full range defined by the argu‐
122 ment's type is accepted. Any argument defined as a set of
123 alternatives can generate this error.
124
125 BadAlloc The server failed to allocate the requested resource or
126 server memory.
127
129 XSetDeviceButtonMapping(3)
130 XSetDeviceModifierMapping(3)
131 Programming with Xlib
132
133
134
135X Version 11 libXi 1.1.1 XGetDeviceKeyMapping(3)