Next Prev Up

# 14.3 Keyboard Control

The following paragraphs describe the CLX functions used to:

- Return or change keyboard controls
- Ring the keyboard bell
- Return or change the mapping of modifiers
- Return the current up/down state of all keys

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

| 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))

change-keyboard-control | display &key :key-click-percent :bell-percent :bell-pitch :bell-duration :led :led-mode :key :auto-repeat-mode | Function

| 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 .

keyboard-control | display | Function

| 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.

modifier-mapping | display | Function

| 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.

query-keymap | display | Function

| 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 8 n. keymap Type bit-vector 256.

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

| 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 .

Next Prev Up

© 1988, 1989 Texas Instruments Incorporated
Conversion to HTML made by Gilbert Baumann.
Last build: Tue Dec 16 23:30:42 1997