int XSetModifierMapping(display, modmap)
        Display *display;
        XModifierKeymap *modmap;


display Specifies the connection to the X server.
modmap Specifies the XModifierKeymap structure.


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 contains 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 of the nonzero KeyCodes must be in the range specified by min_keycode and max_keycode in the Display structure, 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 supported. If some such restriction is violated, the status reply 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, XSetModifierMapping() returns MappingBusy, and none of the modifiers is changed.

XSetModifierMapping() can generate BadAlloc and BadValue errors.


BadAlloc The server failed to allocate the requested source or server memory.

See also

XChangeKeyboardMapping(), XDeleteModifiermapEntry(), XDisplayKeycodes(), XFree(), XFreeModifiermap(), XGetKeyboardMapping(), XGetModifierMapping(), XInsertModifiermapEntry(), XNewModifiermap(), XSetPointerMapping(), "Keyboard Encoding".
Christophe Tronche, [email protected]