Next: , Previous: , Up: Control Functions   [Contents][Index]


15.3 Keyboard Control

The following paragraphs describe the CLX functions used to:

Function: bell display &optional (percent-from-normal 0)
display

A display.

percent-from-normal

An integer (-100 through 100).

Rings the bell on the keyboard at a volume relative to the base volume for the keyboard, if possible. Percent can range from -100 to 100 inclusive, or else a Value error occurs. The following is the bell volume when percent is non-negative:

(- (+ base percent) (quotient (* base percent) 100))

and when percent is negative:

(+ base (quotient (* base percent) 100))
Function: change-keyboard-control display &key :key-click-percent :bell-percent :bell-pitch :bell-duration :led :led-mode :key :auto-repeat-mode
display

A display.

:key-click-percent

An integer (0 100).

:bell-percent

An integer (0 100).

:bell-pitch

A card16.

:bell-duration

A card16.

:led

A card8.

:led-mode

Either :on or :off.

:key

A card8 keycode.

:auto-repeat-mode

Either :on, :off, or :default.

Changes the various aspects of the keyboard. The keyword arguments specify which controls to change.

The :key-click-percent keyword sets the volume for key clicks, if possible. A value of 0 implies off, while a value of 100 implies loud. Setting :key-click-percent to :default restores the default value.

The :bell-percent sets the base volume for the bell between 0 (off) and 100 (loud) if possible. Setting :bell-percent to :default restores the default value.

The :bell-pitch sets the pitch (specified in Hz) of the bell, if possible. Setting the :bell-pitch to :default restores the default value. The :bell-duration sets the duration ( specified in milliseconds) of the bell, if possible. Setting :bell-pitch to :default restores the default. Note that a bell generator connected with the console but not directly on the keyboard is treated as if it were part of the keyboard.

If both :led-mode and :led are specified, then the state of that LED is changed, if possible. If only :led-mode is specified, the state of all LEDs are changed, if possible. At most 32 LEDs are supported, numbered from one. No standard interpretation of the LEDs are defined.

If both :auto-repeat-mode and :key are specified, the auto-repeat mode of that key is changed, if possible. If only :auto-repeat-mode is specified, the global auto-repeat mode for the entire keyboard is changed, if possible, without affecting the per-key settings. An error occurs if :key is specified without :auto-repeat-mode.

Function: keyboard-control display
display

A display.

Returns the current control values for the keyboard. For the LEDs, the least significant bit of led-mask corresponds to LED one, and each one bit in led-mask indicates an LED that is lit. auto-repeats is a bit vector; each one bit indicates that auto-repeat is enabled for the corresponding key. The vector is represented as 32 bytes. Byte n (from 0) contains the bits for keys 8n to 8n+7, with the least significant bit in the byte representing key 8n.

key-click-percent
bell-percent

Type card8.

bell-pitch
bell-duration

Type card16.

led-mask

Type card32.

global-auto-repeat

Either :on or :off.

auto-repeats

Type bit-vector.

Function: modifier-mapping display
display

A display.

Returns the set of keycodes used for each modifier on the display keyboard. Each return value is a list of the card8 keycodes used for each modifier key. The order of keycodes within each list is server-dependent.

shift-keycodes
lock-keycodes
control-keycodes
mod1-keycodes
mod2-keycodes
mod3-keycodes
mod4-keycodes
mod5-keycodes

Type list of card8.

Some servers may include the same keycode in more than one list. For example, if the CAPS LOCK key has been turned into an additional CONTROL key, some servers include it in the third return value, but also in the second return value. Client code can therefore not rely on the returned lists to have pairwise empty intersections.

Function: query-keymap display
display

A display.

Returns a bit vector that describes the state of the keyboard. Each one bit indicates that the corresponding key is currently pressed. The vector is represented as 32 bytes. Byte n (from 0) contains the bits for keys 8n to 8n+7, with the least significant bit in the byte representing key 8n.

keymap

Type bit-vector 256.

Function: set-modifier-mapping display &key :shift :lock :control :mod1 :mod2 :mod3 :mod4 :mod5
display

A display.

:shift
:lock
:control
:mod1
:mod2
:mod3
:mod4
:mod5

A sequence of card8 keycodes for the given modifier.

Changes the set of keycodes mapped to the specified modifier keys on the display keyboard. Each keyword argument contains a sequence of new card8 keycodes for a specific modifier. The return value indicates whether the change was completed successfully.

A status of :failed is returned if hardware limitations prevent the requested change. For example, multiple keycodes per modifier may not be supported, up transitions on a given keycode may not be supported, or autorepeat may be mandatory for a given keycode. If :failed is returned, the mappings for all modifiers remain unchanged.

A status of :device-busy is returned if a new keycode given for a modifier was not previously mapped to that modifier and is currently in the down state. In this case, the mappings for all modifiers remain unchanged.

status

One of :success, :failed, or :device-busy.

Notice that the default value for each of the key arguments is the empty list. Failing to include a key argument in a call to this function will therefore remove all the keycodes as modifiers that were previously considered modifiers in the category corresponding to the keyword argument.


Next: , Previous: , Up: Control Functions   [Contents][Index]