1XChangeKeyboardControl(3) XLIB FUNCTIONS XChangeKeyboardControl(3)
2
3
4
6 XChangeKeyboardControl, XGetKeyboardControl, XAutoRepeatOn, XAutoRe‐
7 peatOff, XBell, XQueryKeymap, XKeyboardControl - manipulate keyboard
8 settings and keyboard control structure
9
11 int XChangeKeyboardControl(Display *display, unsigned long value_mask,
12 XKeyboardControl *values);
13
14 int XGetKeyboardControl(Display *display, XKeyboardState *values_re‐
15 turn);
16
17 int XAutoRepeatOn(Display *display);
18
19 int XAutoRepeatOff(Display *display);
20
21 int XBell(Display *display, int percent);
22
23 int XQueryKeymap(Display *display, char keys_return[32]);
24
26 display Specifies the connection to the X server.
27
28 keys_return
29 Returns an array of bytes that identifies which keys are
30 pressed down. Each bit represents one key of the keyboard.
31
32 percent Specifies the volume for the bell, which can range from -100
33 to 100 inclusive.
34
35 value_mask
36 Specifies which controls to change. This mask is the bitwise
37 inclusive OR of the valid control mask bits.
38
39 values Specifies one value for each bit set to 1 in the mask.
40
41 values_return
42 Returns the current keyboard controls in the specified XKey‐
43 boardState structure.
44
46 The XChangeKeyboardControl function controls the keyboard characteris‐
47 tics defined by the XKeyboardControl structure. The value_mask argu‐
48 ment specifies which values are to be changed.
49
50 XChangeKeyboardControl can generate BadMatch and BadValue errors.
51
52 The XGetKeyboardControl function returns the current control values for
53 the keyboard to the XKeyboardState structure.
54
55 The XAutoRepeatOn function turns on auto-repeat for the keyboard on the
56 specified display.
57
58 The XAutoRepeatOff function turns off auto-repeat for the keyboard on
59 the specified display.
60
61 The XBell function rings the bell on the keyboard on the specified dis‐
62 play, if possible. The specified volume is relative to the base volume
63 for the keyboard. If the value for the percent argument is not in the
64 range -100 to 100 inclusive, a BadValue error results. The volume at
65 which the bell rings when the percent argument is nonnegative is:
66
67 base - [(base * percent) / 100] + percent
68
69 The volume at which the bell rings when the percent argument is nega‐
70 tive is:
71
72 base + [(base * percent) / 100]
73
74 To change the base volume of the bell, use XChangeKeyboardControl.
75
76 XBell can generate a BadValue error.
77
78 The XQueryKeymap function returns a bit vector for the logical state of
79 the keyboard, where each bit set to 1 indicates that the corresponding
80 key is currently pressed down. The vector is represented as 32 bytes.
81 Byte N (from 0) contains the bits for keys 8N to 8N + 7 with the least
82 significant bit in the byte representing key 8N.
83
84 Note that the logical state of a device (as seen by client applica‐
85 tions) may lag the physical state if device event processing is frozen.
86
88 The XKeyboardControl structure contains:
89
90 /* Mask bits for ChangeKeyboardControl */
91
92 #de‐ KBKeyClickPercent (1L<<0)
93 fine
94 #de‐ KBBellPercent (1L<<1)
95 fine
96 #de‐ KBBellPitch (1L<<2)
97 fine
98 #de‐ KBBellDuration (1L<<3)
99 fine
100 #de‐ KBLed (1L<<4)
101 fine
102 #de‐ KBLedMode (1L<<5)
103 fine
104 #de‐ KBKey (1L<<6)
105 fine
106 #de‐ KBAutoRepeatMode (1L<<7)
107 fine
108 /* Values */
109
110 typedef struct {
111 int key_click_percent;
112 int bell_percent;
113 int bell_pitch;
114 int bell_duration;
115 int led;
116 int led_mode; /* LedModeOn, LedModeOff */
117 int key;
118 int auto_repeat_mode; /* AutoRepeatModeOff, AutoRepeatModeOn,
119 AutoRepeatModeDefault */
120 } XKeyboardControl;
121
122 The key_click_percent member sets the volume for key clicks between 0
123 (off) and 100 (loud) inclusive, if possible. A setting of -1 restores
124 the default. Other negative values generate a BadValue error.
125
126 The bell_percent sets the base volume for the bell between 0 (off) and
127 100 (loud) inclusive, if possible. A setting of -1 restores the de‐
128 fault. Other negative values generate a BadValue error. The
129 bell_pitch member sets the pitch (specified in Hz) of the bell, if pos‐
130 sible. A setting of -1 restores the default. Other negative values
131 generate a BadValue error. The bell_duration member sets the duration
132 of the bell specified in milliseconds, if possible. A setting of -1
133 restores the default. Other negative values generate a BadValue error.
134
135 If both the led_mode and led members are specified, the state of that
136 LED is changed, if possible. The led_mode member can be set to LedMod‐
137 eOn or LedModeOff. If only led_mode is specified, the state of all
138 LEDs are changed, if possible. At most 32 LEDs numbered from one are
139 supported. No standard interpretation of LEDs is defined. If led is
140 specified without led_mode, a BadMatch error results.
141
142 If both the auto_repeat_mode and key members are specified, the
143 auto_repeat_mode of that key is changed (according to AutoRepeatModeOn,
144 AutoRepeatModeOff, or AutoRepeatModeDefault), if possible. If only
145 auto_repeat_mode is specified, the global auto_repeat_mode for the en‐
146 tire keyboard is changed, if possible, and does not affect the per-key
147 settings. If a key is specified without an auto_repeat_mode, a Bad‐
148 Match error results. Each key has an individual mode of whether or not
149 it should auto-repeat and a default setting for the mode. In addition,
150 there is a global mode of whether auto-repeat should be enabled or not
151 and a default setting for that mode. When global mode is AutoRepeat‐
152 ModeOn, keys should obey their individual auto-repeat modes. When
153 global mode is AutoRepeatModeOff, no keys should auto-repeat. An auto-
154 repeating key generates alternating KeyPress and KeyRelease events.
155 When a key is used as a modifier, it is desirable for the key not to
156 auto-repeat, regardless of its auto-repeat setting.
157
158 The XKeyboardState structure contains:
159
160 typedef struct {
161 int key_click_percent;
162 int bell_percent;
163 unsigned int bell_pitch, bell_duration;
164 unsigned long led_mask;
165 int global_auto_repeat;
166 char auto_repeats[32];
167 } XKeyboardState;
168
169 For the LEDs, the least significant bit of led_mask corresponds to LED
170 one, and each bit set to 1 in led_mask indicates an LED that is lit.
171 The global_auto_repeat member can be set to AutoRepeatModeOn or AutoRe‐
172 peatModeOff. The auto_repeats member is a bit vector. Each bit set to
173 1 indicates that auto-repeat is enabled for the corresponding key. The
174 vector is represented as 32 bytes. Byte N (from 0) contains the bits
175 for keys 8N to 8N + 7 with the least significant bit in the byte repre‐
176 senting key 8N.
177
179 BadMatch Some argument or pair of arguments has the correct type and
180 range but fails to match in some other way required by the
181 request.
182
183 BadValue Some numeric value falls outside the range of values accepted
184 by the request. Unless a specific range is specified for an
185 argument, the full range defined by the argument's type is
186 accepted. Any argument defined as a set of alternatives can
187 generate this error.
188
190 XChangeKeyboardMapping(3), XkbChangeEnabledControls(3), XkbBell(3),
191 XkbDeviceBell(3), XkbGetMap(3), XSetPointerMapping(3)
192 Xlib - C Language X Interface
193
194
195
196X Version 11 libX11 1.7.2 XChangeKeyboardControl(3)