14.4.2 Keyboard Mapping

The X server maintains a keyboard mapping that associates each keycode with one or more keysyms. The following paragraphs describe the CLX functions used to return or change the mapping of keycodes.



change-keyboard-mapping display keysyms &key (:start 0) :end (:first-keycode :start) Function
        
display
A display.
keysyms
A two-dimensional array of keysym (card32) values.
:start, :end
Indexes for the subsequence of keysyms used.
:first-keycode
A card8 defining the first keycode mapping changed.

Changes the mapping of keycodes to keysyms. A :mapping-notify event is generated for all clients.

The new keysyms are specified as a two-dimensional array in which:

(aref keysyms (+ :start i) j)

is keysym j associated with keycode (+ :first-keycode i). The maximum number of keysyms associated with any one keycode is given by:

(array-dimension keysyms 1)

keysyms should contain nil elements to represent those keysyms that are undefined for a given keycode. :start and :end define the subsequence of the keysyms array that defines the new mapping, and the number of keycode mappings changed. By default, :end is given by:

(array-dimension keysyms 0)

The keycodes whose mappings are changed are given by :first-keycode through the following:

(+ :first-keycode (- :end :start) -1)

keycodes outside this range of are not affected. :first-keycode must not be less than (display-min-keycode display), and the last keycode modified must not be greater than (display-max-keycode display).



keyboard-mapping display &key :first-keycode :start :end :data Function
        
display
A display.
:first-keycode
A card8 defining the first keycode mapping returned.
:start, :end
Indexes for the subsequence of the returned array which is modified.
:data
If given, a two-dimensional array to receive the returned keysyms.

Returns the keysyms mapped to the given range of keycodes for the display keyboard. The mappings are returned in the form of a two-dimensional array of card32 keysym values. The :data argument, if given, must be a two-dimensional array in which the returned mappings will be stored. In this case:

(array-dimension :data 1)

defines the maximum number of keysyms returned for any keycode. Otherwise, a new array is created and returned.

Upon return:

(aref mappings (+ :start i) j)

will contain keysym j associated with keycode (+ :first-keycode i) (or nil, if keysym j is undefined for that keycode).

:first-keycode specifies the first keycode whose mapping is returned; by default, :first-keycode is (display-min-keycode display). :start and :end define the subsequence of the returned array in which the returned mappings are stored. By default, :start is given by :first-keycode and :end is given by:

(1+ (display-max-keycode display))

:first-keycode must not be less than (display-min-keycode display), and the last keycode returned must not be greater than (display-max-keycode display).

mappings
Type (array card32 (* *)).