1XChangeKeyboardControl(3)       XLIB FUNCTIONS       XChangeKeyboardControl(3)
2
3
4

NAME

6       XChangeKeyboardControl, XGetKeyboardControl, XAutoRepeatOn, XAutoRe‐
7       peatOff, XBell, XQueryKeymap, XKeyboardControl - manipulate keyboard
8       settings and keyboard control structure
9

SYNTAX

11       int XChangeKeyboardControl(Display *display, unsigned long value_mask,
12              XKeyboardControl *values);
13
14       int XGetKeyboardControl(Display *display, XKeyboardState *val‐
15              ues_return);
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

ARGUMENTS

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

DESCRIPTION

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

STRUCTURES

88       The XKeyboardControl structure contains:
89
90       /* Mask bits for ChangeKeyboardControl */
91
92       #define   KBKeyClickPercent           (1L<<0)
93       #define   KBBellPercent               (1L<<1)
94       #define   KBBellPitch                 (1L<<2)
95       #define   KBBellDuration              (1L<<3)
96       #define   KBLed                       (1L<<4)
97       #define   KBLedMode                   (1L<<5)
98       #define   KBKey                       (1L<<6)
99       #define   KBAutoRepeatMode            (1L<<7)
100       /* Values */
101
102       typedef struct {
103               int key_click_percent;
104               int bell_percent;
105               int bell_pitch;
106               int bell_duration;
107               int led;
108               int led_mode;   /* LedModeOn, LedModeOff */
109               int key;
110               int auto_repeat_mode;   /* AutoRepeatModeOff, AutoRepeatModeOn,
111                                       AutoRepeatModeDefault */
112       } XKeyboardControl;
113
114       The key_click_percent member sets the volume for key clicks between 0
115       (off) and 100 (loud) inclusive, if possible.  A setting of -1 restores
116       the default.  Other negative values generate a BadValue error.
117
118       The bell_percent sets the base volume for the bell between 0 (off) and
119       100 (loud) inclusive, if possible.  A setting of -1 restores the
120       default.  Other negative values generate a BadValue error.  The
121       bell_pitch member sets the pitch (specified in Hz) of the bell, if pos‐
122       sible.  A setting of -1 restores the default.  Other negative values
123       generate a BadValue error.  The bell_duration member sets the duration
124       of the bell specified in milliseconds, if possible.  A setting of -1
125       restores the default.  Other negative values generate a BadValue error.
126
127       If both the led_mode and led members are specified, the state of that
128       LED is changed, if possible.  The led_mode member can be set to LedMod‐
129       eOn or LedModeOff.  If only led_mode is specified, the state of all
130       LEDs are changed, if possible.  At most 32 LEDs numbered from one are
131       supported.  No standard interpretation of LEDs is defined.  If led is
132       specified without led_mode, a BadMatch error results.
133
134       If both the auto_repeat_mode and key members are specified, the
135       auto_repeat_mode of that key is changed (according to AutoRepeatModeOn,
136       AutoRepeatModeOff, or AutoRepeatModeDefault), if possible.  If only
137       auto_repeat_mode is specified, the global auto_repeat_mode for the
138       entire keyboard is changed, if possible, and does not affect the per-
139       key settings.  If a key is specified without an auto_repeat_mode, a
140       BadMatch error results.  Each key has an individual mode of whether or
141       not it should auto-repeat and a default setting for the mode.  In addi‐
142       tion, there is a global mode of whether auto-repeat should be enabled
143       or not and a default setting for that mode.  When global mode is
144       AutoRepeatModeOn, keys should obey their individual auto-repeat modes.
145       When global mode is AutoRepeatModeOff, no keys should auto-repeat.  An
146       auto-repeating key generates alternating KeyPress and KeyRelease
147       events.  When a key is used as a modifier, it is desirable for the key
148       not to auto-repeat, regardless of its auto-repeat setting.
149
150       The XKeyboardState structure contains:
151
152       typedef struct {
153               int key_click_percent;
154               int bell_percent;
155               unsigned int bell_pitch, bell_duration;
156               unsigned long led_mask;
157               int global_auto_repeat;
158               char auto_repeats[32];
159       } XKeyboardState;
160
161       For the LEDs, the least significant bit of led_mask corresponds to LED
162       one, and each bit set to 1 in led_mask indicates an LED that is lit.
163       The global_auto_repeat member can be set to AutoRepeatModeOn or AutoRe‐
164       peatModeOff.  The auto_repeats member is a bit vector.  Each bit set to
165       1 indicates that auto-repeat is enabled for the corresponding key.  The
166       vector is represented as 32 bytes.  Byte N (from 0) contains the bits
167       for keys 8N to 8N + 7 with the least significant bit in the byte repre‐
168       senting key 8N.
169

DIAGNOSTICS

171       BadMatch  Some argument or pair of arguments has the correct type and
172                 range but fails to match in some other way required by the
173                 request.
174
175       BadValue  Some numeric value falls outside the range of values accepted
176                 by the request.  Unless a specific range is specified for an
177                 argument, the full range defined by the argument's type is
178                 accepted.  Any argument defined as a set of alternatives can
179                 generate this error.
180

SEE ALSO

182       XChangeKeyboardMapping(3), XkbChangeEnabledControls(3), XkbBell(3),
183       XkbDeviceBell(3), XkbGetMap(3), XSetPointerMapping(3)
184       Xlib - C Language X Interface
185
186
187
188X Version 11                     libX11 1.6.7        XChangeKeyboardControl(3)
Impressum