9.5 Keyboard Preferences
Xlib provides routines to control beep pitch and volume, key click, Shift-Lock mode, mouse acceleration, keyboard lights and keyboard auto-repeat. Not all servers will actually be able to control all of these parameters.
There are five routines that deal with the keyboard and pointer
preferences. XGetKeyboardControl() and
XChangeKeyboardControl() are the primary routines for
getting or setting all these preferences at once.
XAutoRepeatOff() and
XAutoRepeatOn() set the global keyboard auto-repeat
status but are not able to control the auto-repeat of individual keys as
XChangeKeyboardControl() can.
9.5.1 Setting Keyboard Preferences
XChangeKeyboardControl() uses the standard X
method of changing internal structure members. The
values argument to
XChangeKeyboardControl() specifies the structure
containing the desired values; the
value_mask argument specifies which members
in the structure specified in values should
replace the current settings. See the reference page for
XChangeKeyboardControl() in Volume Two,
Xlib Reference Manual, for a list of the mask
symbols.
Example 9-13 shows the
XKeyboardControl() structure.
Example 9-13. The XKeyboardControl() structure
typedef struct {
int key_click_percent;
int bell_percent;
int bell_pitch;
int bell_duration;
int led;
int led_mode; /* LedModeOn or LedModeOff */
int key;
int auto_repeat_mode; /* AutoRepeatModeOff, AutoRepeatModeOn,
* AutoRepeatModeDefault */
} XKeyboardControl;The following list describes each member of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access