XChangeKeyboardMapping(3X) XChangeKeyboardMapping(3X)NAME XChangeKeyboardMapping, XDeleteModifiermapEntry, XDisplayKeycodes, XFreeModifierMap, XGetKeyboardMapping, XGetModifierMapping, XInsertModifiermapEntry, XNewModifierMap, XSetModifierMapping - manipulate keyboard encoding and the XModifierKeymap structure SYNOPSIS XChangeKeyboardMapping (display, first-keycode, keysyms-per-keycode, keysyms, num-codes) Display *display; int first-keycode; int keysyms-per-keycode; KeySym *keysyms; int num-codes; KeySym *XGetKeyboardMapping(display, first-keycode-wanted, keycode-count, keysyms-per-keycode-return) Display *display; KeyCode first-keycode-wanted; int keycode-count; int *keysyms-per-keycode-return; XDisplayKeycodes(display, min-keycodes-return, max- keycodes-return) Display *display; int *min-keycodes-return, *max-keycodes-return; int XSetModifierMapping(display, modmap) Display *display; XModifierKeymap *modmap; XModifierKeymap *XGetModifierMapping(display) Display *display; XModifierKeymap *XNewModifierMap(max-keys-per-mod) int max-keys-per-mod; XModifierKeymap *XInsertModifiermapEntry (modmap, keycode- entry, modifier) XModifierKeymap *modmap; KeyCode keycode-entry; int modifier; XModifierKeymap *XDeleteModifiermapEntry(modmap, keycode- entry, modifier) XModifierKeymap *modmap; KeyCode keycode-entry; int modifier; November, 1990 1
XChangeKeyboardMapping(3X) XChangeKeyboardMapping(3X)XFreeModifierMap(modmap) XModifierKeymap *modmap; DESCRIPTION The XChangeKeyboardMapping function, starting with first- keycode, defines the symbols for the specified number of keycodes. The symbols for keycodes outside this range remain unchanged. The number of elements in keysyms must be: num-codes * keysyms-per-keycode The specified first-keycode must be greater than or equal to min-keycode returned by XDisplayKeycodes, or a BadValue er- ror results. In addition, the following expression must be less than or equal to max-keycode as returned by XDisplayKeycodes, or a BadValue error results: first-keycode + num-codes - 1 Keysym number N, counting from 0, for keycode K has the fol- lowing index in keysyms, counting from 0: (K - first-keycode) * keysyms-per-keycode + N The specified keysyms-per-keycode can be chosen arbitrarily by the client to be large enough to hold all desired sym- bols. A special keysym value of NoSymbol should be used to fill in unused elements for individual keycodes. It is legal for NoSymbol to appear in nontrailing positions of the ef- fective list for a keycode. XChangeKeyboardMapping gen- erates a MappingNotify event. There is no requirement that the X server interpret this mapping. It is merely stored for reading and writing by clients. The XGetKeyboardMapping function, starting with first- keycode, returns the symbols for the specified number of keycodes. The value specified in first-keycode must be greater than or equal to min-keycode as returned by XDisplayKeycodes, or a BadValue error results. In addition, the following expression must be less than or equal to max- keycode as returned by XDisplayKeycodes: first-keycode + keycode-count - 1 If this is not the case, a BadValue error results. The number of elements in the keysyms list is: keycode-count * keysyms-per-keycode-return Keysym number N, counting from 0, for keycode K has the fol- 2 November, 1990
XChangeKeyboardMapping(3X) XChangeKeyboardMapping(3X)lowing index in the list, counting from 0: (K - first-code) * keysyms-per-code-return + N The X server arbitrarily chooses the keysyms-per-keycode- return value to be large enough to report all requested sym- bols. A special keysym value of NoSymbol is used to fill in unused elements for individual keycodes. To free the storage returned by XGetKeyboardMapping, use XFree. The XDisplayKeycodes function returns the minimum and max- imum number of keycodes supported by the specified display. The minimum number of keycodes returned is never less than 8, and the maximum number of keycodes returned is never greater than 255. Not all keycodes in this range are re- quired to have corresponding keys. The XSetModifierMapping function specifies the keycodes of the keys (if any) that are to be used as modifiers. If it succeeds, the X server generates a MappingNotify event, and XSetModifierMapping returns MappingSuccess. X permits at most eight modifier keys. If more than eight are specified in the XModifierKeymap structure, a BadLength error results. The modifiermap member of the XModifierKeymap structure con- tains eight sets of max_keypermod keycodes, one for each modifier in the order Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5. Only nonzero keycodes have meaning in each set, and zero keycodes are ignored. In addition, all nonzero keycodes must be in the range specified by min_keycode and max_keycode in the Display structure, or a BadValue error results. No keycode may appear twice in the entire map, or a BadValue error results. An X server can impose restrictions on how modifiers can be changed, for example, if certain keys do not generate ``up'' transitions in hardware, if auto-repeat cannot be disabled on certain keys, or if multiple modifier keys are not sup- ported. If some such restriction is violated, the status re- ply is MappingFailed, and none of the modifiers are changed. If the new keycodes specified for a modifier differ from those currently defined and any (current or new) keys for that modifier are in the logically ``down'' state, XSetModi- fierMapping returns MappingBusy, and none of the modifiers is changed. The XGetModifierMapping function returns a pointer to a new- ly created XModifierKeymap structure that contains the keys being used as modifiers. The structure should be freed after use by calling XFreeModifiermap. If only 0 values ap- pear in the set for any modifier, that modifier is disabled. November, 1990 3
XChangeKeyboardMapping(3X) XChangeKeyboardMapping(3X)The XNewModifiermap function returns a pointer to XModifi- erKeymap structure for later use. The XInsertModifiermapEntry function adds the specified key- code to the set that controls the specified modifier and re- turns the resulting XModifierKeymap structure (expanded as needed). The XDeleteModifiermapEntry function deletes the specified keycode from the set that controls the specified modifier and returns a pointer to the resulting XModifierKeymap structure. The XFreeModifiermap function frees the specified XModifi- erKeymap structure. Arguments These functions accept the following arguments: display Specifies the connection to the X server. first-keycode Specifies the first keycode to be changed or re- turned. keycode-count Specifies the number of keycodes to be returned. keycode-entry Specifies the keycode. keysyms Specifies a pointer to an array of keysyms. keysyms-per-keycode Specifies the keysyms per keycode. keysyms-per-keycode-return Returns the number of keysyms per keycode. max-keys-per-mod Specifies the maximum number of keycodes assigned to any of the modifiers in the map. max-keycodes-return Returns the maximum number of keycodes. min-keycodes-return Returns the minimum number of keycodes. modifier Specifies the modifier. 4 November, 1990
XChangeKeyboardMapping(3X) XChangeKeyboardMapping(3X)modmap Specifies a pointer to the XModifierKeymap structure. num-codes Specifies the number of keycodes to be changed. Structures The XModifierKeymap structure is defined as follows. typedef struct { int max_keypermod;/* This server's max number */ /* of keys per modifier */ KeyCode *modifiermap;/* An 8 by max_keypermod */ /* array of the modifiers */ } XModifierKeymap; ERRORS BadAlloc The server failed to allocate the requested resource or server memory. BadValue A numeric value falls outside the range of values accepted by the request. Unless a range is speci- fied for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error. XChangeKeyboardMapping and XSetModifierMapping can generate BadAlloc and BadValue errors. XGetKeyboardMapping can generate a BadValue error. SEE ALSO XFree(3X) XSetPointerMapping(3X)Xlib - C Language InterfaceNovember, 1990 5