Name

MappingNotify — (generated event).

When Generated

A MappingNotify event is sent when any of the following is changed by another client: the mapping between physical keyboard keys (keycodes) and keysyms, the mapping between modifier keys and logical modifiers, or the mapping between physical and logical pointer buttons. These events are triggered by a call to XSetModifierMapping() or XSetPointerMapping(), if the return status is MappingSuccess, or by any call to XChangeKeyboardMapping().

This event type should not be confused with the event that occurs when a window is mapped; that is a MapNotify event. Nor should it be confused with the KeymapNotify event, which reports the state of the keyboard as a mask instead of as a keycode.

Select With

The X server sends MappingNotify events to all clients. It is never selected and cannot be masked with the window attributes.

XEvent Structure Name

typedef union _XEvent {
   ...
   XMappingEvent xmapping;
   ...
} XEvent;

Event Structure

typedef struct {
   int type;
   unsigned long serial;   /* # of last request processed by server */
   Bool send_event;   /* True if this came from SendEvent request */
   Display *display;   /* Display the event was read from */
   Window window;   /* unused */
   int request;   /* one of MappingMapping, MappingKeyboard, 
       * MappingPointer */
   int first_keycode;   /* first keycode */
   int count;   /* range of change with first_keycode*/
} XMappingEvent;

Event Structure Members

request 

The kind of mapping change that occurred: MappingModifier for a successful XSetModifierMapping (keyboard Shift, Lock, Control, Meta keys), MappingKeyboard for a successful XChangeKeyboardMapping (other keys), and MappingPointer for a successful XSetPointerMapping (pointer button numbers).

first_keycode 

If the request member is MappingKeyboard or MappingModifier, then first_keycode indicates the first in a range of keycodes with altered mappings. Otherwise, it is not set.

count 

If the request member is MappingKeyboard or MappingModifier, then count indicates the number of keycodes with altered mappings. Otherwise, it is not set.

Notes

If the request member is MappingKeyboard, clients should call XRefreshKeyboardMapping.

The normal response to a request member of MappingPointer or MappingModifier is no action. This is because the clients should use the logical mapping of the buttons and modifiers to allow the user to customize the keyboard if desired. If the application requires a particular mapping regardless of the user's preferences, it should call XGetModifierMapping or XGetPointerMapping to find out about the new mapping.