2011-10-07 22:52:30 -06:00
|
|
|
|
<chapter id='Virtual_Modifiers'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Virtual Modifiers</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
The core protocol specifies that certain keysyms, when bound to modifiers,
|
|
|
|
|
|
affect the rules of keycode to keysym interpretation for all keys; for example,
|
2014-07-06 20:25:46 -07:00
|
|
|
|
when the
|
|
|
|
|
|
<emphasis>Num_Lock</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
keysym is bound to some modifier, that modifier is used to select between
|
|
|
|
|
|
shifted and unshifted state for the numeric keypad keys. The core protocol does
|
|
|
|
|
|
not provide a convenient way to determine the mapping of modifier bits (in
|
2014-07-06 20:25:46 -07:00
|
|
|
|
particular
|
|
|
|
|
|
<emphasis>Mod1</emphasis>
|
|
|
|
|
|
through
|
|
|
|
|
|
<emphasis>Mod5</emphasis>
|
|
|
|
|
|
) to keysyms such as
|
|
|
|
|
|
<emphasis>Num_Lock</emphasis>
|
|
|
|
|
|
and
|
|
|
|
|
|
<emphasis>Mode_switch</emphasis>.
|
|
|
|
|
|
Using the core protocol only, a client application must retrieve and search
|
2010-11-30 10:52:07 -05:00
|
|
|
|
the modifier map to determine the keycodes bound to each modifier, and then
|
|
|
|
|
|
retrieve and search the keyboard mapping to determine the keysyms bound to the
|
|
|
|
|
|
keycodes. It must repeat this process for all modifiers whenever any part of
|
|
|
|
|
|
the modifier mapping is changed.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Xkb alleviates these problems by defining virtual modifiers. In addition to the
|
2014-07-06 20:25:46 -07:00
|
|
|
|
eight core modifiers, referred to as the
|
|
|
|
|
|
<emphasis>real modifiers</emphasis>,
|
|
|
|
|
|
Xkb provides a set of sixteen named
|
|
|
|
|
|
<emphasis>virtual modifiers</emphasis>.
|
|
|
|
|
|
Each virtual modifier can be bound to any set of the real modifiers
|
|
|
|
|
|
(
|
|
|
|
|
|
<emphasis>Shift</emphasis>,
|
|
|
|
|
|
<emphasis>Lock</emphasis>,
|
|
|
|
|
|
<emphasis>Control</emphasis>,
|
|
|
|
|
|
and
|
|
|
|
|
|
<emphasis>Mod1</emphasis>
|
|
|
|
|
|
-
|
|
|
|
|
|
<emphasis>Mod5</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
).
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
The separation of function from physical modifier bindings makes it easier to
|
|
|
|
|
|
specify more clearly the intent of a binding. X servers do not all assign
|
2014-07-06 20:25:46 -07:00
|
|
|
|
modifiers the same way — for example,
|
|
|
|
|
|
<emphasis>Num_Lock</emphasis>
|
|
|
|
|
|
might be bound to
|
|
|
|
|
|
<emphasis>Mod2</emphasis>
|
|
|
|
|
|
for one vendor and to
|
|
|
|
|
|
<emphasis>Mod4</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
for another. This makes it cumbersome to automatically remap the keyboard to a
|
|
|
|
|
|
desired configuration without some kind of prior knowledge about the keyboard
|
|
|
|
|
|
layout and bindings. With XKB, applications can use virtual modifiers to
|
|
|
|
|
|
specify the desired behavior, without regard for the actual physical bindings
|
|
|
|
|
|
in effect.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect1 id='Virtual_Modifier_Names_and_Masks'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Virtual Modifier Names and Masks</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
Virtual modifiers are named by converting their string name to an X
|
|
|
|
|
|
<emphasis>Atom</emphasis>
|
|
|
|
|
|
and storing the Atom in the
|
|
|
|
|
|
<emphasis>names.vmods</emphasis>
|
|
|
|
|
|
array in an
|
|
|
|
|
|
<emphasis>XkbDescRec</emphasis>
|
|
|
|
|
|
structure (see section 6.1). The position of a name Atom in the
|
|
|
|
|
|
<emphasis>names.vmods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
array defines the bit position used to represent the virtual modifier and also
|
|
|
|
|
|
the index used when accessing virtual modifier information in arrays: the name
|
2014-07-06 20:25:46 -07:00
|
|
|
|
in the i-th (0 relative) entry of
|
|
|
|
|
|
<emphasis>names.vmods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
is the i-th virtual modifier, represented by the mask (1<<i). Throughout
|
|
|
|
|
|
Xkb, various functions have a parameter that is a mask representing virtual
|
|
|
|
|
|
modifier choices. In each case, the i-th bit (0 relative) of the mask
|
|
|
|
|
|
represents the i-th virtual modifier.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
To set the name of a virtual modifier, use
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbSetNames</function>,
|
2014-07-06 20:25:46 -07:00
|
|
|
|
using
|
|
|
|
|
|
<emphasis>XkbVirtualModNamesMask</emphasis>
|
|
|
|
|
|
in
|
|
|
|
|
|
<emphasis>which</emphasis>
|
|
|
|
|
|
and the name in the
|
|
|
|
|
|
<emphasis>xkb</emphasis>
|
|
|
|
|
|
argument; to retrieve indicator names, use
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbGetNames</function>.
|
2014-07-06 20:25:46 -07:00
|
|
|
|
These functions are discussed in Chapter 18.
|
2010-11-30 10:52:07 -05:00
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</sect1>
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect1 id='Modifier_Definitions'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Modifier Definitions</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
An Xkb
|
|
|
|
|
|
<emphasis>modifier definition</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
enumerates a collection of real and virtual modifiers but does not in itself
|
|
|
|
|
|
bind those modifiers to any particular key or to each other. Modifier
|
|
|
|
|
|
definitions are included in a number of structures in the keyboard description
|
|
|
|
|
|
to define the collection of modifiers that affect or are affected by some other
|
|
|
|
|
|
entity. A modifier definition is relevant only in the context of some other
|
|
|
|
|
|
entity such as an indicator map, a control, or a key type. (See sections 8.2.2,
|
|
|
|
|
|
10.8, and 15.2.) <!-- xref -->
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<para><programlisting>
|
|
|
|
|
|
typedef struct _XkbMods {
|
|
|
|
|
|
unsigned char mask; /* real_mods | vmods mapped to
|
|
|
|
|
|
real modifiers */
|
|
|
|
|
|
unsigned char real_mods; /* real modifier bits */
|
|
|
|
|
|
unsigned short vmods; /* virtual modifier bits */
|
2014-07-06 20:25:46 -07:00
|
|
|
|
}
|
|
|
|
|
|
<emphasis>XkbModsRec</emphasis>,
|
|
|
|
|
|
*XkbModsPtr;
|
2010-11-30 10:52:07 -05:00
|
|
|
|
</programlisting></para>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
An Xkb modifier definition consists of a set of bit masks corresponding to the
|
2014-07-06 20:25:46 -07:00
|
|
|
|
eight real modifiers (
|
|
|
|
|
|
<emphasis>real_mods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
); a similar set of bitmasks corresponding to the 16 named virtual modifiers
|
2014-07-06 20:25:46 -07:00
|
|
|
|
(
|
|
|
|
|
|
<emphasis>vmods</emphasis>
|
|
|
|
|
|
); and an effective mask (
|
|
|
|
|
|
<emphasis>mask</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
). The effective mask represents the set of all real modifiers that can
|
|
|
|
|
|
logically be set either by setting any of the real modifiers or by setting any
|
2014-07-06 20:25:46 -07:00
|
|
|
|
of the virtual modifiers in the definition.
|
|
|
|
|
|
<emphasis>mask</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
is derived from the real and virtual modifiers and should never be explicitly
|
|
|
|
|
|
changed — it contains all of the real modifiers specified in the definition
|
2014-07-06 20:25:46 -07:00
|
|
|
|
(
|
|
|
|
|
|
<emphasis>real_mods</emphasis>
|
|
|
|
|
|
)
|
|
|
|
|
|
<emphasis>plus</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
any real modifiers that are bound to the virtual modifiers specified in the
|
2014-07-06 20:25:46 -07:00
|
|
|
|
definition (
|
|
|
|
|
|
<emphasis>vmods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
). The binding of the virtual modifiers to real modifiers is exterior to the
|
|
|
|
|
|
modifier definition. Xkb automatically recomputes the mask field of modifier
|
|
|
|
|
|
definitions as necessary. Whenever you access a modifier definition that has
|
|
|
|
|
|
been retrieved using an Xkb library function, the mask field will be correct
|
|
|
|
|
|
for the keyboard mapping of interest.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</sect1>
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect1 id='Binding_Virtual_Modifiers_to_Real_Modifiers'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Binding Virtual Modifiers to Real Modifiers</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
The binding of virtual modifiers to real modifiers is defined by the
|
|
|
|
|
|
<emphasis>server.vmods</emphasis>
|
|
|
|
|
|
array in an
|
|
|
|
|
|
<emphasis>XkbDescRec</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
structure. Each entry contains the real modifier bits that are bound to the
|
|
|
|
|
|
virtual modifier corresponding to the entry. The overall relationship of fields
|
|
|
|
|
|
dealing with virtual modifiers in the server keyboard description are shown in
|
|
|
|
|
|
Figure 16.2. <!-- xref -->
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</sect1>
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect1 id='Virtual_Modifier_Key_Mapping'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Virtual Modifier Key Mapping</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
Xkb maintains a
|
|
|
|
|
|
<emphasis>virtual modifier mapping</emphasis>,
|
|
|
|
|
|
which lists the virtual modifiers associated with, or bound to, each key. The
|
2010-11-30 10:52:07 -05:00
|
|
|
|
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
|
2014-07-06 20:25:46 -07:00
|
|
|
|
modifier mapping. The
|
|
|
|
|
|
<emphasis>server.vmodmap</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
array indicates which virtual modifiers are bound to each key; each entry is a
|
2014-07-06 20:25:46 -07:00
|
|
|
|
bitmask for the virtual modifier bits. The
|
|
|
|
|
|
<emphasis>server.vmodmap</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
array is indexed by keycode.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
The
|
|
|
|
|
|
<emphasis>vmodmap</emphasis>
|
|
|
|
|
|
and
|
|
|
|
|
|
<emphasis>vmods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
members 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 (see section 16.4).
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
For example, if
|
|
|
|
|
|
<emphasis>Mod3</emphasis>
|
|
|
|
|
|
is bound to the
|
|
|
|
|
|
<emphasis>Num_Lock</emphasis>
|
|
|
|
|
|
key by the core protocol modifier mapping, and the
|
|
|
|
|
|
<emphasis>NumLock</emphasis>
|
|
|
|
|
|
virtual modifier is bound to they
|
|
|
|
|
|
<emphasis>Num_Lock</emphasis>
|
|
|
|
|
|
key by the virtual modifier mapping,
|
|
|
|
|
|
<emphasis>Mod3</emphasis>
|
|
|
|
|
|
is added to the set of modifiers associated with
|
|
|
|
|
|
<emphasis>NumLock</emphasis>.
|
2010-11-30 10:52:07 -05:00
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
The virtual modifier mapping is normally updated whenever actions are
|
|
|
|
|
|
automatically applied to symbols (see section 16.4 for details), and few
|
|
|
|
|
|
applications should need to change the virtual modifier mapping explicitly.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
Use
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbGetMap</function>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
(see section 14.2) to get the virtual modifiers from the server or use <!-- xref -->
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbGetVirtualMods</function>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
(see section 16.4.1) to update a local copy of the virtual modifiers bindings <!-- xref -->
|
|
|
|
|
|
from the server. To set the binding of a virtual modifier to a real modifier,
|
2014-07-06 20:25:46 -07:00
|
|
|
|
use
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbSetMap</function>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
(see
|
2010-11-30 10:52:07 -05:00
|
|
|
|
section 14.3<emphasis> <!-- xref -->
|
2014-07-06 20:25:46 -07:00
|
|
|
|
)</emphasis>.
|
2010-11-30 10:52:07 -05:00
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
To determine the mapping of virtual modifiers to core X protocol modifiers, use
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbVirtualModsToReal</function>.
|
2010-11-30 10:52:07 -05:00
|
|
|
|
</para>
|
|
|
|
|
|
|
2014-07-06 15:57:41 -07:00
|
|
|
|
<indexterm significance="preferred" zone="XkbVirtualModsToReal"><primary><function>XkbVirtualModsToReal</function></primary></indexterm>
|
|
|
|
|
|
<funcsynopsis id="XkbVirtualModsToReal">
|
|
|
|
|
|
<funcprototype>
|
|
|
|
|
|
<funcdef>Bool <function>XkbVirtualModsToReal</function></funcdef>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
<!-- (
|
|
|
|
|
|
<emphasis>xkb, virtual_mask, mask_rtrn</emphasis>
|
2014-07-06 15:57:41 -07:00
|
|
|
|
) -->
|
|
|
|
|
|
|
|
|
|
|
|
<paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
|
|
|
|
|
|
<paramdef>unsigned int <parameter>virtual_mask</parameter></paramdef>
|
|
|
|
|
|
<paramdef>unsigned int *<parameter>mask_rtrn</parameter></paramdef>
|
|
|
|
|
|
</funcprototype>
|
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
|
<term>
|
|
|
|
|
|
<parameter>xkb</parameter>
|
|
|
|
|
|
</term>
|
|
|
|
|
|
<listitem>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
keyboard description for input device
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
|
<term>
|
|
|
|
|
|
<parameter>virtual_mask</parameter>
|
|
|
|
|
|
</term>
|
|
|
|
|
|
<listitem>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
virtual modifier mask to translate
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
|
<term>
|
|
|
|
|
|
<parameter>mask_rtrn</parameter>
|
|
|
|
|
|
</term>
|
|
|
|
|
|
<listitem>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
backfilled with real modifiers
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
</variablelist>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
If the keyboard description defined by
|
|
|
|
|
|
<emphasis>xkb</emphasis>
|
|
|
|
|
|
includes bindings for virtual modifiers,
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbVirtualModsToReal</function>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
uses those bindings to determine the set of real modifiers that correspond to
|
2014-07-06 20:25:46 -07:00
|
|
|
|
the set of virtual modifiers specified in
|
|
|
|
|
|
<emphasis>virtual_mask</emphasis>.
|
|
|
|
|
|
The
|
|
|
|
|
|
<emphasis>virtual_mask</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
parameter is a mask specifying the virtual modifiers to translate; the i-th
|
2014-07-06 20:25:46 -07:00
|
|
|
|
bit (0 relative) of the mask represents the i-th virtual modifier. If
|
|
|
|
|
|
<emphasis>mask_rtrn</emphasis>
|
|
|
|
|
|
is non-
|
|
|
|
|
|
<emphasis>NULL</emphasis>,
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbVirtualModsToReal</function>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
backfills it with the resulting real modifier mask. If the keyboard
|
2014-07-06 20:25:46 -07:00
|
|
|
|
description in
|
|
|
|
|
|
<emphasis>xkb</emphasis>
|
|
|
|
|
|
does not include virtual modifier bindings,
|
2014-07-06 20:34:51 -07:00
|
|
|
|
<function>XkbVirtualModsToReal</function>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
returns
|
|
|
|
|
|
<emphasis>False</emphasis>
|
|
|
|
|
|
; otherwise, it returns
|
|
|
|
|
|
<emphasis>True</emphasis>.
|
2010-11-30 10:52:07 -05:00
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<note><para>It is possible for a local (client-side) keyboard description (the
|
2014-07-06 20:25:46 -07:00
|
|
|
|
<emphasis>xkb</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
parameter) 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. </para></note>
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect2 id='Inactive_Modifier_Sets'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Inactive Modifier Sets</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
An unbound virtual modifier is one that is not bound to any real modifier
|
2014-07-06 20:25:46 -07:00
|
|
|
|
(
|
|
|
|
|
|
<emphasis>server</emphasis>
|
|
|
|
|
|
->
|
|
|
|
|
|
<emphasis>vmods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
[virtual_modifier_index] is zero).
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Some Xkb operations ignore modifier definitions in which the virtual modifiers
|
|
|
|
|
|
are unbound. Consider this example:
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<literallayout>
|
|
|
|
|
|
if (state matches {Shift}) Do OneThing;
|
|
|
|
|
|
if (state matches {Shift+NumLock}) Do Another;
|
|
|
|
|
|
</literallayout>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
If the
|
|
|
|
|
|
<emphasis>NumLock</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
virtual modifier is not bound to any real modifiers, the effective masks for
|
2014-07-06 20:25:46 -07:00
|
|
|
|
these two cases are identical (that is, contain only
|
|
|
|
|
|
<emphasis>Shift</emphasis>
|
|
|
|
|
|
). When it is essential to distinguish between
|
|
|
|
|
|
<emphasis>OneThing</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
and Another, Xkb considers only those modifier definitions for which all
|
|
|
|
|
|
virtual modifiers are bound.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
</sect1>
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect1 id='Conventions'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Conventions</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
The Xkb extension does not require any specific virtual modifier names.
|
|
|
|
|
|
However, everyone benefits if the same names are used for common modifiers. The
|
|
|
|
|
|
following names are suggested:
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<literallayout class='monospaced'>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
<emphasis>NumLock
|
2010-11-30 10:52:07 -05:00
|
|
|
|
ScrollLock
|
|
|
|
|
|
Alt
|
|
|
|
|
|
Meta
|
|
|
|
|
|
AltGr
|
|
|
|
|
|
LevelThree</emphasis>
|
|
|
|
|
|
</literallayout>
|
|
|
|
|
|
|
|
|
|
|
|
</sect1>
|
2011-10-07 22:52:30 -06:00
|
|
|
|
<sect1 id='Example'>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
<title>Example</title>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
If the second (0-relative) entry in
|
|
|
|
|
|
<emphasis>names.vmods</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
contains the Atom for "NumLock", then 0x4 (1<<2) is the virtual modifier
|
2014-07-06 20:25:46 -07:00
|
|
|
|
bit for the
|
|
|
|
|
|
<emphasis>NumLock</emphasis>
|
|
|
|
|
|
virtual modifier. If
|
|
|
|
|
|
<emphasis>server.vmods</emphasis>
|
|
|
|
|
|
[2] contains
|
|
|
|
|
|
<emphasis>Mod3Mask</emphasis>,
|
|
|
|
|
|
then the
|
|
|
|
|
|
<emphasis>NumLock</emphasis>
|
|
|
|
|
|
virtual modifier is bound to the
|
|
|
|
|
|
<emphasis>Mod3</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
real modifier.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
A virtual modifier definition for this example would have:
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<literallayout class='monospaced'>
|
|
|
|
|
|
real_mods = 0
|
|
|
|
|
|
vmods = 0x4 (NumLock named virtual modifier)
|
|
|
|
|
|
mask = 0x20 (Mod3Mask)
|
|
|
|
|
|
</literallayout>
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
Continuing the example, if the keyboard has a
|
|
|
|
|
|
<emphasis>Num_Lock</emphasis>
|
|
|
|
|
|
keysym bound to the key with keycode 14, and the
|
|
|
|
|
|
<emphasis>NumLock</emphasis>
|
|
|
|
|
|
virtual modifier is bound to this key,
|
|
|
|
|
|
<emphasis>server.vmodmap</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
[14] contains 0x4.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>
|
2014-07-06 20:25:46 -07:00
|
|
|
|
Finally, if the keyboard also used the real
|
|
|
|
|
|
<emphasis>Mod1</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
modifier for numeric lock operations, the modifier definition below would
|
2014-07-06 20:25:46 -07:00
|
|
|
|
represent the situation where either the key bound to
|
|
|
|
|
|
<emphasis>Mod1</emphasis>
|
|
|
|
|
|
or the
|
|
|
|
|
|
<emphasis>NumLock</emphasis>
|
2010-11-30 10:52:07 -05:00
|
|
|
|
virtual modifier could be used for this purpose:
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<literallayout class='monospaced'>
|
|
|
|
|
|
real_mods = 0x8 (Mod1Mask)
|
|
|
|
|
|
vmods = 0x4 (NumLock named virtual modifier)
|
|
|
|
|
|
mask = 0x28 (Mod1Mask | Mod3Mask)
|
|
|
|
|
|
</literallayout>
|
|
|
|
|
|
</sect1>
|
|
|
|
|
|
</chapter>
|