10f8248bfSmrg<?xml version="1.0" encoding="UTF-8" ?> 20f8248bfSmrg<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 30f8248bfSmrg "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> 4eb411b4bSmrg<chapter id='The_Xkb_Compatibility_Map'> 5e9fcaa8aSmrg<title>The Xkb Compatibility Map</title> 6e9fcaa8aSmrg 7e9fcaa8aSmrg<para> 80f8248bfSmrgAs shown in <link linkend="figure17.1">Figure 17.1</link>, the X server is normally dealing with more than one 9e9fcaa8aSmrgclient, each of which may be receiving events from the keyboard, and each of 10e9fcaa8aSmrgwhich may issue requests to modify the keyboard in some manner. Each client may 11e9fcaa8aSmrgbe either Xkb-unaware, Xkb-capable, or Xkb-aware. The server itself may be 12e9fcaa8aSmrgeither Xkb-aware or Xkb-unaware. If the server is Xkb-unaware, Xkb state and 13e9fcaa8aSmrgkeyboard mappings are not involved in any manner, and Xkb-aware clients may not 14e9fcaa8aSmrgissue Xkb requests to the server. If the server is Xkb-aware, the server must 15e9fcaa8aSmrgbe able to deliver events and accept requests in which the keyboard state and 16e9fcaa8aSmrgmapping are compatible with the mode in which the client is operating. 17e9fcaa8aSmrgConsequently, for some situations, conversions must be made between Xkb state / 18e9fcaa8aSmrgkeyboard mappings and core protocol state / keyboard mappings, and vice versa. 19e9fcaa8aSmrg</para> 20e9fcaa8aSmrg 210f8248bfSmrg<figure id='figure17.1'> 220f8248bfSmrg <title>Server Interaction with Types of Clients</title> 230f8248bfSmrg <mediaobject> 240f8248bfSmrg <imageobject> <imagedata format="SVG" fileref="XKBlib-18.svg"/> 250f8248bfSmrg </imageobject> 260f8248bfSmrg </mediaobject> 270f8248bfSmrg</figure> 28e9fcaa8aSmrg 29e9fcaa8aSmrg 30e9fcaa8aSmrg 31e9fcaa8aSmrg<para> 32e9fcaa8aSmrgIn addition to these situations involving a single server, there are cases 33e9fcaa8aSmrgwhere a client that deals with multiple servers may need to configure keyboards 34e9fcaa8aSmrgon different servers to be similar and the different servers may not all be 35e9fcaa8aSmrgXkb-aware. Finally, a client may be dealing with descriptions of keyboards 36e9fcaa8aSmrg(files, and so on) that are based on core protocol and therefore may need to be 37e9fcaa8aSmrgable to map these descriptions to Xkb descriptions. 38e9fcaa8aSmrg</para> 39e9fcaa8aSmrg 40e9fcaa8aSmrg 41e9fcaa8aSmrg<para> 42e9fcaa8aSmrgAn Xkb-aware server maintains keyboard state and mapping as an Xkb keyboard 43e9fcaa8aSmrgstate and an Xkb keyboard mapping plus a compatibility map used to convert from 44e9fcaa8aSmrgXkb components to core components and vice versa. In addition, the server also 45e9fcaa8aSmrgmaintains a core keyboard mapping that approximates the Xkb keyboard mapping. 46e9fcaa8aSmrgThe core keyboard mapping may be updated piecemeal, on a per-key basis. When 470f8248bfSmrgthe server receives a core protocol 480f8248bfSmrg<systemitem>ChangeKeyboardMapping</systemitem> 490f8248bfSmrgor 500f8248bfSmrg<systemitem>SetModifierMapping</systemitem> 510f8248bfSmrgrequest, it updates its core keyboard mapping, then uses the compatibility map 520f8248bfSmrgto update its Xkb keyboard mapping. When the server receives an 530f8248bfSmrg<function>XkbSetMap</function> 540f8248bfSmrgrequest, it updates those portions of its Xkb keyboard mapping specified by 55e9fcaa8aSmrgthe request, then uses its compatibility map to update the corresponding parts 56e9fcaa8aSmrgof its core keyboard map. Consequently, the server’s Xkb keyboard map and 57e9fcaa8aSmrgalso its core keyboard map may contain components that were set directly and 580f8248bfSmrgothers that were computed. <link linkend="figure17.2">Figure 17.2</link> illustrates these relationships. 59e9fcaa8aSmrg</para> 60e9fcaa8aSmrg 61e9fcaa8aSmrg<note><para>The core keyboard map is contained only in the server, not in any 62e9fcaa8aSmrgclient-side data structures.</para></note> 63e9fcaa8aSmrg 640f8248bfSmrg<figure id='figure17.2'> 650f8248bfSmrg <title>Server Derivation of State and Keyboard Mapping Components</title> 660f8248bfSmrg <mediaobject> 670f8248bfSmrg <imageobject> <imagedata format="SVG" fileref="XKBlib-19.svg"/> 680f8248bfSmrg </imageobject> 690f8248bfSmrg </mediaobject> 700f8248bfSmrg</figure> 71e9fcaa8aSmrg 72e9fcaa8aSmrg 73e9fcaa8aSmrg 74e9fcaa8aSmrg<para> 75e9fcaa8aSmrgThere are three kinds of compatibility transformations made by the server: 76e9fcaa8aSmrg</para> 77e9fcaa8aSmrg 78e9fcaa8aSmrg<orderedlist> 79e9fcaa8aSmrg <listitem> 80e9fcaa8aSmrg <para><emphasis role='bold'>Xkb State to Core State</emphasis></para> 81e9fcaa8aSmrg <para> 82e9fcaa8aSmrgKeyboard state information reported to a client in the state field of various 83e9fcaa8aSmrgcore events may be translated from the Xkb keyboard state maintained by the 84e9fcaa8aSmrgserver, which includes a group number, to core protocol state, which does 85e9fcaa8aSmrgnot. 86e9fcaa8aSmrg </para> 87e9fcaa8aSmrg <para> 880f8248bfSmrgIn addition, whenever the Xkb state is retrieved, the 890f8248bfSmrg<structfield>compat_state</structfield>, 900f8248bfSmrg<structfield>compat_grab_mods</structfield>, 910f8248bfSmrgand 920f8248bfSmrg<structfield>compat_lookup_mods</structfield> 930f8248bfSmrgfields of the 940f8248bfSmrg<structname>XkbStateRec</structname> 950f8248bfSmrgreturned indicate the result of applying the compatibility map to the current 96e9fcaa8aSmrgXkb state in the server. 97e9fcaa8aSmrg </para> 98e9fcaa8aSmrg </listitem> 99e9fcaa8aSmrg <listitem> 100e9fcaa8aSmrg <para><emphasis role='bold'>Core Keyboard Mapping to Xkb Keyboard Mapping</emphasis></para> 101e9fcaa8aSmrg <para> 102e9fcaa8aSmrgAfter core protocol requests received by the server to change the keyboard 1030f8248bfSmrgmapping 1040f8248bfSmrg(<systemitem>ChangeKeyboardMapping</systemitem> 1050f8248bfSmrgand 1060f8248bfSmrg<systemitem>SetModifierMapping</systemitem>) 1070f8248bfSmrghave been applied to the server’s core keyboard map, the results must be 108e9fcaa8aSmrgtransformed to achieve an equivalent change of the Xkb keyboard mapping 109e9fcaa8aSmrgmaintained by the server. 110e9fcaa8aSmrg </para> 111e9fcaa8aSmrg </listitem> 112e9fcaa8aSmrg <listitem> 113e9fcaa8aSmrg <para><emphasis role='bold'>Xkb Keyboard Mapping to Core Keyboard Mapping</emphasis></para> 114e9fcaa8aSmrg <para> 115e9fcaa8aSmrgAfter Xkb protocol requests received by the server to change the keyboard 1160f8248bfSmrgmapping 1170f8248bfSmrg(<function>XkbSetMap</function>) 1180f8248bfSmrghave been applied to the server’s Xkb keyboard map, the results are 119e9fcaa8aSmrgtransformed to achieve an approximately equivalent change to the core keyboard 120e9fcaa8aSmrgmapping maintained by the server. 121e9fcaa8aSmrg </para> 122e9fcaa8aSmrg </listitem> 123e9fcaa8aSmrg</orderedlist> 124e9fcaa8aSmrg 125e9fcaa8aSmrg<para> 126e9fcaa8aSmrgThis chapter discusses how a client may modify the compatibility map so that 127e9fcaa8aSmrgsubsequent transformations have a particular result. 128e9fcaa8aSmrg</para> 129e9fcaa8aSmrg 130e9fcaa8aSmrg 131eb411b4bSmrg<sect1 id='The_XkbCompatMap_Structure'> 132e9fcaa8aSmrg<title>The XkbCompatMap Structure</title> 1330f8248bfSmrg<indexterm significance="preferred" zone="The_XkbCompatMap_Structure"> 1340f8248bfSmrg<primary><structname>XkbCompatMapRec</structname></primary></indexterm> 135e9fcaa8aSmrg 136e9fcaa8aSmrg<para> 137e9fcaa8aSmrgAll configurable aspects of mapping Xkb state and configuration to and from 138e9fcaa8aSmrgcore protocol state and configuration are defined by a compatibility map, 1390f8248bfSmrgcontained in an 1400f8248bfSmrg<structname>XkbCompatMapRec</structname> 1410f8248bfSmrgstructure; plus a set of explicit override controls used to prevent particular 142e9fcaa8aSmrgcomponents of type 2 (core-to-Xkb keyboard mapping) transformations from 143e9fcaa8aSmrgautomatically occurring. These explicit override controls are maintained in a 1440f8248bfSmrgseparate data structure discussed in <link linkend="Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server">section 16.3</link>. 145e9fcaa8aSmrg</para> 146e9fcaa8aSmrg 147e9fcaa8aSmrg 148e9fcaa8aSmrg<para> 1490f8248bfSmrgThe 1500f8248bfSmrg<structfield>compat</structfield> 1510f8248bfSmrgmember of an Xkb keyboard description 1520f8248bfSmrg(<structname>XkbDescRec</structname>) 1530f8248bfSmrgpoints to the 1540f8248bfSmrg<structname>XkbCompatMapRec</structname> 1550f8248bfSmrgstructure: 156e9fcaa8aSmrg 1570f8248bfSmrg<programlisting> 158e9fcaa8aSmrgtypedef struct _XkbCompatMapRec { 1590f8248bfSmrg XkbSymInterpretPtr sym_interpret; /* symbol based key semantics */ 1600f8248bfSmrg XkbModsRec groups[XkbNumKbdGroups]; /* group ⇒ modifier map */ 1610f8248bfSmrg unsigned short num_si; /* # structures used in 1620f8248bfSmrg <structfield>sym_interpret</structfield> */ 1630f8248bfSmrg unsigned short size_si; /* # structures allocated in 1640f8248bfSmrg <structfield>sym_interpret</structfield> */ 1650f8248bfSmrg} <structname>XkbCompatMapRec</structname>, *XkbCompatMapPtr; 166e9fcaa8aSmrg</programlisting></para> 167e9fcaa8aSmrg 1680f8248bfSmrg<figure id='figure17.3'> 1690f8248bfSmrg <title>Xkb Compatibility Data Structures</title> 1700f8248bfSmrg <mediaobject> 1710f8248bfSmrg <imageobject> <imagedata format="SVG" fileref="XKBlib-20.svg"/> 1720f8248bfSmrg </imageobject> 1730f8248bfSmrg </mediaobject> 1740f8248bfSmrg</figure> 175e9fcaa8aSmrg 176e9fcaa8aSmrg 177e9fcaa8aSmrg<para> 178e9fcaa8aSmrgThe subsections that follow discuss how the compatibility map and explicit 179e9fcaa8aSmrgoverride controls are used in each of the three cases where compatibility 180e9fcaa8aSmrgtransformations are made. 181e9fcaa8aSmrg</para> 182e9fcaa8aSmrg 183eb411b4bSmrg<sect2 id='Xkb_State_to_Core_Protocol_State_Transformation'> 184e9fcaa8aSmrg<title>Xkb State to Core Protocol State Transformation</title> 185e9fcaa8aSmrg 186e9fcaa8aSmrg<para> 1870f8248bfSmrgAs shown in <link linkend="figure17.3">Figure 17.3</link>, there are four 1880f8248bfSmrg<firstterm>group compatibility maps</firstterm> 1890f8248bfSmrg<indexterm significance="preferred" zone="Xkb_State_to_Core_Protocol_State_Transformation"> 1900f8248bfSmrg<primary>group compatibility map</primary></indexterm> 1910f8248bfSmrg<indexterm significance="preferred" zone="Xkb_State_to_Core_Protocol_State_Transformation"> 1920f8248bfSmrg<primary>map</primary><secondary>group compatibility</secondary></indexterm> 1930f8248bfSmrg(contained in 1940f8248bfSmrg<structfield>groups</structfield> 1950f8248bfSmrg[0..3]) in the 1960f8248bfSmrg<structname>XkbCompatMapRec</structname> 1970f8248bfSmrgstructure, one per possible Xkb group. Each group compatibility map is a 1980f8248bfSmrgmodifier definition (see <link linkend="Modifier_Definitions">section 7.2</link> for a description of modifier 1990f8248bfSmrgdefinitions). The 2000f8248bfSmrg<structfield>mask</structfield> 2010f8248bfSmrgcomponent of the definition specifies which real modifiers should be set in 202e9fcaa8aSmrgthe core protocol state field when the corresponding group is active. Because 203e9fcaa8aSmrgonly one group is active at any one time, only one of the four possible 204e9fcaa8aSmrgtransformations is ever applied at any one point in time. If the device 2050f8248bfSmrgdescribed by the 2060f8248bfSmrg<structname>XkbDescRec</structname> 2070f8248bfSmrgdoes not support four groups, the extra groups fields are present, but 208e9fcaa8aSmrgundefined. 209e9fcaa8aSmrg</para> 210e9fcaa8aSmrg 211e9fcaa8aSmrg<para> 2120f8248bfSmrgNormally, the Xkb-aware server reports keyboard state in the 2130f8248bfSmrg<structfield>state</structfield> 2140f8248bfSmrgmember of events such as a 2150f8248bfSmrg<symbol>KeyPress</symbol> 2160f8248bfSmrgevent and 2170f8248bfSmrg<symbol>ButtonPress</symbol> 2180f8248bfSmrgevent, encoded as follows: 219e9fcaa8aSmrg</para> 220e9fcaa8aSmrg 221eb411b4bSmrg<informaltable frame='topbot'> 222eb411b4bSmrg<?dbfo keep-together="always" ?> 223eb411b4bSmrg<tgroup cols='2' align='left' colsep='0' rowsep='0'> 224eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 225eb411b4bSmrg<colspec colname='c1' colwidth='2.0*'/> 226e9fcaa8aSmrg<thead> 227eb411b4bSmrg <row rowsep='1'> 228e9fcaa8aSmrg <entry>bits</entry> 229e9fcaa8aSmrg <entry>meaning</entry> 230e9fcaa8aSmrg </row> 231e9fcaa8aSmrg</thead> 232e9fcaa8aSmrg<tbody> 233eb411b4bSmrg <row> 234e9fcaa8aSmrg <entry>15</entry> 235e9fcaa8aSmrg <entry>0</entry> 236e9fcaa8aSmrg </row> 237eb411b4bSmrg <row> 2380f8248bfSmrg <entry>13–14</entry> 239e9fcaa8aSmrg <entry>Group index</entry> 240e9fcaa8aSmrg </row> 241eb411b4bSmrg <row> 2420f8248bfSmrg <entry>8–12</entry> 243e9fcaa8aSmrg <entry>Pointer Buttons</entry> 244e9fcaa8aSmrg </row> 245eb411b4bSmrg <row> 2460f8248bfSmrg <entry>0–7</entry> 247e9fcaa8aSmrg <entry>Modifiers</entry> 248e9fcaa8aSmrg </row> 249e9fcaa8aSmrg</tbody> 250e9fcaa8aSmrg</tgroup> 251e9fcaa8aSmrg</informaltable> 252e9fcaa8aSmrg 253e9fcaa8aSmrg<para> 254e9fcaa8aSmrgFor Xkb-unaware clients, only core protocol keyboard information may be 255e9fcaa8aSmrgreported. Because core protocol does not define the group index, the group 2560f8248bfSmrgindex is mapped to modifier bits as specified by the 2570f8248bfSmrg<structfield>groups</structfield> 258e9fcaa8aSmrg[group index] field of the compatibility map (the bits set in the compatibility 2590f8248bfSmrgmap are ORed into bits 0–7 of the state), and bits 13–14 are reported in the 260e9fcaa8aSmrgevent as zero. 261e9fcaa8aSmrg</para> 262e9fcaa8aSmrg 263e9fcaa8aSmrg</sect2> 264eb411b4bSmrg<sect2 id='Core_Keyboard_Mapping_to_Xkb_Keyboard_Mapping_Transformation'> 265e9fcaa8aSmrg<title>Core Keyboard Mapping to Xkb Keyboard Mapping Transformation</title> 266e9fcaa8aSmrg 267e9fcaa8aSmrg<para> 268e9fcaa8aSmrgWhen a core protocol keyboard mapping request is received by the server, the 269e9fcaa8aSmrgserver’s core keyboard map is updated, and then the Xkb map maintained by the 270e9fcaa8aSmrgserver is updated. Because a client may have explicitly configured some of the 271e9fcaa8aSmrgXkb keyboard mapping in the server, this automatic regeneration of the Xkb 272e9fcaa8aSmrgkeyboard mapping from the core protocol keyboard mapping should not modify any 273e9fcaa8aSmrgcomponents of the Xkb keyboard mapping that were explicitly set by a client. 274e9fcaa8aSmrgThe client must set explicit override controls to prevent this from happening 2750f8248bfSmrg(see <link linkend="Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server">section 16.3</link>). The core-to-Xkb mapping is done as follows: 276e9fcaa8aSmrg</para> 277e9fcaa8aSmrg 278e9fcaa8aSmrg<orderedlist> 279e9fcaa8aSmrg <listitem> 280e9fcaa8aSmrg <para> 281e9fcaa8aSmrgMap the symbols from the keys in the core keyboard map to groups and symbols on 282e9fcaa8aSmrgkeys in the Xkb keyboard map. The core keyboard mapping is of fixed width, so 283e9fcaa8aSmrgeach key in the core mapping has the same number of symbols associated with it. 284e9fcaa8aSmrgThe Xkb mapping allows a different number of symbols to be associated with each 285e9fcaa8aSmrgkey; those symbols may be divided into a different number of groups (1-4) for 286e9fcaa8aSmrgeach key. For each key, this process therefore involves partitioning the fixed 287e9fcaa8aSmrgnumber of symbols from the core mapping into a set of variable-length groups 288e9fcaa8aSmrgwith a variable number of symbols in each group. For example, if the core 289e9fcaa8aSmrgprotocol map is of width five, the partition for one key might result in one 290e9fcaa8aSmrggroup with two symbols and another with three symbols. A different key might 291e9fcaa8aSmrgresult in two groups with two symbols plus a third group with one symbol. The 292e9fcaa8aSmrgcore protocol map requires at least two symbols in each of the first two 293e9fcaa8aSmrggroups. 294e9fcaa8aSmrg </para> 295e9fcaa8aSmrg <orderedlist> 296e9fcaa8aSmrg <listitem> 297e9fcaa8aSmrg <para> 298e9fcaa8aSmrgFor each changed key, determine the number of groups represented in the new 299e9fcaa8aSmrgcore keyboard map. This results in a tentative group count for each key in the 300e9fcaa8aSmrgXkb map. 301e9fcaa8aSmrg </para> 302e9fcaa8aSmrg </listitem> 303e9fcaa8aSmrg <listitem> 304e9fcaa8aSmrg <para> 305e9fcaa8aSmrgFor each changed key, determine the number of symbols in each of the groups 306e9fcaa8aSmrgfound in step 1a. There is one explicit override control associated with each 3070f8248bfSmrgof the four possible groups for each Xkb key, 3080f8248bfSmrg<emphasis>ExplicitKeyType1</emphasis> 3090f8248bfSmrgthrough 3100f8248bfSmrg<emphasis>ExplicitKeyType4</emphasis>. 3110f8248bfSmrgIf no explicit override control is set for a group, the number of symbols 312e9fcaa8aSmrgused for that group from the core map is two. If the explicit override control 313e9fcaa8aSmrgis set for a group on the key, the number of symbols used for that Xkb group 314e9fcaa8aSmrgfrom the core map is the width of the Xkb group with one exception: because of 315e9fcaa8aSmrgthe core protocol requirement for at least two symbols in each of groups one 316e9fcaa8aSmrgand two, the number of symbols used for groups one and two is the maximum of 2 317e9fcaa8aSmrgor the width of the Xkb group. 318e9fcaa8aSmrg </para> 319e9fcaa8aSmrg </listitem> 320e9fcaa8aSmrg <listitem> 321e9fcaa8aSmrg <para> 322e9fcaa8aSmrgFor each changed key, assign the symbols in the core map to the appropriate 323e9fcaa8aSmrggroup on the key. If the total number of symbols required by the Xkb map for a 324e9fcaa8aSmrgparticular key needs more symbols than the core protocol map contains, the 3250f8248bfSmrgadditional symbols are taken to be 3260f8248bfSmrg<symbol>NoSymbol</symbol> 3270f8248bfSmrgkeysyms appended to the end of the core set. If the core map contains more 328e9fcaa8aSmrgsymbols than are needed by the Xkb map, trailing symbols in the core map are 329e9fcaa8aSmrgdiscarded. In the absence of an explicit override for group one or two, symbols 330e9fcaa8aSmrgare assigned in order by group; the first symbols in the core map are assigned 331e9fcaa8aSmrgto group one, in order, followed by group two, and so on. For example, if the 332e9fcaa8aSmrgcore map contained eight symbols per key, and a particular Xkb map contained 2 333e9fcaa8aSmrgsymbols for G1 and G2 and three for G3, the symbols would be assigned as (G is 334e9fcaa8aSmrggroup, L is shift level): 335e9fcaa8aSmrg </para> 336e9fcaa8aSmrg<literallayout> 337e9fcaa8aSmrg G1L1 G1L2 G2L1 G2L2 G3L1 G3L2 G3L3 338e9fcaa8aSmrg</literallayout> 339e9fcaa8aSmrg <para> 340e9fcaa8aSmrgIf an explicit override control is set for group one or two, the symbols are 341e9fcaa8aSmrgtaken from the core set in a somewhat different order. The first four symbols 342e9fcaa8aSmrgfrom the core set are assigned to G1L1, G1L2, G2L1, G2L2, respectively. If 343e9fcaa8aSmrggroup one requires more symbols, they are taken next, and then any additional 344e9fcaa8aSmrgsymbols needed by group two. Group three and four symbols are taken in complete 345e9fcaa8aSmrgsequence after group two. For example, a key with four groups and three symbols 346e9fcaa8aSmrgin each group would take symbols from the core set in the following order: 347e9fcaa8aSmrg </para> 348e9fcaa8aSmrg<literallayout> 349e9fcaa8aSmrgG1L1 G1L2 G2L1 G2L2 G1L3 G2L3 G3L1 G3L2 G3L3 G4L1 G4L2 G4L3 350e9fcaa8aSmrg</literallayout> 351e9fcaa8aSmrg <para> 352e9fcaa8aSmrgAs previously noted, the core protocol map requires at lease two symbols in 353e9fcaa8aSmrggroups one and two. Because of this, if an explicit override control for an Xkb 354e9fcaa8aSmrgkey is set and group one and / or group two is of width one, it is not possible 355e9fcaa8aSmrgto generate the symbols taken from the core protocol set and assigned to 356e9fcaa8aSmrgposition G1L2 and / or G2L2. 357e9fcaa8aSmrg </para> 358e9fcaa8aSmrg </listitem> 359e9fcaa8aSmrg <listitem> 360e9fcaa8aSmrg <para> 361e9fcaa8aSmrgFor each group on each changed key, assign a key type appropriate for the 362e9fcaa8aSmrgsymbols in the group. 363e9fcaa8aSmrg </para> 364e9fcaa8aSmrg </listitem> 365e9fcaa8aSmrg <listitem> 366e9fcaa8aSmrg <para> 367e9fcaa8aSmrgFor each changed key, remove any empty or redundant groups. 368e9fcaa8aSmrg </para> 369e9fcaa8aSmrg </listitem> 370e9fcaa8aSmrg </orderedlist> 371e9fcaa8aSmrg </listitem> 372e9fcaa8aSmrg <listitem> 373e9fcaa8aSmrg <para> 374e9fcaa8aSmrgAt this point, the groups and their associated symbols have been assigned to 375e9fcaa8aSmrgthe corresponding key definitions in the Xkb map. 376e9fcaa8aSmrg </para> 377e9fcaa8aSmrg </listitem> 378e9fcaa8aSmrg <listitem> 379e9fcaa8aSmrg <para> 380e9fcaa8aSmrgApply symbol interpretations to modify key operation. This phase is completely 3810f8248bfSmrgskipped if the 3820f8248bfSmrg<emphasis>ExplicitInterpret</emphasis> 3830f8248bfSmrgoverride control bit is set in the explicit controls mask for the Xkb key (see 3840f8248bfSmrg<link linkend="Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server">section 16.3</link>). 385e9fcaa8aSmrg </para> 386e9fcaa8aSmrg <orderedlist> 387e9fcaa8aSmrg <listitem> 388e9fcaa8aSmrg <para> 389e9fcaa8aSmrgFor each symbol on each changed key, attempt to match the symbol and modifiers 390e9fcaa8aSmrgfrom the Xkb map to a symbol interpretation describing how to generate the 391e9fcaa8aSmrgsymbol. 392e9fcaa8aSmrg </para> 393e9fcaa8aSmrg </listitem> 394e9fcaa8aSmrg <listitem> 395e9fcaa8aSmrg <para> 396e9fcaa8aSmrgWhen a match is found in step 2a, apply the symbol interpretation to change the 397e9fcaa8aSmrgsemantics associated with the symbol in the Xkb key map. If no match is found, 398e9fcaa8aSmrgapply a default interpretation. 399e9fcaa8aSmrg </para> 400e9fcaa8aSmrg </listitem> 401e9fcaa8aSmrg </orderedlist> 402e9fcaa8aSmrg </listitem> 403e9fcaa8aSmrg</orderedlist> 404e9fcaa8aSmrg 405e9fcaa8aSmrg<para> 406e9fcaa8aSmrgThe symbol interpretations used in step 2 are configurable and may be specified 4070f8248bfSmrgusing 4080f8248bfSmrg<structname>XkbSymInterpretRec</structname> 4090f8248bfSmrgstructures referenced by the 4100f8248bfSmrg<structfield>sym_interpret</structfield> 4110f8248bfSmrgfield of an 4120f8248bfSmrg<structname>XkbCompatMapRec</structname> 4130f8248bfSmrg(see <link linkend="figure17.3">Figure 17.3</link>). 414e9fcaa8aSmrg</para> 415e9fcaa8aSmrg 416eb411b4bSmrg<sect3 id='Symbol_Interpretations__the_XkbSymInterpretRec_Structure'> 417e9fcaa8aSmrg<title>Symbol Interpretations — the XkbSymInterpretRec Structure</title> 4180f8248bfSmrg<indexterm significance="preferred" zone="Symbol_Interpretations__the_XkbSymInterpretRec_Structure"> 4190f8248bfSmrg<primary><structname>XkbSymInterpretRec</structname></primary></indexterm> 420e9fcaa8aSmrg 421e9fcaa8aSmrg<para> 422e9fcaa8aSmrgSymbol interpretations are used to guide the X server when it modifies the Xkb 423e9fcaa8aSmrgkeymap in step 2. An initial set of symbol interpretations is loaded by the 4240f8248bfSmrgserver when it starts. A client may add new ones using 4250f8248bfSmrg<function>XkbSetCompatMap</function> 4260f8248bfSmrg(see <link linkend="Changing_the_Servers_Compatibility_Map">section 17.4</link>). 427e9fcaa8aSmrg</para> 428e9fcaa8aSmrg 429e9fcaa8aSmrg 430e9fcaa8aSmrg<para> 431e9fcaa8aSmrgSymbol interpretations result in key semantics being set. When a symbol 432e9fcaa8aSmrginterpretation is applied, the following components of server key event 433e9fcaa8aSmrgprocessing may be modified for the particular key involved: 434e9fcaa8aSmrg 4350f8248bfSmrg <simplelist type='vert' columns='1'> 4360f8248bfSmrg <member>Virtual modifier map</member> 4370f8248bfSmrg <member>Auto repeat</member> 4380f8248bfSmrg <member>Key behavior (may be set to <symbol>XkbKB_Lock</symbol>)</member> 4390f8248bfSmrg <member>Key action (see <link linkend="Key_Actions">section 16.1</link>)</member> 4400f8248bfSmrg </simplelist> 4410f8248bfSmrg</para> 442e9fcaa8aSmrg 443e9fcaa8aSmrg<para> 4440f8248bfSmrgThe <structname>XkbSymInterpretRec</structname> 445e9fcaa8aSmrgstructure specifies a symbol interpretation: 446e9fcaa8aSmrg 4470f8248bfSmrg<programlisting> 448e9fcaa8aSmrgtypedef struct { 4490f8248bfSmrg KeySym sym; /* keysym of interest or <symbol>NULL</symbol> */ 4500f8248bfSmrg unsigned char flags; /* <symbol>XkbSI_AutoRepeat</symbol>, <symbol>XkbSI_LockingKey</symbol> */ 4510f8248bfSmrg unsigned char match; /* specifies how mods is interpreted */ 4520f8248bfSmrg unsigned char mods; /* modifier bits, correspond to 4530f8248bfSmrg eight real modifiers */ 4540f8248bfSmrg unsigned char virtual_mod; /* 1 modifier to add to key virtual mod map */ 4550f8248bfSmrg XkbAnyAction act; /* action to bind to symbol position on key */ 4560f8248bfSmrg} <structname>XkbSymInterpretRec</structname>,*XkbSymInterpretPtr; 457e9fcaa8aSmrg</programlisting></para> 458e9fcaa8aSmrg 459e9fcaa8aSmrg<para> 4600f8248bfSmrgIf 4610f8248bfSmrg<structfield>sym</structfield> 4620f8248bfSmrgis not 4630f8248bfSmrg<symbol>NULL</symbol>, 4640f8248bfSmrgit limits the symbol interpretation to keys on which that particular keysym 4650f8248bfSmrgis selected by the modifiers matching the criteria specified by 4660f8248bfSmrg<structfield>mods</structfield> 4670f8248bfSmrgand 4680f8248bfSmrg<structfield>match</structfield>. 4690f8248bfSmrgIf 4700f8248bfSmrg<structfield>sym</structfield> 4710f8248bfSmrgis 4720f8248bfSmrg<symbol>NULL</symbol>, 4730f8248bfSmrgthe interpretation may be applied to any symbol selected on a key when the 4740f8248bfSmrgmodifiers match the criteria specified by 4750f8248bfSmrg<structfield>mods</structfield> 4760f8248bfSmrgand 4770f8248bfSmrg<structfield>match</structfield>. 4780f8248bfSmrg</para> 4790f8248bfSmrg 4800f8248bfSmrg 4810f8248bfSmrg<para> 4820f8248bfSmrg<structfield>match</structfield> 4830f8248bfSmrgmust be one of the values shown in 4840f8248bfSmrg<link linkend="table17.1">Table 17.1</link> and specifies how the real 4850f8248bfSmrgmodifiers specified in <structfield>mods</structfield> 486e9fcaa8aSmrgare to be interpreted. 487e9fcaa8aSmrg</para> 488e9fcaa8aSmrg 4890f8248bfSmrg<table id='table17.1' frame='topbot'> 490e9fcaa8aSmrg<title>Symbol Interpretation Match Criteria</title> 491eb411b4bSmrg<?dbfo keep-together="always" ?> 492eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'> 493eb411b4bSmrg<colspec colname='c1' colwidth='2.0*'/> 494eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/> 495eb411b4bSmrg<colspec colname='c3' colwidth='3.0*'/> 496e9fcaa8aSmrg<thead> 497e9fcaa8aSmrg<row rowsep='1'> 498e9fcaa8aSmrg <entry>Match Criteria</entry> 499e9fcaa8aSmrg <entry>Value</entry> 500e9fcaa8aSmrg <entry>Effect</entry> 501e9fcaa8aSmrg </row> 502e9fcaa8aSmrg</thead> 503e9fcaa8aSmrg<tbody> 504eb411b4bSmrg <row> 5050f8248bfSmrg <entry><symbol>XkbSI_NoneOf</symbol></entry> 506e9fcaa8aSmrg <entry>(0)</entry> 507e9fcaa8aSmrg <entry> 5080f8248bfSmrgNone of the bits that are on in <structfield>mods</structfield> 5090f8248bfSmrgcan be set, but other bits can be. 510e9fcaa8aSmrg </entry> 511e9fcaa8aSmrg </row> 512eb411b4bSmrg <row> 5130f8248bfSmrg <entry><symbol>XkbSI_AnyOfOrNone</symbol></entry> 514e9fcaa8aSmrg <entry>(1)</entry> 515e9fcaa8aSmrg <entry> 5160f8248bfSmrgZero or more of the bits that are on in 5170f8248bfSmrg<structfield>mods</structfield> 5180f8248bfSmrgcan be set, as well as others. 519e9fcaa8aSmrg </entry> 520e9fcaa8aSmrg </row> 521eb411b4bSmrg <row> 5220f8248bfSmrg <entry><symbol>XkbSI_AnyOf</symbol></entry> 523e9fcaa8aSmrg <entry>(2)</entry> 524e9fcaa8aSmrg <entry> 5250f8248bfSmrgOne or more of the bits that are on in 5260f8248bfSmrg<structfield>mods</structfield> 5270f8248bfSmrgcan be set, as well as any others. 528e9fcaa8aSmrg </entry> 529e9fcaa8aSmrg </row> 530eb411b4bSmrg <row> 5310f8248bfSmrg <entry><symbol>XkbSI_AllOf</symbol></entry> 532e9fcaa8aSmrg <entry>(3)</entry> 533e9fcaa8aSmrg <entry> 5340f8248bfSmrgAll of the bits that are on in 5350f8248bfSmrg<structfield>mods</structfield> 5360f8248bfSmrgmust be set, but others may be set as well. 537e9fcaa8aSmrg </entry> 538e9fcaa8aSmrg </row> 539eb411b4bSmrg <row> 5400f8248bfSmrg <entry><symbol>XkbSI_Exactly</symbol></entry> 541e9fcaa8aSmrg <entry>(4)</entry> 542e9fcaa8aSmrg <entry> 5430f8248bfSmrgAll of the bits that are on in 5440f8248bfSmrg<structfield>mods</structfield> 5450f8248bfSmrgmust be set, and no other bits may be set. 546e9fcaa8aSmrg </entry> 547e9fcaa8aSmrg </row> 548e9fcaa8aSmrg</tbody> 549e9fcaa8aSmrg</tgroup> 550e9fcaa8aSmrg</table> 551e9fcaa8aSmrg 552e9fcaa8aSmrg<para> 5530f8248bfSmrgIn addition to the above bits, 5540f8248bfSmrg<structfield>match</structfield> 5550f8248bfSmrgmay contain the 5560f8248bfSmrg<symbol>XkbSI_LevelOneOnly</symbol> 5570f8248bfSmrgbit, in which case the modifier match criteria specified by 5580f8248bfSmrg<structfield>mods</structfield> 5590f8248bfSmrgand 5600f8248bfSmrg<structfield>match</structfield> 5610f8248bfSmrgapplies only if 5620f8248bfSmrg<structfield>sym</structfield> 5630f8248bfSmrgis in level one of its group; otherwise, 5640f8248bfSmrg<structfield>mods</structfield> 5650f8248bfSmrgand 5660f8248bfSmrg<structfield>match</structfield> 5670f8248bfSmrgare ignored and the symbol matches a condition where no modifiers are set. 568e9fcaa8aSmrg</para> 569e9fcaa8aSmrg 570e9fcaa8aSmrg<para><programlisting> 571e9fcaa8aSmrg#define XkbSI_LevelOneOnly (0x80) 572e9fcaa8aSmrg/* use mods + match only if sym is level 1 */ 573e9fcaa8aSmrg</programlisting></para> 574e9fcaa8aSmrg 575e9fcaa8aSmrg<para> 576e9fcaa8aSmrgIf no matching symbol interpretation is found, the server uses a default 577e9fcaa8aSmrginterpretation where: 578e9fcaa8aSmrg</para> 579e9fcaa8aSmrg 580e9fcaa8aSmrg<informaltable frame='none'> 581eb411b4bSmrg<?dbfo keep-together="always" ?> 582eb411b4bSmrg<tgroup cols='2' align='left' colsep='0' rowsep='0'> 583eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 584eb411b4bSmrg<colspec colname='c1' colwidth='3.0*'/> 585e9fcaa8aSmrg<tbody> 586eb411b4bSmrg <row> 5870f8248bfSmrg <entry><structfield>sym</structfield> =</entry> 588e9fcaa8aSmrg <entry>0</entry> 589e9fcaa8aSmrg </row> 590eb411b4bSmrg <row> 5910f8248bfSmrg <entry><structfield>flags</structfield> =</entry> 5920f8248bfSmrg <entry><symbol>XkbSI_AutoRepeat</symbol></entry> 593e9fcaa8aSmrg </row> 594eb411b4bSmrg <row> 5950f8248bfSmrg <entry><structfield>match</structfield> =</entry> 5960f8248bfSmrg <entry><symbol>XkbSI_AnyOfOrNone</symbol></entry> 597e9fcaa8aSmrg </row> 598eb411b4bSmrg <row> 5990f8248bfSmrg <entry><structfield>mods</structfield> =</entry> 600e9fcaa8aSmrg <entry>0</entry> 601e9fcaa8aSmrg </row> 602eb411b4bSmrg <row> 6030f8248bfSmrg <entry><structfield>virtual_mod</structfield> =</entry> 6040f8248bfSmrg <entry><symbol>XkbNoModifier</symbol></entry> 605e9fcaa8aSmrg </row> 606eb411b4bSmrg <row> 607e9fcaa8aSmrg 6080f8248bfSmrg <entry><structfield>act</structfield> =</entry> 609e9fcaa8aSmrg <entry><emphasis>SA_NoAction</emphasis></entry> 610e9fcaa8aSmrg </row> 611e9fcaa8aSmrg</tbody> 612e9fcaa8aSmrg</tgroup> 613e9fcaa8aSmrg</informaltable> 614e9fcaa8aSmrg 615e9fcaa8aSmrg<para> 616e9fcaa8aSmrgWhen a matching symbol interpretation is found in step 2a, the interpretation 617e9fcaa8aSmrgis applied to modify the Xkb map as follows. 618e9fcaa8aSmrg</para> 619e9fcaa8aSmrg 620e9fcaa8aSmrg<para> 6210f8248bfSmrgThe 6220f8248bfSmrg<structfield>act</structfield> 6230f8248bfSmrgfield specifies a single action to be bound to the symbol position; any key 624e9fcaa8aSmrgevent that selects the symbol causes the action to be taken. Valid actions are 6250f8248bfSmrgdefined in <link linkend="Key_Actions">section 16.1</link>. 626e9fcaa8aSmrg</para> 627e9fcaa8aSmrg 628e9fcaa8aSmrg 629e9fcaa8aSmrg<para> 6300f8248bfSmrgIf the Xkb keyboard map for the key does not have its 6310f8248bfSmrg<emphasis>ExplicitVModMap</emphasis> 6320f8248bfSmrgcontrol set, the 6330f8248bfSmrg<symbol>XkbSI_LevelOneOnly</symbol> 6340f8248bfSmrgbit and symbol position are examined. If the 6350f8248bfSmrg<symbol>XkbSI_LevelOneOnly</symbol> 6360f8248bfSmrgbit is not set in 6370f8248bfSmrg<structfield>match</structfield> 6380f8248bfSmrgor the symbol is in position G1L1, the 6390f8248bfSmrg<structfield>virtual_mod</structfield> 6400f8248bfSmrgfield is examined. If 6410f8248bfSmrg<structfield>virtual_mod</structfield> 6420f8248bfSmrgis not 6430f8248bfSmrg<symbol>XkbNoModifier</symbol>, 6440f8248bfSmrg<structfield>virtual_mod</structfield> 6450f8248bfSmrgspecifies a single virtual modifier to be added to the virtual modifier map 6460f8248bfSmrgfor the key. 6470f8248bfSmrg<structfield>virtual_mod</structfield> 6480f8248bfSmrgis specified as an index in the range [0..15]. 649e9fcaa8aSmrg</para> 650e9fcaa8aSmrg 651e9fcaa8aSmrg 652e9fcaa8aSmrg<para> 653e9fcaa8aSmrgIf the matching symbol is in position G1L1 of the key, two bits in the flags 654e9fcaa8aSmrgfield potentially specify additional behavior modifications: 655e9fcaa8aSmrg 6560f8248bfSmrg<programlisting> 6570f8248bfSmrg#define XkbSI_AutoRepeat (1<<0) /* key repeats if sym 6580f8248bfSmrg is in position G1L1 */ 6590f8248bfSmrg#define XkbSI_LockingKey (1<<1) /* set <emphasis>KB_Lock</emphasis> behavior 6600f8248bfSmrg if sym is in psn G1L1 */ 661e9fcaa8aSmrg</programlisting></para> 662e9fcaa8aSmrg 663e9fcaa8aSmrg<para> 6640f8248bfSmrgIf the Xkb keyboard map for the key does not have its 6650f8248bfSmrg<emphasis>ExplicitAutoRepeat</emphasis> 6660f8248bfSmrgcontrol set, its auto repeat behavior is set based on the value of the 6670f8248bfSmrg<symbol>XkbSI_AutoRepeat</symbol> 6680f8248bfSmrgbit. If the 6690f8248bfSmrg<symbol>XkbSI_AutoRepeat</symbol> 6700f8248bfSmrgbit is set, the auto-repeat behavior of the key is turned on; otherwise, it is 671e9fcaa8aSmrgturned off. 672e9fcaa8aSmrg</para> 673e9fcaa8aSmrg 674e9fcaa8aSmrg 675e9fcaa8aSmrg<para> 6760f8248bfSmrgIf the Xkb keyboard map for the key does not have its 6770f8248bfSmrg<emphasis>ExplicitBehavior</emphasis> 6780f8248bfSmrgcontrol set, its locking behavior is set based on the value of the 6790f8248bfSmrg<symbol>XkbSI_LockingKey</symbol> 6800f8248bfSmrgbit. If 6810f8248bfSmrg<symbol>XkbSI_LockingKey</symbol> 6820f8248bfSmrgis set, the key behavior is set to 6830f8248bfSmrg<emphasis>KB_Lock</emphasis>; 6840f8248bfSmrgotherwise, it is turned off (see <link linkend="Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server">section 16.3</link>). 685e9fcaa8aSmrg</para> 686e9fcaa8aSmrg 687e9fcaa8aSmrg 688e9fcaa8aSmrg</sect3> 689e9fcaa8aSmrg</sect2> 690eb411b4bSmrg<sect2 id='Xkb_Keyboard_Mapping_to_Core_Keyboard_Mapping_Transformations'> 691e9fcaa8aSmrg<title>Xkb Keyboard Mapping to Core Keyboard Mapping Transformations</title> 692e9fcaa8aSmrg 693e9fcaa8aSmrg<para> 694e9fcaa8aSmrgWhenever the server processes Xkb requests to change the keyboard mapping, it 695e9fcaa8aSmrgdiscards the affected portion of its core keyboard mapping and regenerates it 696e9fcaa8aSmrgbased on the new Xkb mapping. 697e9fcaa8aSmrg</para> 698e9fcaa8aSmrg 699e9fcaa8aSmrg 700e9fcaa8aSmrg<para> 701e9fcaa8aSmrgWhen the Xkb mapping for a key is transformed to a core protocol mapping, the 702e9fcaa8aSmrgsymbols for the core map are taken in the following order from the Xkb map: 703e9fcaa8aSmrg</para> 704e9fcaa8aSmrg 705e9fcaa8aSmrg 706e9fcaa8aSmrg<para> 707e9fcaa8aSmrgG1L1 G1L2 G2L1 G2L2 G1L3-n G2L3-n G3L1-n G4L1-n 708e9fcaa8aSmrg</para> 709e9fcaa8aSmrg 710e9fcaa8aSmrg 711e9fcaa8aSmrg<para> 712e9fcaa8aSmrgIf group one is of width one in the Xkb map, G1L2 is taken to be NoSymbol; 713e9fcaa8aSmrgsimilarly, if group two is of width one in the Xkb map, G2L2 is taken to be 714e9fcaa8aSmrgNoSymbol. 715e9fcaa8aSmrg</para> 716e9fcaa8aSmrg 717e9fcaa8aSmrg 718e9fcaa8aSmrg<para> 719e9fcaa8aSmrgIf the Xkb key map for a particular key has fewer groups than the core 720e9fcaa8aSmrgkeyboard, the symbols for group one are repeated to fill in the missing core 721e9fcaa8aSmrgcomponents. For example, an Xkb key with a single width-three group would be 722e9fcaa8aSmrgmapped to a core mapping counting three groups as: 723e9fcaa8aSmrg</para> 724e9fcaa8aSmrg 725e9fcaa8aSmrg 726e9fcaa8aSmrg<para> 727e9fcaa8aSmrgG1L1 G1L2 G1L1 G1L2 G1L3 G1L3 G1L1 G1L2 G1L3 728e9fcaa8aSmrg</para> 729e9fcaa8aSmrg 730e9fcaa8aSmrg 731e9fcaa8aSmrg<para> 732e9fcaa8aSmrgWhen a core keyboard map entry is generated from an Xkb keyboard map entry, a 733e9fcaa8aSmrgmodifier mapping is generated as well. The modifier mapping contains all of the 734e9fcaa8aSmrgmodifiers affected by any of the actions associated with the key combined with 735e9fcaa8aSmrgall of the real modifiers associated with any of the virtual modifiers bound to 736e9fcaa8aSmrgthe key. In addition, if any of the actions associated with the key affect any 7370f8248bfSmrgcomponent of the keyboard group, all of the modifiers in the 7380f8248bfSmrg<structfield>mask</structfield> 7390f8248bfSmrgfield of all of the group compatibility maps are added to the modifier mapping 7400f8248bfSmrgas well. While an 7410f8248bfSmrg<symbol>XkbSA_ISOLock</symbol> 7420f8248bfSmrgaction can theoretically affect any modifier, if the Xkb mapping for a key 7430f8248bfSmrgspecifies an 7440f8248bfSmrg<symbol>XkbSA_ISOLock</symbol> 7450f8248bfSmrgaction, only the modifiers or group that are set by default are added to the 746e9fcaa8aSmrgmodifier mapping. 747e9fcaa8aSmrg</para> 748e9fcaa8aSmrg 749e9fcaa8aSmrg 750e9fcaa8aSmrg</sect2> 751e9fcaa8aSmrg</sect1> 752eb411b4bSmrg<sect1 id='Getting_Compatibility_Map_Components_From_the_Server'> 753e9fcaa8aSmrg<title>Getting Compatibility Map Components From the Server</title> 754e9fcaa8aSmrg 755e9fcaa8aSmrg<para> 7560f8248bfSmrgUse 7570f8248bfSmrg<function>XkbGetCompatMap</function> 7580f8248bfSmrgto fetch any combination of the current compatibility map components from the 759e9fcaa8aSmrgserver. When another client modifies the compatibility map, you are notified if 7600f8248bfSmrgyou have selected for 7610f8248bfSmrg<symbol>XkbCompatMapNotify</symbol> 7620f8248bfSmrgevents (see <link linkend="Tracking_Changes_to_the_Compatibility_Map">section 17.5</link>). 7630f8248bfSmrg<function>XkbGetCompatMap</function> 7640f8248bfSmrgis particularly useful when you receive an event of this type, as it allows 765e9fcaa8aSmrgyou to update your program’s version of the compatibility map to match the 766e9fcaa8aSmrgmodified version now in the server. If your program is dealing with multiple 767e9fcaa8aSmrgservers and needs to configure them all in a similar manner, the updated 768e9fcaa8aSmrgcompatibility map may be used to reconfigure other servers. 769e9fcaa8aSmrg</para> 770e9fcaa8aSmrg 771e9fcaa8aSmrg<note><para>To make a complete matching configuration you must also update the 772e9fcaa8aSmrgexplicit override components of the server state.</para></note> 773e9fcaa8aSmrg 7740f8248bfSmrg<indexterm significance="preferred" zone="XkbGetCompatMap"><primary><function>XkbGetCompatMap</function></primary></indexterm> 7750f8248bfSmrg<funcsynopsis id="XkbGetCompatMap"> 7760f8248bfSmrg <funcprototype> 7770f8248bfSmrg <funcdef>Status <function>XkbGetCompatMap</function></funcdef> 7780f8248bfSmrg<!-- ( 7790f8248bfSmrg<parameter>display, which, xkb</parameter> 7800f8248bfSmrg) --> 7810f8248bfSmrg 7820f8248bfSmrg <paramdef>Display *<parameter>display</parameter></paramdef> 7830f8248bfSmrg <paramdef>unsigned int <parameter>which</parameter></paramdef> 7840f8248bfSmrg <paramdef>XkbDescRec *<parameter>xkb</parameter></paramdef> 7850f8248bfSmrg </funcprototype> 7860f8248bfSmrg</funcsynopsis> 7870f8248bfSmrg<variablelist> 7880f8248bfSmrg <varlistentry> 7890f8248bfSmrg <term> 7900f8248bfSmrg <parameter>display</parameter> 7910f8248bfSmrg </term> 7920f8248bfSmrg <listitem> 7930f8248bfSmrg <para> 7940f8248bfSmrg connection to server 7950f8248bfSmrg </para> 7960f8248bfSmrg </listitem> 7970f8248bfSmrg </varlistentry> 7980f8248bfSmrg <varlistentry> 7990f8248bfSmrg <term> 8000f8248bfSmrg <parameter>which</parameter> 8010f8248bfSmrg </term> 8020f8248bfSmrg <listitem> 8030f8248bfSmrg <para> 8040f8248bfSmrg mask of compatibility map components to fetch 8050f8248bfSmrg </para> 8060f8248bfSmrg </listitem> 8070f8248bfSmrg </varlistentry> 8080f8248bfSmrg <varlistentry> 8090f8248bfSmrg <term> 8100f8248bfSmrg <parameter>xkb</parameter> 8110f8248bfSmrg </term> 8120f8248bfSmrg <listitem> 8130f8248bfSmrg <para> 8140f8248bfSmrg keyboard description where results placed 8150f8248bfSmrg </para> 8160f8248bfSmrg </listitem> 8170f8248bfSmrg </varlistentry> 8180f8248bfSmrg</variablelist> 8190f8248bfSmrg 8200f8248bfSmrg<para> 8210f8248bfSmrg<function>XkbGetCompatMap</function> 8220f8248bfSmrgfetches the components of the compatibility map specified in 8230f8248bfSmrg<parameter>which</parameter> 8240f8248bfSmrgfrom the server specified by 8250f8248bfSmrg<parameter>display</parameter> 8260f8248bfSmrgand places them in the 8270f8248bfSmrg<structfield>compat</structfield> 8280f8248bfSmrgstructure of the keyboard description 8290f8248bfSmrg<parameter>xkb</parameter>. 8300f8248bfSmrgValid values for 8310f8248bfSmrg<parameter>which</parameter> 8320f8248bfSmrgare an inclusive OR of the values shown in 8330f8248bfSmrg<link linkend="table17.2">Table 17.2</link>. 8340f8248bfSmrg</para> 8350f8248bfSmrg 8360f8248bfSmrg<table id='table17.2' frame='topbot'> 837e9fcaa8aSmrg<title>Compatibility Map Component Masks</title> 838eb411b4bSmrg<?dbfo keep-together="always" ?> 839eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'> 840eb411b4bSmrg<colspec colname='c1' colwidth='1.5*'/> 841eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/> 842eb411b4bSmrg<colspec colname='c3' colwidth='2.0*'/> 843e9fcaa8aSmrg<thead> 844eb411b4bSmrg<row rowsep='1'> 845e9fcaa8aSmrg <entry>Mask</entry> 846e9fcaa8aSmrg <entry>Value</entry> 847e9fcaa8aSmrg <entry>Affecting</entry> 848e9fcaa8aSmrg </row> 849e9fcaa8aSmrg</thead> 850e9fcaa8aSmrg<tbody> 851eb411b4bSmrg <row> 8520f8248bfSmrg <entry><symbol>XkbSymInterpMask</symbol></entry> 853e9fcaa8aSmrg <entry>(1<<0)</entry> 854e9fcaa8aSmrg <entry>Symbol interpretations</entry> 855e9fcaa8aSmrg </row> 856eb411b4bSmrg <row> 8570f8248bfSmrg <entry><symbol>XkbGroupCompatMask</symbol></entry> 858e9fcaa8aSmrg <entry>(1<<1)</entry> 859e9fcaa8aSmrg <entry>Group maps</entry> 860e9fcaa8aSmrg </row> 861eb411b4bSmrg <row> 8620f8248bfSmrg <entry><symbol>XkbAllCompatMask</symbol></entry> 863e9fcaa8aSmrg <entry>(0x3)</entry> 864e9fcaa8aSmrg <entry>All compatibility map components</entry> 865e9fcaa8aSmrg </row> 866e9fcaa8aSmrg</tbody> 867e9fcaa8aSmrg</tgroup> 868e9fcaa8aSmrg</table> 869e9fcaa8aSmrg 870e9fcaa8aSmrg<para> 8710f8248bfSmrgIf no compatibility map structure is allocated in 8720f8248bfSmrg<parameter>xkb</parameter> 8730f8248bfSmrgupon entry, 8740f8248bfSmrg<function>XkbGetCompatMap</function> 8750f8248bfSmrgallocates one. If one already exists, its contents are overwritten with the 876e9fcaa8aSmrgreturned results. 877e9fcaa8aSmrg</para> 878e9fcaa8aSmrg 879e9fcaa8aSmrg 880e9fcaa8aSmrg<para> 8810f8248bfSmrg<function>XkbGetCompatMap</function> 8820f8248bfSmrgfetches compatibility map information for the device specified by the 8830f8248bfSmrg<structfield>device_spec</structfield> 8840f8248bfSmrgfield of 8850f8248bfSmrg<parameter>xkb</parameter>. 8860f8248bfSmrgUnless you have specifically modified this field, it is the default keyboard 8870f8248bfSmrgdevice. 8880f8248bfSmrg<function>XkbGetCompatMap</function> 8890f8248bfSmrgreturns 8900f8248bfSmrg<symbol>Success</symbol> 8910f8248bfSmrgif successful, 8920f8248bfSmrg<errorname>BadAlloc</errorname> 8930f8248bfSmrgif it is unable to obtain necessary storage for either the return values or 8940f8248bfSmrgwork space, 8950f8248bfSmrg<errorname>BadMatch</errorname> 8960f8248bfSmrgif the 8970f8248bfSmrg<structfield>dpy</structfield> 8980f8248bfSmrgfield of the 8990f8248bfSmrg<parameter>xkb</parameter> 9000f8248bfSmrgargument is non- 9010f8248bfSmrg<symbol>NULL</symbol> 9020f8248bfSmrgand does not match the 9030f8248bfSmrg<parameter>display</parameter> 9040f8248bfSmrgargument, and 9050f8248bfSmrg<errorname>BadLength</errorname> 9060f8248bfSmrgunder certain conditions caused by server or Xkb implementation errors. 907e9fcaa8aSmrg</para> 908e9fcaa8aSmrg 909e9fcaa8aSmrg 910e9fcaa8aSmrg</sect1> 911eb411b4bSmrg<sect1 id='Using_the_Compatibility_Map'> 912e9fcaa8aSmrg<title>Using the Compatibility Map</title> 913e9fcaa8aSmrg 914e9fcaa8aSmrg<para> 915e9fcaa8aSmrgXkb provides several functions that make it easier to apply the compatibility 916e9fcaa8aSmrgmap to configure a client-side Xkb keyboard mapping, given a core protocol 917e9fcaa8aSmrgrepresentation of part or all of a keyboard mapping. Obtain a core protocol 9180f8248bfSmrgrepresentation of a keyboard mapping from an actual server (by using 9190f8248bfSmrg<function>XGetKeyboardMapping</function>, 9200f8248bfSmrgfor example), a data file, or some other source. 921e9fcaa8aSmrg</para> 922e9fcaa8aSmrg 923e9fcaa8aSmrg<para> 924e9fcaa8aSmrgTo update a local Xkb keyboard map to reflect the mapping expressed by a core 9250f8248bfSmrgformat mapping by calling the function 9260f8248bfSmrg<function>XkbUpdateMapFromCore</function>. 9270f8248bfSmrg</para> 9280f8248bfSmrg 9290f8248bfSmrg<indexterm significance="preferred" zone="XkbUpdateMapFromCore"><primary><function>XkbUpdateMapFromCore</function></primary></indexterm> 9300f8248bfSmrg<funcsynopsis id="XkbUpdateMapFromCore"> 9310f8248bfSmrg <funcprototype> 9320f8248bfSmrg <funcdef>Bool <function>XkbUpdateMapFromCore</function></funcdef> 9330f8248bfSmrg<!-- ( 9340f8248bfSmrg<parameter>xkb</parameter>, 9350f8248bfSmrg<parameter>first_key</parameter>, 9360f8248bfSmrg<parameter>num_keys</parameter>, 9370f8248bfSmrg<parameter>map_width</parameter>, 9380f8248bfSmrg<parameter>core_keysyms</parameter>, 9390f8248bfSmrg<parameter>changes</parameter> 9400f8248bfSmrg) --> 9410f8248bfSmrg 9420f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 9430f8248bfSmrg <paramdef>KeyCode <parameter>first_key</parameter></paramdef> 9440f8248bfSmrg <paramdef>int <parameter>num_keys</parameter></paramdef> 9450f8248bfSmrg <paramdef>int <parameter>map_width</parameter></paramdef> 9460f8248bfSmrg <paramdef>KeySym *<parameter>core_keysyms</parameter></paramdef> 9470f8248bfSmrg <paramdef>XkbChangesPtr <parameter>changes</parameter></paramdef> 9480f8248bfSmrg </funcprototype> 9490f8248bfSmrg</funcsynopsis> 9500f8248bfSmrg<variablelist> 9510f8248bfSmrg <varlistentry> 9520f8248bfSmrg <term> 9530f8248bfSmrg <parameter>xkb</parameter> 9540f8248bfSmrg </term> 9550f8248bfSmrg <listitem> 9560f8248bfSmrg <para> 9570f8248bfSmrg keyboard description to update 9580f8248bfSmrg </para> 9590f8248bfSmrg </listitem> 9600f8248bfSmrg </varlistentry> 9610f8248bfSmrg <varlistentry> 9620f8248bfSmrg <term> 9630f8248bfSmrg <parameter>first_key</parameter> 9640f8248bfSmrg </term> 9650f8248bfSmrg <listitem> 9660f8248bfSmrg <para> 9670f8248bfSmrg keycode of first key description to update 9680f8248bfSmrg </para> 9690f8248bfSmrg </listitem> 9700f8248bfSmrg </varlistentry> 9710f8248bfSmrg <varlistentry> 9720f8248bfSmrg <term> 9730f8248bfSmrg <parameter>num_keys</parameter> 9740f8248bfSmrg </term> 9750f8248bfSmrg <listitem> 9760f8248bfSmrg <para> 9770f8248bfSmrg number of key descriptions to update 9780f8248bfSmrg </para> 9790f8248bfSmrg </listitem> 9800f8248bfSmrg </varlistentry> 9810f8248bfSmrg <varlistentry> 9820f8248bfSmrg <term> 9830f8248bfSmrg <parameter>map_width</parameter> 9840f8248bfSmrg </term> 9850f8248bfSmrg <listitem> 9860f8248bfSmrg <para> 9870f8248bfSmrg width of core protocol keymap 9880f8248bfSmrg </para> 9890f8248bfSmrg </listitem> 9900f8248bfSmrg </varlistentry> 9910f8248bfSmrg <varlistentry> 9920f8248bfSmrg <term> 9930f8248bfSmrg <parameter>core_keysyms</parameter> 9940f8248bfSmrg </term> 9950f8248bfSmrg <listitem> 9960f8248bfSmrg <para> 9970f8248bfSmrg symbols in core protocol keymap 9980f8248bfSmrg </para> 9990f8248bfSmrg </listitem> 10000f8248bfSmrg </varlistentry> 10010f8248bfSmrg <varlistentry> 10020f8248bfSmrg <term> 10030f8248bfSmrg <parameter>changes</parameter> 10040f8248bfSmrg </term> 10050f8248bfSmrg <listitem> 10060f8248bfSmrg <para> 10070f8248bfSmrg backfilled with changes made to Xkb 10080f8248bfSmrg </para> 10090f8248bfSmrg </listitem> 10100f8248bfSmrg </varlistentry> 10110f8248bfSmrg</variablelist> 10120f8248bfSmrg 10130f8248bfSmrg<para> 10140f8248bfSmrg<function>XkbUpdateMapFromCore</function> 10150f8248bfSmrginterprets input argument information representing a keyboard map in core 10160f8248bfSmrgformat to update the Xkb keyboard description passed in 10170f8248bfSmrg<parameter>xkb</parameter>. 10180f8248bfSmrgOnly a portion of the Xkb map is updated — the portion corresponding to 10190f8248bfSmrgkeys with keycodes in the range 10200f8248bfSmrg<parameter>first_key</parameter> 10210f8248bfSmrgthrough 10220f8248bfSmrg<parameter>first_key</parameter> 10230f8248bfSmrg+ 10240f8248bfSmrg<parameter>num_keys</parameter> 10250f8248bfSmrg- 1. If 10260f8248bfSmrg<function>XkbUpdateMapFromCore</function> 10270f8248bfSmrgis being called in response to a 10280f8248bfSmrg<symbol>MappingNotify</symbol> 10290f8248bfSmrgevent, 10300f8248bfSmrg<parameter>first_key</parameter> 10310f8248bfSmrgand 10320f8248bfSmrg<parameter>num_keys</parameter> 10330f8248bfSmrgare reported in the 10340f8248bfSmrg<symbol>MappingNotify</symbol> 10350f8248bfSmrgevent. 10360f8248bfSmrg<parameter>core_keysyms</parameter> 10370f8248bfSmrgcontains the keysyms corresponding to the keycode range being updated, in core 10380f8248bfSmrgkeyboard description order. 10390f8248bfSmrg<parameter>map_width</parameter> 10400f8248bfSmrgis the number of keysyms per key in 10410f8248bfSmrg<parameter>core_keysyms</parameter>. 10420f8248bfSmrgThus, the first 10430f8248bfSmrg<parameter>map_width</parameter> 10440f8248bfSmrgentries in 10450f8248bfSmrg<parameter>core_keysyms</parameter> 10460f8248bfSmrgare for the key with keycode 10470f8248bfSmrg<parameter>first_key</parameter>, 10480f8248bfSmrgthe next 10490f8248bfSmrg<parameter>map_width</parameter> 10500f8248bfSmrgentries are for key 10510f8248bfSmrg<parameter>first_key</parameter> 10520f8248bfSmrg+ 1, and so on. 10530f8248bfSmrg</para> 10540f8248bfSmrg 10550f8248bfSmrg 10560f8248bfSmrg<para> 10570f8248bfSmrgIn addition to modifying the Xkb keyboard mapping in 10580f8248bfSmrg<parameter>xkb</parameter>, 10590f8248bfSmrg<function>XkbUpdateMapFromCore</function> 10600f8248bfSmrgbackfills the changes structure whose address is passed in 10610f8248bfSmrg<parameter>changes</parameter> 10620f8248bfSmrgto indicate the modifications that were made. You may then use 10630f8248bfSmrg<parameter>changes</parameter> 10640f8248bfSmrgin subsequent calls such as 10650f8248bfSmrg<function>XkbSetMap</function>, 10660f8248bfSmrgto propagate the local modifications to a server. 1067e9fcaa8aSmrg</para> 1068e9fcaa8aSmrg 1069e9fcaa8aSmrg 1070e9fcaa8aSmrg<para> 1071e9fcaa8aSmrgWhen dealing with core keyboard mappings or descriptions, it is sometimes 1072e9fcaa8aSmrgnecessary to determine the Xkb key types appropriate for the symbols bound to a 10730f8248bfSmrgkey in a core keyboard mapping. Use 10740f8248bfSmrg<function>XkbKeyTypesForCoreSymbols</function> 10750f8248bfSmrgfor this purpose: 10760f8248bfSmrg</para> 10770f8248bfSmrg 10780f8248bfSmrg 10790f8248bfSmrg<indexterm significance="preferred" zone="XkbKeyTypesForCoreSymbols"><primary><function>XkbKeyTypesForCoreSymbols</function></primary></indexterm> 10800f8248bfSmrg<funcsynopsis id="XkbKeyTypesForCoreSymbols"> 10810f8248bfSmrg <funcprototype> 10820f8248bfSmrg <funcdef>int <function>XkbKeyTypesForCoreSymbols</function></funcdef> 10830f8248bfSmrg<!-- ( 10840f8248bfSmrg<parameter>map_width</parameter>, 10850f8248bfSmrg<parameter>core_syms</parameter>, 10860f8248bfSmrg<parameter>protected, types_inout, xkb_syms_rtrn</parameter> 10870f8248bfSmrg) --> 10880f8248bfSmrg 10890f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 10900f8248bfSmrg <paramdef>int <parameter>map_width</parameter></paramdef> 10910f8248bfSmrg <paramdef>KeySym *<parameter>core_syms</parameter></paramdef> 10920f8248bfSmrg <paramdef>unsigned int <parameter>protected</parameter></paramdef> 10930f8248bfSmrg <paramdef>int *<parameter>types_inout</parameter></paramdef> 10940f8248bfSmrg <paramdef>KeySym *<parameter>xkb_syms_rtrn</parameter></paramdef> 10950f8248bfSmrg </funcprototype> 10960f8248bfSmrg</funcsynopsis> 10970f8248bfSmrg<variablelist> 10980f8248bfSmrg <varlistentry> 10990f8248bfSmrg <term> 11000f8248bfSmrg <parameter>xkb</parameter> 11010f8248bfSmrg </term> 11020f8248bfSmrg <listitem> 11030f8248bfSmrg <para> 11040f8248bfSmrg keyboard description in which to place symbols 11050f8248bfSmrg </para> 11060f8248bfSmrg </listitem> 11070f8248bfSmrg </varlistentry> 11080f8248bfSmrg <varlistentry> 11090f8248bfSmrg <term> 11100f8248bfSmrg <parameter>map_width</parameter> 11110f8248bfSmrg </term> 11120f8248bfSmrg <listitem> 11130f8248bfSmrg <para> 11140f8248bfSmrg width of core protocol keymap in <parameter>xkb_syms_rtrn</parameter> 11150f8248bfSmrg </para> 11160f8248bfSmrg </listitem> 11170f8248bfSmrg </varlistentry> 11180f8248bfSmrg <varlistentry> 11190f8248bfSmrg <term> 11200f8248bfSmrg <parameter>core_syms</parameter> 11210f8248bfSmrg </term> 11220f8248bfSmrg <listitem> 11230f8248bfSmrg <para> 11240f8248bfSmrg core protocol format array of KeySyms 11250f8248bfSmrg </para> 11260f8248bfSmrg </listitem> 11270f8248bfSmrg </varlistentry> 11280f8248bfSmrg <varlistentry> 11290f8248bfSmrg <term> 11300f8248bfSmrg <parameter>protected</parameter> 11310f8248bfSmrg </term> 11320f8248bfSmrg <listitem> 11330f8248bfSmrg <para> 11340f8248bfSmrg explicit key types 11350f8248bfSmrg </para> 11360f8248bfSmrg </listitem> 11370f8248bfSmrg </varlistentry> 11380f8248bfSmrg <varlistentry> 11390f8248bfSmrg <term> 11400f8248bfSmrg <parameter>types_inout</parameter> 11410f8248bfSmrg </term> 11420f8248bfSmrg <listitem> 11430f8248bfSmrg <para> 11440f8248bfSmrg backfilled with the canonical types bound to groups one and two 11450f8248bfSmrg for the key 11460f8248bfSmrg </para> 11470f8248bfSmrg </listitem> 11480f8248bfSmrg </varlistentry> 11490f8248bfSmrg <varlistentry> 11500f8248bfSmrg <term> 11510f8248bfSmrg <parameter>xkb_syms_rtrn</parameter> 11520f8248bfSmrg </term> 11530f8248bfSmrg <listitem> 11540f8248bfSmrg <para> 11550f8248bfSmrg backfilled with symbols bound to the key in the Xkb mapping 11560f8248bfSmrg </para> 11570f8248bfSmrg </listitem> 11580f8248bfSmrg </varlistentry> 11590f8248bfSmrg</variablelist> 11600f8248bfSmrg 11610f8248bfSmrg<para> 11620f8248bfSmrg<function>XkbKeyTypesForCoreSymbols</function> 11630f8248bfSmrgexpands the symbols in 11640f8248bfSmrg<parameter>core_syms</parameter> 11650f8248bfSmrgand types in 11660f8248bfSmrg<parameter>types_inout</parameter> 11670f8248bfSmrgaccording to the rules specified in section 12 of the core protocol, then 11680f8248bfSmrgchooses canonical key types (canonical key types are defined in <link linkend="The_Canonical_Key_Types">section 15.2.1</link>) 1169e9fcaa8aSmrgfor groups 1 and 2 using the rules specified by the Xkb protocol and places 11700f8248bfSmrgthem in 11710f8248bfSmrg<parameter>xkb_syms_rtrn</parameter>, 11720f8248bfSmrgwhich will be non- 11730f8248bfSmrg<symbol>NULL</symbol>. 1174e9fcaa8aSmrg</para> 1175e9fcaa8aSmrg 1176e9fcaa8aSmrg 1177e9fcaa8aSmrg<para> 11780f8248bfSmrgA core keymap is a two-dimensional array of keysyms. It has 11790f8248bfSmrg<parameter>map_width</parameter> 11800f8248bfSmrgcolumns and 11810f8248bfSmrg<structfield>max_key_code</structfield> 11820f8248bfSmrgrows. 11830f8248bfSmrg<function>XkbKeyTypesForCoreSymbols</function> 11840f8248bfSmrgtakes a single row from a core keymap, determines the number of groups 1185e9fcaa8aSmrgassociated with it, the type of each group, and the symbols bound to each 11860f8248bfSmrggroup. The return value is the number of groups, 11870f8248bfSmrg<parameter>types_inout</parameter> 11880f8248bfSmrghas the types for each group, and 11890f8248bfSmrg<parameter>xkb_syms_rtrn</parameter> 11900f8248bfSmrghas the symbols in Xkb order (that is, groups are contiguous, regardless of 1191e9fcaa8aSmrgsize). 1192e9fcaa8aSmrg</para> 1193e9fcaa8aSmrg 1194e9fcaa8aSmrg 1195e9fcaa8aSmrg<para> 11960f8248bfSmrg<parameter>protected</parameter> 11970f8248bfSmrgcontains the explicitly protected key types. There is one explicit override 1198e9fcaa8aSmrgcontrol associated with each of the four possible groups for each Xkb key, 11990f8248bfSmrg<emphasis>ExplicitKeyType1</emphasis> 12000f8248bfSmrgthrough 12010f8248bfSmrg<emphasis>ExplicitKeyType4</emphasis>; 12020f8248bfSmrg<parameter>protected</parameter> 12030f8248bfSmrgis an inclusive OR of these controls. 12040f8248bfSmrg<parameter>map_width</parameter> 12050f8248bfSmrgis the width of the core keymap and is not dependent on any Xkb definitions. 12060f8248bfSmrg<parameter>types_inout</parameter> 12070f8248bfSmrgis an array of four type indices. On input, 12080f8248bfSmrg<parameter>types_inout</parameter> 12090f8248bfSmrgcontains the indices of any types already assigned to the key, in case they 1210e9fcaa8aSmrgare explicitly protected from change. 1211e9fcaa8aSmrg</para> 1212e9fcaa8aSmrg 1213e9fcaa8aSmrg 1214e9fcaa8aSmrg<para> 12150f8248bfSmrgUpon return, 12160f8248bfSmrg<parameter>types_inout</parameter> 12170f8248bfSmrgcontains any automatically selected (that is, canonical) types plus any 1218e9fcaa8aSmrgprotected types. Canonical types are assigned to all four groups if there are 12190f8248bfSmrgenough symbols to do so. The four entries in 12200f8248bfSmrg<parameter>types_inout</parameter> 12210f8248bfSmrgcorrespond to the four groups for the key in question. 1222e9fcaa8aSmrg</para> 1223e9fcaa8aSmrg 1224e9fcaa8aSmrg 1225e9fcaa8aSmrg<para> 1226e9fcaa8aSmrgIf the groups mapping does not change, but the symbols assigned to an Xkb 1227e9fcaa8aSmrgkeyboard compatibility map do change, the semantics of the key may be modified. 1228e9fcaa8aSmrgTo apply the new compatibility mapping to an individual key to get its 12290f8248bfSmrgsemantics updated, use 12300f8248bfSmrg<function>XkbApplyCompatMapToKey</function>. 12310f8248bfSmrg</para> 12320f8248bfSmrg 12330f8248bfSmrg 12340f8248bfSmrg<indexterm significance="preferred" zone="XkbApplyCompatMapToKey"><primary><function>XkbApplyCompatMapToKey</function></primary></indexterm> 12350f8248bfSmrg<funcsynopsis id="XkbApplyCompatMapToKey"> 12360f8248bfSmrg <funcprototype> 12370f8248bfSmrg <funcdef>Bool <function>XkbApplyCompatMapToKey</function></funcdef> 12380f8248bfSmrg<!-- ( 12390f8248bfSmrg<parameter>xkb</parameter>, 12400f8248bfSmrg<parameter>key</parameter>, 12410f8248bfSmrg<parameter>changes</parameter> 12420f8248bfSmrg) --> 12430f8248bfSmrg 12440f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 12450f8248bfSmrg <paramdef>KeyCode <parameter>key</parameter></paramdef> 12460f8248bfSmrg <paramdef>XkbChangesPtr <parameter>changes</parameter></paramdef> 12470f8248bfSmrg </funcprototype> 12480f8248bfSmrg</funcsynopsis> 12490f8248bfSmrg<variablelist> 12500f8248bfSmrg <varlistentry> 12510f8248bfSmrg <term> 12520f8248bfSmrg <parameter>xkb</parameter> 12530f8248bfSmrg </term> 12540f8248bfSmrg <listitem> 12550f8248bfSmrg <para> 12560f8248bfSmrg keyboard description to be updated 12570f8248bfSmrg </para> 12580f8248bfSmrg </listitem> 12590f8248bfSmrg </varlistentry> 12600f8248bfSmrg <varlistentry> 12610f8248bfSmrg <term> 12620f8248bfSmrg <parameter>key</parameter> 12630f8248bfSmrg </term> 12640f8248bfSmrg <listitem> 12650f8248bfSmrg <para> 12660f8248bfSmrg key to be updated 12670f8248bfSmrg </para> 12680f8248bfSmrg </listitem> 12690f8248bfSmrg </varlistentry> 12700f8248bfSmrg <varlistentry> 12710f8248bfSmrg <term> 12720f8248bfSmrg <parameter>changes</parameter> 12730f8248bfSmrg </term> 12740f8248bfSmrg <listitem> 12750f8248bfSmrg <para> 12760f8248bfSmrg notes changes to the Xkb keyboard description 12770f8248bfSmrg </para> 12780f8248bfSmrg </listitem> 12790f8248bfSmrg </varlistentry> 12800f8248bfSmrg</variablelist> 12810f8248bfSmrg 12820f8248bfSmrg<para> 12830f8248bfSmrg<function>XkbApplyCompatMapToKey</function> 12840f8248bfSmrgessentially performs the operation described in <link linkend="Core_Keyboard_Mapping_to_Xkb_Keyboard_Mapping_Transformation">section 17.1.2</link> to a specific 1285e9fcaa8aSmrgkey. This updates the behavior, actions, repeat status, and virtual modifier 1286e9fcaa8aSmrgbindings of the key. 1287e9fcaa8aSmrg</para> 1288e9fcaa8aSmrg 1289e9fcaa8aSmrg 1290e9fcaa8aSmrg</sect1> 1291eb411b4bSmrg<sect1 id='Changing_the_Servers_Compatibility_Map'> 1292e9fcaa8aSmrg<title>Changing the Server’s Compatibility Map</title> 1293e9fcaa8aSmrg 1294e9fcaa8aSmrg<para> 1295e9fcaa8aSmrgTo modify the server’s compatibility map, first modify a local copy of the 12960f8248bfSmrgXkb compatibility map, then call 12970f8248bfSmrg<function>XkbSetCompatMap</function>. 12980f8248bfSmrgYou may allocate a new compatibility map for this purpose using 12990f8248bfSmrg<function>XkbAllocCompatMap</function> 13000f8248bfSmrg(see <link linkend="Allocating_and_Freeing_the_Compatibility_Map">section 17.6</link>). You may also use a compatibility map from another server, 13010f8248bfSmrgalthough you need to adjust the 13020f8248bfSmrg<structfield>device_spec</structfield> 13030f8248bfSmrgfield in the 13040f8248bfSmrg<structname>XkbDescRec</structname> 13050f8248bfSmrgaccordingly. Note that symbol interpretations in a compatibility map 13060f8248bfSmrg( 13070f8248bfSmrg<structfield>sym_interpret</structfield>, 13080f8248bfSmrgthe vector of 13090f8248bfSmrg<structname>XkbSymInterpretRec</structname> 13100f8248bfSmrgstructures) are also allocated using this same function. 13110f8248bfSmrg</para> 13120f8248bfSmrg 13130f8248bfSmrg<indexterm significance="preferred" zone="XkbSetCompatMap"><primary><function>XkbSetCompatMap</function></primary></indexterm> 13140f8248bfSmrg<funcsynopsis id="XkbSetCompatMap"> 13150f8248bfSmrg <funcprototype> 13160f8248bfSmrg <funcdef>Bool <function>XkbSetCompatMap</function></funcdef> 13170f8248bfSmrg<!-- ( 13180f8248bfSmrg<parameter>display, which, xkb, update_actions</parameter> 13190f8248bfSmrg) --> 13200f8248bfSmrg 13210f8248bfSmrg <paramdef>Display *<parameter>display</parameter></paramdef> 13220f8248bfSmrg <paramdef>unsigned int <parameter>which</parameter></paramdef> 13230f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 13240f8248bfSmrg <paramdef>Bool <parameter>update_actions</parameter></paramdef> 13250f8248bfSmrg </funcprototype> 13260f8248bfSmrg</funcsynopsis> 13270f8248bfSmrg<variablelist> 13280f8248bfSmrg <varlistentry> 13290f8248bfSmrg <term> 13300f8248bfSmrg <parameter>display</parameter> 13310f8248bfSmrg </term> 13320f8248bfSmrg <listitem> 13330f8248bfSmrg <para> 13340f8248bfSmrg connection to server 13350f8248bfSmrg </para> 13360f8248bfSmrg </listitem> 13370f8248bfSmrg </varlistentry> 13380f8248bfSmrg <varlistentry> 13390f8248bfSmrg <term> 13400f8248bfSmrg <parameter>which</parameter> 13410f8248bfSmrg </term> 13420f8248bfSmrg <listitem> 13430f8248bfSmrg <para> 13440f8248bfSmrg mask of compat map components to set 13450f8248bfSmrg </para> 13460f8248bfSmrg </listitem> 13470f8248bfSmrg </varlistentry> 13480f8248bfSmrg <varlistentry> 13490f8248bfSmrg <term> 13500f8248bfSmrg <parameter>xkb</parameter> 13510f8248bfSmrg </term> 13520f8248bfSmrg <listitem> 13530f8248bfSmrg <para> 13540f8248bfSmrg source for compat map components 13550f8248bfSmrg </para> 13560f8248bfSmrg </listitem> 13570f8248bfSmrg </varlistentry> 13580f8248bfSmrg <varlistentry> 13590f8248bfSmrg <term> 13600f8248bfSmrg <parameter>update_actions</parameter> 13610f8248bfSmrg </term> 13620f8248bfSmrg <listitem> 13630f8248bfSmrg <para> 13640f8248bfSmrg <symbol>True</symbol> ⇒ apply to server’s keyboard map 13650f8248bfSmrg </para> 13660f8248bfSmrg </listitem> 13670f8248bfSmrg </varlistentry> 13680f8248bfSmrg</variablelist> 13690f8248bfSmrg 13700f8248bfSmrg<para> 13710f8248bfSmrg<function>XkbSetCompatMap</function> 13720f8248bfSmrgcopies compatibility map information from the keyboard description in 13730f8248bfSmrg<parameter>xkb</parameter> 13740f8248bfSmrgto the server specified in 13750f8248bfSmrg<parameter>display</parameter>’s 13760f8248bfSmrgcompatibility map for the device specified by the 13770f8248bfSmrg<structfield>device_spec</structfield> 13780f8248bfSmrgfield of 13790f8248bfSmrg<parameter>xkb</parameter>. 13800f8248bfSmrgUnless you have specifically modified this field, it is the default keyboard 13810f8248bfSmrgdevice. 13820f8248bfSmrg<parameter>which</parameter> 13830f8248bfSmrgspecifies the compatibility map components to be set, and is an inclusive OR 13840f8248bfSmrgof the bits shown in <link linkend="table17.2">Table 17.2</link>. 13850f8248bfSmrg</para> 13860f8248bfSmrg 13870f8248bfSmrg 13880f8248bfSmrg<para> 13890f8248bfSmrgAfter updating its compatibility map for the specified device, if 13900f8248bfSmrg<parameter>update_actions</parameter> 13910f8248bfSmrgis 13920f8248bfSmrg<symbol>True</symbol>, 13930f8248bfSmrgthe server applies the new compatibility map to its entire keyboard for the 1394e9fcaa8aSmrgdevice to generate a new set of key semantics, compatibility state, and a new 13950f8248bfSmrgcore keyboard map. If 13960f8248bfSmrg<parameter>update_actions</parameter> 13970f8248bfSmrgis 13980f8248bfSmrg<symbol>False</symbol>, 13990f8248bfSmrgthe new compatibility map is not used to generate any modifications to the 1400e9fcaa8aSmrgcurrent device semantics, state, or core keyboard map. One reason for not 1401e9fcaa8aSmrgapplying the compatibility map immediately would be if one server was being 1402e9fcaa8aSmrgconfigured to match another on a piecemeal basis; the map should not be applied 14030f8248bfSmrguntil everything is updated. To force an update at a later time, use 14040f8248bfSmrg<function>XkbSetCompatMap</function> 14050f8248bfSmrgspecifying 14060f8248bfSmrg<parameter>which</parameter> 14070f8248bfSmrgas zero and 14080f8248bfSmrg<parameter>update_actions</parameter> 14090f8248bfSmrgas 14100f8248bfSmrg<symbol>True</symbol>. 1411e9fcaa8aSmrg</para> 1412e9fcaa8aSmrg 1413e9fcaa8aSmrg 1414e9fcaa8aSmrg<para> 14150f8248bfSmrg<function>XkbSetCompatMap</function> 14160f8248bfSmrgreturns 14170f8248bfSmrg<symbol>True</symbol> 14180f8248bfSmrgif successful and 14190f8248bfSmrg<symbol>False</symbol> 14200f8248bfSmrgif unsuccessful. The server may report problems it encounters when processing 14210f8248bfSmrgthe request subsequently via protocol errors. 1422e9fcaa8aSmrg</para> 1423e9fcaa8aSmrg 1424e9fcaa8aSmrg 1425e9fcaa8aSmrg<para> 14260f8248bfSmrgTo add a symbol interpretation to the list of symbol interpretations in an 14270f8248bfSmrg<structname>XkbCompatRec</structname>, 14280f8248bfSmrguse 14290f8248bfSmrg<function>XkbAddSymInterpret</function>. 14300f8248bfSmrg</para> 14310f8248bfSmrg 14320f8248bfSmrg 14330f8248bfSmrg<indexterm significance="preferred" zone="XkbAddSymInterpret"><primary><function>XkbAddSymInterpret</function></primary></indexterm> 14340f8248bfSmrg<funcsynopsis id="XkbAddSymInterpret"> 14350f8248bfSmrg <funcprototype> 14360f8248bfSmrg <funcdef>XkbSymInterpretPtr <function>XkbAddSymInterpret</function></funcdef> 14370f8248bfSmrg<!-- ( 14380f8248bfSmrg<parameter>xkb, si, updateMap, changes</parameter> 14390f8248bfSmrg) --> 14400f8248bfSmrg 14410f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 14420f8248bfSmrg <paramdef>XkbSymInterpretPtr <parameter>si</parameter></paramdef> 14430f8248bfSmrg <paramdef>Bool <parameter>updateMap</parameter></paramdef> 14440f8248bfSmrg <paramdef>XkbChangesPtr <parameter>changes</parameter></paramdef> 14450f8248bfSmrg </funcprototype> 14460f8248bfSmrg</funcsynopsis> 14470f8248bfSmrg<variablelist> 14480f8248bfSmrg <varlistentry> 14490f8248bfSmrg <term> 14500f8248bfSmrg <parameter>xkb</parameter> 14510f8248bfSmrg </term> 14520f8248bfSmrg <listitem> 14530f8248bfSmrg <para> 14540f8248bfSmrg keyboard description to be updated 14550f8248bfSmrg </para> 14560f8248bfSmrg </listitem> 14570f8248bfSmrg </varlistentry> 14580f8248bfSmrg <varlistentry> 14590f8248bfSmrg <term> 14600f8248bfSmrg <parameter>si</parameter> 14610f8248bfSmrg </term> 14620f8248bfSmrg <listitem> 14630f8248bfSmrg <para> 14640f8248bfSmrg symbol interpretation to be added 14650f8248bfSmrg </para> 14660f8248bfSmrg </listitem> 14670f8248bfSmrg </varlistentry> 14680f8248bfSmrg <varlistentry> 14690f8248bfSmrg <term> 14700f8248bfSmrg <parameter>updateMap</parameter> 14710f8248bfSmrg </term> 14720f8248bfSmrg <listitem> 14730f8248bfSmrg <para> 14740f8248bfSmrg <symbol>True</symbol>⇒apply compatibility map to keys 14750f8248bfSmrg </para> 14760f8248bfSmrg </listitem> 14770f8248bfSmrg </varlistentry> 14780f8248bfSmrg <varlistentry> 14790f8248bfSmrg <term> 14800f8248bfSmrg <parameter>changes</parameter> 14810f8248bfSmrg </term> 14820f8248bfSmrg <listitem> 14830f8248bfSmrg <para> 14840f8248bfSmrg changes are put here 14850f8248bfSmrg </para> 14860f8248bfSmrg </listitem> 14870f8248bfSmrg </varlistentry> 14880f8248bfSmrg</variablelist> 14890f8248bfSmrg 14900f8248bfSmrg<para> 14910f8248bfSmrg<function>XkbAddSymInterpret</function> 14920f8248bfSmrgadds 14930f8248bfSmrg<parameter>si</parameter> 14940f8248bfSmrgto the list of symbol interpretations in 14950f8248bfSmrg<parameter>xkb</parameter>. 14960f8248bfSmrgIf 14970f8248bfSmrg<parameter>updateMap</parameter> 14980f8248bfSmrgis 14990f8248bfSmrg<symbol>True</symbol>, 15000f8248bfSmrgit (re)applies the compatibility map to all of the keys on the keyboard. If 15010f8248bfSmrg<parameter>changes</parameter> 15020f8248bfSmrgis non- 15030f8248bfSmrg<symbol>NULL</symbol>, 15040f8248bfSmrgit reports the parts of the keyboard that were affected (unless 15050f8248bfSmrg<parameter>updateMap</parameter> 15060f8248bfSmrgis 15070f8248bfSmrg<symbol>True</symbol>, 15080f8248bfSmrgnot much changes). 15090f8248bfSmrg<function>XkbAddSymInterpret</function> 15100f8248bfSmrgreturns a pointer to the actual new symbol interpretation in the list or 15110f8248bfSmrg<symbol>NULL</symbol> 15120f8248bfSmrgif it failed. 1513e9fcaa8aSmrg</para> 1514e9fcaa8aSmrg 1515e9fcaa8aSmrg 1516e9fcaa8aSmrg</sect1> 1517eb411b4bSmrg<sect1 id='Tracking_Changes_to_the_Compatibility_Map'> 1518e9fcaa8aSmrg<title>Tracking Changes to the Compatibility Map</title> 15190f8248bfSmrg<indexterm significance="preferred" zone="Tracking_Changes_to_the_Compatibility_Map"> 15200f8248bfSmrg<primary>events</primary><secondary><symbol></symbol>XkbCompatMapNotify</secondary></indexterm> 15210f8248bfSmrg<indexterm significance="preferred" zone="Tracking_Changes_to_the_Compatibility_Map"> 15220f8248bfSmrg<primary><structname>XkbCompatMapNotifyEvent</structname></primary></indexterm> 1523e9fcaa8aSmrg 1524e9fcaa8aSmrg<para> 15250f8248bfSmrgThe server automatically generates 15260f8248bfSmrg<symbol>MappingNotify</symbol> 15270f8248bfSmrgevents when the keyboard mapping changes. If you wish to be notified of 15280f8248bfSmrgchanges to the compatibility map, you should select for 15290f8248bfSmrg<symbol>XkbCompatMapNotify</symbol> 15300f8248bfSmrgevents. If you select for 15310f8248bfSmrg<symbol>XkbMapNotify</symbol> 15320f8248bfSmrgevents, you no longer receive the automatically generated 15330f8248bfSmrg<symbol>MappingNotify</symbol> 15340f8248bfSmrgevents. If you subsequently deselect 15350f8248bfSmrg<structname>XkbMapNotifyEvent</structname> 15360f8248bfSmrgdelivery, you again receive 15370f8248bfSmrg<symbol>MappingNotify</symbol> 15380f8248bfSmrgevents. 1539e9fcaa8aSmrg</para> 1540e9fcaa8aSmrg 1541e9fcaa8aSmrg 1542e9fcaa8aSmrg<para> 15430f8248bfSmrgTo receive 15440f8248bfSmrg<symbol>XkbCompatMapNotify</symbol> 15450f8248bfSmrgevents under all possible conditions, use 15460f8248bfSmrg<function>XkbSelectEvents</function> 15470f8248bfSmrg(see <link linkend="Selecting_Xkb_Events">section 4.3</link>) and pass 15480f8248bfSmrg<symbol>XkbCompatMapNotifyMask</symbol> 15490f8248bfSmrgin both 15500f8248bfSmrg<parameter>bits_to_change</parameter> 15510f8248bfSmrgand 15520f8248bfSmrg<parameter>values_for_bits</parameter>. 1553e9fcaa8aSmrg</para> 1554e9fcaa8aSmrg 1555e9fcaa8aSmrg 1556e9fcaa8aSmrg<para> 15570f8248bfSmrgTo receive 15580f8248bfSmrg<symbol>XkbCompatMapNotify</symbol> 15590f8248bfSmrgevents only under certain conditions, use 15600f8248bfSmrg<function>XkbSelectEventDetails</function> 15610f8248bfSmrgusing 15620f8248bfSmrg<symbol>XkbCompatMapNotify</symbol> 15630f8248bfSmrgas the 15640f8248bfSmrg<structfield>event_type</structfield> 15650f8248bfSmrgand specifying the desired map changes in 15660f8248bfSmrg<parameter>bits_to_change</parameter> 15670f8248bfSmrgand 15680f8248bfSmrg<parameter>values_for_bits</parameter> 15690f8248bfSmrgusing mask bits from <link linkend="table17.2">Table 17.2</link>. 1570e9fcaa8aSmrg</para> 1571e9fcaa8aSmrg 1572e9fcaa8aSmrg 1573e9fcaa8aSmrg<para> 1574e9fcaa8aSmrgNote that you are notified of changes you make yourself, as well as changes 1575e9fcaa8aSmrgmade by other clients. 1576e9fcaa8aSmrg</para> 1577e9fcaa8aSmrg 1578e9fcaa8aSmrg 1579e9fcaa8aSmrg<para> 15800f8248bfSmrgThe structure for the 15810f8248bfSmrg<structname>XkbCompatMapNotifyEvent</structname> 15820f8248bfSmrgis: 1583e9fcaa8aSmrg 15840f8248bfSmrg<programlisting> 1585e9fcaa8aSmrgtypedef struct { 15860f8248bfSmrg int type; /* Xkb extension base event code */ 15870f8248bfSmrg unsigned long serial; /* X server serial number for event */ 15880f8248bfSmrg Bool send_event; /* <symbol>True</symbol> ⇒ 15890f8248bfSmrg synthetically generated */ 15900f8248bfSmrg Display * display; /* server connection where event generated */ 15910f8248bfSmrg Time time; /* server time when event generated */ 15920f8248bfSmrg int xkb_type; /* <symbol>XkbCompatMapNotify</symbol> */ 15930f8248bfSmrg int device; /* Xkb device ID, will not be 15940f8248bfSmrg <symbol>XkbUseCoreKbd</symbol> */ 15950f8248bfSmrg unsigned int changed_groups; /* number of group maps changed */ 15960f8248bfSmrg int first_si; /* index to 1st changed symbol 15970f8248bfSmrg interpretation */ 15980f8248bfSmrg int num_si; /* number of changed symbol 15990f8248bfSmrg interpretations */ 16000f8248bfSmrg int num_total_si; /* total number of valid symbol 16010f8248bfSmrg interpretations */ 16020f8248bfSmrg} <structname>XkbCompatMapNotifyEvent</structname>; 1603e9fcaa8aSmrg</programlisting></para> 1604e9fcaa8aSmrg 1605e9fcaa8aSmrg<para> 16060f8248bfSmrg<structfield>changed_groups</structfield> 16070f8248bfSmrgis the number of group compatibility maps that have changed. If you are 1608e9fcaa8aSmrgmaintaining a corresponding copy of the compatibility map, or get a fresh copy 16090f8248bfSmrgfrom the server using 16100f8248bfSmrg<function>XkbGetCompatMap</function>, 16110f8248bfSmrg<structfield>changed_groups</structfield> 16120f8248bfSmrgreferences 16130f8248bfSmrg<structfield>groups</structfield> 16140f8248bfSmrg[0.. 16150f8248bfSmrg<structfield>changed_groups</structfield> 16160f8248bfSmrg-1] in the 16170f8248bfSmrg<structname>XkbCompatMapRec</structname> 16180f8248bfSmrgstructure. 16190f8248bfSmrg</para> 16200f8248bfSmrg 16210f8248bfSmrg 16220f8248bfSmrg<para> 16230f8248bfSmrg<structfield>first_si</structfield> 16240f8248bfSmrgis the index of the first changed symbol interpretation, 16250f8248bfSmrg<structfield>num_si</structfield> 16260f8248bfSmrgis the number of changed symbol interpretations, and 16270f8248bfSmrg<structfield>num_total_si</structfield> 16280f8248bfSmrgis the total number of valid symbol interpretations. If you are maintaining a 1629e9fcaa8aSmrgcorresponding copy of the compatibility map, or get a fresh copy from the 16300f8248bfSmrgserver using 16310f8248bfSmrg<function>XkbGetCompatMap</function>, 16320f8248bfSmrg<structfield>first_si</structfield>, 16330f8248bfSmrg<structfield>num_si</structfield>, 16340f8248bfSmrgand 16350f8248bfSmrg<structfield>num_total_si</structfield> 16360f8248bfSmrgare appropriate for use with the 16370f8248bfSmrg<structfield>compat.sym_interpret</structfield> 16380f8248bfSmrgvector in this structure. 1639e9fcaa8aSmrg</para> 1640e9fcaa8aSmrg 1641e9fcaa8aSmrg 1642e9fcaa8aSmrg</sect1> 1643eb411b4bSmrg<sect1 id='Allocating_and_Freeing_the_Compatibility_Map'> 1644e9fcaa8aSmrg<title>Allocating and Freeing the Compatibility Map</title> 1645e9fcaa8aSmrg 1646e9fcaa8aSmrg<para> 1647e9fcaa8aSmrgIf you are modifying the compatibility map, you need to allocate a new 1648e9fcaa8aSmrgcompatibility map if you do not already have one available. To do so, use 16490f8248bfSmrg<function>XkbAllocCompatMap</function>. 16500f8248bfSmrg</para> 16510f8248bfSmrg 16520f8248bfSmrg<indexterm significance="preferred" zone="XkbAllocCompatMap"><primary><function>XkbAllocCompatMap</function></primary></indexterm> 16530f8248bfSmrg<funcsynopsis id="XkbAllocCompatMap"> 16540f8248bfSmrg <funcprototype> 16550f8248bfSmrg <funcdef>Status <function>XkbAllocCompatMap</function></funcdef> 16560f8248bfSmrg<!-- ( 16570f8248bfSmrg<parameter>xkb, which, num_si</parameter> 16580f8248bfSmrg) --> 16590f8248bfSmrg 16600f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 16610f8248bfSmrg <paramdef>unsigned int <parameter>which</parameter></paramdef> 16620f8248bfSmrg <paramdef>unsigned int <parameter>num_si</parameter></paramdef> 16630f8248bfSmrg </funcprototype> 16640f8248bfSmrg</funcsynopsis> 16650f8248bfSmrg<variablelist> 16660f8248bfSmrg <varlistentry> 16670f8248bfSmrg <term> 16680f8248bfSmrg <parameter>xkb</parameter> 16690f8248bfSmrg </term> 16700f8248bfSmrg <listitem> 16710f8248bfSmrg <para> 16720f8248bfSmrg keyboard description in which to allocate compat map 16730f8248bfSmrg </para> 16740f8248bfSmrg </listitem> 16750f8248bfSmrg </varlistentry> 16760f8248bfSmrg <varlistentry> 16770f8248bfSmrg <term> 16780f8248bfSmrg <parameter>which</parameter> 16790f8248bfSmrg </term> 16800f8248bfSmrg <listitem> 16810f8248bfSmrg <para> 16820f8248bfSmrg mask of compatibility map components to allocate 16830f8248bfSmrg </para> 16840f8248bfSmrg </listitem> 16850f8248bfSmrg </varlistentry> 16860f8248bfSmrg <varlistentry> 16870f8248bfSmrg <term> 16880f8248bfSmrg <parameter>num_si</parameter> 16890f8248bfSmrg </term> 16900f8248bfSmrg <listitem> 16910f8248bfSmrg <para> 16920f8248bfSmrg number of symbol interpretations to allocate 16930f8248bfSmrg </para> 16940f8248bfSmrg </listitem> 16950f8248bfSmrg </varlistentry> 16960f8248bfSmrg</variablelist> 16970f8248bfSmrg 16980f8248bfSmrg<para> 16990f8248bfSmrg<parameter>xkb</parameter> 17000f8248bfSmrgspecifies the keyboard description for which compatibility maps are to be 17010f8248bfSmrgallocated. The compatibility map is the 17020f8248bfSmrg<structfield>compat</structfield> 17030f8248bfSmrgfield in this structure. 17040f8248bfSmrg</para> 17050f8248bfSmrg 17060f8248bfSmrg 17070f8248bfSmrg<para> 17080f8248bfSmrg<parameter>which</parameter> 17090f8248bfSmrgspecifies the compatibility map components to be allocated (see 17100f8248bfSmrg<link linkend="XkbGetCompatMap"><function>XkbGetCompatMap</function></link>, 17110f8248bfSmrgin <link linkend="Getting_Compatibility_Map_Components_From_the_Server">section 17.2</link>). 17120f8248bfSmrg<parameter>which</parameter> 17130f8248bfSmrgis an inclusive OR of the bits shown in 17140f8248bfSmrg<link linkend="table17.2">Table 17.2</link>. 17150f8248bfSmrg</para> 17160f8248bfSmrg 17170f8248bfSmrg 17180f8248bfSmrg<para> 17190f8248bfSmrg<parameter>num_si</parameter> 17200f8248bfSmrgspecifies the total number of entries to allocate in the symbol interpretation 17210f8248bfSmrgvector 17220f8248bfSmrg(<structfield>xkb.compat.sym_interpret</structfield>). 17230f8248bfSmrg 17240f8248bfSmrg</para> 17250f8248bfSmrg 17260f8248bfSmrg 17270f8248bfSmrg<para> 17280f8248bfSmrgNote that symbol interpretations in a compatibility map (the 17290f8248bfSmrg<structfield>sym_interpret</structfield> 17300f8248bfSmrgvector of 17310f8248bfSmrg<structname>XkbSymInterpretRec</structname> 17320f8248bfSmrgstructures) are also allocated using this same function. To ensure that there 1733e9fcaa8aSmrgis sufficient space in the symbol interpretation vector for entries to be 17340f8248bfSmrgadded, use 17350f8248bfSmrg<function>XkbAllocCompatMap</function> 17360f8248bfSmrgspecifying 17370f8248bfSmrg<parameter>which</parameter> 17380f8248bfSmrgas 17390f8248bfSmrg<emphasis>XkbSymInterpretMask</emphasis> 17400f8248bfSmrgand the number of free symbol interpretations needed in 17410f8248bfSmrg<parameter>num_si</parameter>. 17420f8248bfSmrg</para> 17430f8248bfSmrg 17440f8248bfSmrg 17450f8248bfSmrg<para> 17460f8248bfSmrg<function>XkbAllocCompatMap</function> 17470f8248bfSmrgreturns 17480f8248bfSmrg<symbol>Success</symbol> 17490f8248bfSmrgif successful, 17500f8248bfSmrg<errorname>BadMatch</errorname> 17510f8248bfSmrgif 17520f8248bfSmrg<parameter>xkb</parameter> 17530f8248bfSmrgis 17540f8248bfSmrg<symbol>NULL</symbol>, 17550f8248bfSmrgor 17560f8248bfSmrg<errorname>BadAlloc</errorname> 17570f8248bfSmrgif errors are encountered when attempting to allocate storage. 17580f8248bfSmrg</para> 17590f8248bfSmrg 17600f8248bfSmrg 17610f8248bfSmrg<para> 17620f8248bfSmrgTo free an entire compatibility map or selected portions of one, use 17630f8248bfSmrg<function>XkbFreeCompatMap</function>. 17640f8248bfSmrg</para> 17650f8248bfSmrg 17660f8248bfSmrg 17670f8248bfSmrg<indexterm significance="preferred" zone="XkbFreeCompatMap"><primary><function>XkbFreeCompatMap</function></primary></indexterm> 17680f8248bfSmrg<funcsynopsis id="XkbFreeCompatMap"> 17690f8248bfSmrg <funcprototype> 17700f8248bfSmrg <funcdef>void <function>XkbFreeCompatMap</function></funcdef> 17710f8248bfSmrg<!-- ( 17720f8248bfSmrg<parameter>xkb, which, free_map</parameter> 17730f8248bfSmrg) --> 17740f8248bfSmrg 17750f8248bfSmrg <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 17760f8248bfSmrg <paramdef>unsigned int <parameter>which</parameter></paramdef> 17770f8248bfSmrg <paramdef>Bool <parameter>free_map</parameter></paramdef> 17780f8248bfSmrg </funcprototype> 17790f8248bfSmrg</funcsynopsis> 17800f8248bfSmrg<variablelist> 17810f8248bfSmrg <varlistentry> 17820f8248bfSmrg <term> 17830f8248bfSmrg <parameter>xkb</parameter> 17840f8248bfSmrg </term> 17850f8248bfSmrg <listitem> 17860f8248bfSmrg <para> 17870f8248bfSmrg Xkb description in which to free compatibility map 17880f8248bfSmrg </para> 17890f8248bfSmrg </listitem> 17900f8248bfSmrg </varlistentry> 17910f8248bfSmrg <varlistentry> 17920f8248bfSmrg <term> 17930f8248bfSmrg <parameter>which</parameter> 17940f8248bfSmrg </term> 17950f8248bfSmrg <listitem> 17960f8248bfSmrg <para> 17970f8248bfSmrg mask of compatibility map components to free 17980f8248bfSmrg </para> 17990f8248bfSmrg </listitem> 18000f8248bfSmrg </varlistentry> 18010f8248bfSmrg <varlistentry> 18020f8248bfSmrg <term> 18030f8248bfSmrg <parameter>free_map</parameter> 18040f8248bfSmrg </term> 18050f8248bfSmrg <listitem> 18060f8248bfSmrg <para> 18070f8248bfSmrg <symbol>True</symbol> ⇒ free <structname>XkbCompatMapRec</structname> 18080f8248bfSmrg structure itself 18090f8248bfSmrg </para> 18100f8248bfSmrg </listitem> 18110f8248bfSmrg </varlistentry> 18120f8248bfSmrg</variablelist> 18130f8248bfSmrg 18140f8248bfSmrg<para> 18150f8248bfSmrg<parameter>which</parameter> 18160f8248bfSmrgspecifies the compatibility map components to be freed (see 18170f8248bfSmrg<link linkend="XkbGetCompatMap"><function>XkbGetCompatMap</function></link>, 18180f8248bfSmrgin <link linkend="Getting_Compatibility_Map_Components_From_the_Server">section 17.2</link>). 18190f8248bfSmrg<parameter>which</parameter> 18200f8248bfSmrgis an inclusive OR of the bits shown in 18210f8248bfSmrg<link linkend="table17.2">Table 17.2</link> 18220f8248bfSmrg</para> 18230f8248bfSmrg 18240f8248bfSmrg 18250f8248bfSmrg<para> 18260f8248bfSmrg<parameter>free_map</parameter> 18270f8248bfSmrgindicates whether the 18280f8248bfSmrg<structname>XkbCompatMapRec</structname> 18290f8248bfSmrgstructure itself should be freed. If 18300f8248bfSmrg<parameter>free_map</parameter> 18310f8248bfSmrgis 18320f8248bfSmrg<symbol>True</symbol>, 18330f8248bfSmrg<parameter>which</parameter> 18340f8248bfSmrgis ignored, all non- 18350f8248bfSmrg<symbol>NULL</symbol> 18360f8248bfSmrgcompatibility map components are freed, and the 18370f8248bfSmrg<structfield>compat</structfield> 18380f8248bfSmrgfield in the 18390f8248bfSmrg<structname>XkbDescRec</structname> 18400f8248bfSmrgreferenced by 18410f8248bfSmrg<parameter>xkb</parameter> 18420f8248bfSmrgis set to 18430f8248bfSmrg<symbol>NULL</symbol>. 1844e9fcaa8aSmrg</para> 1845e9fcaa8aSmrg 1846e9fcaa8aSmrg</sect1> 1847e9fcaa8aSmrg</chapter> 1848