XkbVirtualModsToReal - Determines the mapping of virtual modifiers to core X protocol modifiers


Bool XkbVirtualModsToReal (XkbDescPtr xkb , unsigned int virtual_mask , unsigned int * mask_rtrn );


  • - xkb
        keyboard description for input device
  • - virtual_mask
        virtual modifier mask to translate
  • - mask_rtrn
        backfilled with real modifiers


Xkb maintains a virtual modifier mapping,which lists the virtual modifiers associated with, or bound to, each key. The real modifiers bound to a virtual modifier always include all of the modifiers bound to any of the keys that specify that virtual modifier in their virtual modifier mapping. The server.vmodmaparray indicates which virtual modifiers are bound to each key; each entry is a bitmask for the virtual modifier bits. The server.vmodmaparray is indexed by keycode. The vmodmapand vmodsmembers of the server map are the "master" virtual modifier definitions. Xkb automatically propagates any changes to these fields to all other fields that use virtual modifier mappings. For example, if Mod3 is bound to the Num_Lock key by the core protocol modifier mapping, and the NumLock virtual modifier is bound to they Num_Lock key by the virtual modifier mapping, Mod3 is added to the set of modifiers associated with NumLock. The virtual modifier mapping is normally updated whenever actions are automatically applied to symbols and few applications should need to change the virtual modifier mapping explicitly. Use XkbGetMapto get the virtual modifiers from the server or use XkbGetVirtualModsto update a local copy of the virtual modifiers bindings from the server. To set the binding of a virtual modifier to a real modifier, use XkbGetVirtualMods If the keyboard description defined by xkbincludes bindings for virtual modifiers, XkbVirtualModsToRealuses those bindings to determine the set of real modifiers that correspond to the set of virtual modifiers specified in virtual_mask.The virtual_maskparameter is a mask specifying the virtual modifiers to translate; the i-th bit (0 relative) of the mask represents the i-th virtual modifier. If mask_rtrnis non-NULL, XkbVirtualModsToRealbackfills it with the resulting real modifier mask. If the keyboard description in xkbdoes not include virtual modifier bindings, XkbVirtualModsToRealreturns False; otherwise, it returns True.


  • True
                   The XkbVirtualModsToRealfunction returns True if the keyboard description in xkbdoes include virtual modifier bindings.
  • False
                   The XkbVirtualModsToRealfunction returns False if the keyboard description in xkbdoes not include virtual modifier bindings.


R XkbGetMap (3),

R XkbGetVirtualMods (3)


It is possible for a local (client-side) keyboard description (the xkbparameter) to not contain any virtual modifier information (simply because the client has not requested it) while the server's corresponding definition may contain virtual modifier information.