ch20.xml revision eb411b4b
1eb411b4bSmrg<chapter id='Server_Database_of_Keyboard_Components'> 2e9fcaa8aSmrg<title>Server Database of Keyboard Components</title> 3e9fcaa8aSmrg 4e9fcaa8aSmrg<para> 5e9fcaa8aSmrgThe X server maintains a database of keyboard components, identified by 6e9fcaa8aSmrgcomponent type. The database contains all the information necessary to build a 7e9fcaa8aSmrgcomplete keyboard description for a particular device, as well as to assemble 8e9fcaa8aSmrgpartial descriptions. Table 20.1 identifies the component types and the type of 9e9fcaa8aSmrginformation they contain. 10e9fcaa8aSmrg</para> 11e9fcaa8aSmrg 12eb411b4bSmrg<table frame='topbot'> 13e9fcaa8aSmrg<title>Server Database Keyboard Components</title> 14eb411b4bSmrg<?dbfo keep-together="always" ?> 15eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'> 16eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 17eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/> 18eb411b4bSmrg<colspec colname='c3' colwidth='1.5*'/> 19e9fcaa8aSmrg<thead> 20eb411b4bSmrg<row rowsep='1'> 21e9fcaa8aSmrg <entry>Component Type</entry> 22e9fcaa8aSmrg <entry>Component Primary Contents</entry> 23e9fcaa8aSmrg <entry>May also contain</entry> 24e9fcaa8aSmrg </row> 25e9fcaa8aSmrg</thead> 26e9fcaa8aSmrg<tbody> 27eb411b4bSmrg <row> 28e9fcaa8aSmrg <entry>Keymap</entry> 29e9fcaa8aSmrg <entry> 30e9fcaa8aSmrg<para>Complete keyboard description</para> 31e9fcaa8aSmrg<para>Normally assembled using a complete component from each of the other types</para> 32e9fcaa8aSmrg </entry> 33e9fcaa8aSmrg <entry></entry> 34e9fcaa8aSmrg </row> 35eb411b4bSmrg <row> 36e9fcaa8aSmrg <entry>Keycodes</entry> 37e9fcaa8aSmrg <entry> 38e9fcaa8aSmrg<para>Symbolic name for each key</para> 39e9fcaa8aSmrg<para>Minimum and maximum legal keycodes</para> 40e9fcaa8aSmrg </entry> 41e9fcaa8aSmrg <entry> 42e9fcaa8aSmrg<para>Aliases for some keys</para> 43e9fcaa8aSmrg<para>Symbolic names for indicators</para> 44e9fcaa8aSmrg<para>Description of indicators physically present</para> 45e9fcaa8aSmrg </entry> 46e9fcaa8aSmrg </row> 47eb411b4bSmrg <row> 48e9fcaa8aSmrg <entry>Types</entry> 49e9fcaa8aSmrg <entry>Key types</entry> 50e9fcaa8aSmrg <entry> 51e9fcaa8aSmrgReal modifier bindings and symbolic names for some virtual modifiers 52e9fcaa8aSmrg </entry> 53e9fcaa8aSmrg </row> 54eb411b4bSmrg <row> 55e9fcaa8aSmrg <entry>Compatibility</entry> 56e9fcaa8aSmrg <entry>Rules used to assign actions to keysyms</entry> 57e9fcaa8aSmrg <entry> 58e9fcaa8aSmrg<para>Maps for some indicators</para> 59e9fcaa8aSmrg<para>Real modifier bindings and symbolic names for some virtual modifiers</para> 60e9fcaa8aSmrg </entry> 61e9fcaa8aSmrg </row> 62eb411b4bSmrg <row> 63e9fcaa8aSmrg <entry>Symbols</entry> 64e9fcaa8aSmrg <entry> 65e9fcaa8aSmrg<para>Symbol mapping for keyboard keys</para> 66e9fcaa8aSmrg<para>Modifier mapping</para> 67e9fcaa8aSmrg<para>Symbolic names for groups</para> 68e9fcaa8aSmrg </entry> 69e9fcaa8aSmrg <entry> 70e9fcaa8aSmrg<para>Explicit actions and behaviors for some keys</para> 71e9fcaa8aSmrg<para>Real modifier bindings and symbolic names for some virtual modifiers</para> 72e9fcaa8aSmrg </entry> 73e9fcaa8aSmrg </row> 74eb411b4bSmrg <row> 75e9fcaa8aSmrg <entry>Geometry</entry> 76e9fcaa8aSmrg <entry>Layout of the keyboard</entry> 77e9fcaa8aSmrg <entry> 78e9fcaa8aSmrg<para>Aliases for some keys; overrides keycodes component aliases</para> 79e9fcaa8aSmrg<para>Symbolic names for some indicators</para> 80e9fcaa8aSmrg<para>Description of indicators physically present</para> 81e9fcaa8aSmrg </entry> 82e9fcaa8aSmrg </row> 83e9fcaa8aSmrg</tbody> 84e9fcaa8aSmrg</tgroup> 85e9fcaa8aSmrg</table> 86e9fcaa8aSmrg 87e9fcaa8aSmrg<para> 88e9fcaa8aSmrgWhile a keymap is a database entry for a complete keyboard description, and 89e9fcaa8aSmrgtherefore logically different from the individual component database entries, 90e9fcaa8aSmrgthe rules for processing keymap entries are identical to those for the 91e9fcaa8aSmrgindividual components. In the discussion that follows, the term component is 92e9fcaa8aSmrgused to refer to either individual components or a keymap. 93e9fcaa8aSmrg</para> 94e9fcaa8aSmrg 95e9fcaa8aSmrg<para> 96e9fcaa8aSmrgThere may be multiple entries for each of the component types. An entry may be 97e9fcaa8aSmrgeither <emphasis> 98e9fcaa8aSmrgcomplete</emphasis> 99e9fcaa8aSmrg or <emphasis> 100e9fcaa8aSmrgpartial</emphasis> 101e9fcaa8aSmrg. Partial entries describe only a piece of the corresponding keyboard component 102e9fcaa8aSmrgand are designed to be combined with other entries of the same type to form a 103e9fcaa8aSmrgcomplete entry. 104e9fcaa8aSmrg</para> 105e9fcaa8aSmrg 106e9fcaa8aSmrg<para> 107e9fcaa8aSmrgFor example, a partial symbols map might describe the differences between a 108e9fcaa8aSmrgcommon ASCII keyboard and some national layout. Such a partial map is not 109e9fcaa8aSmrguseful on its own because it does not include those symbols that are the same 110e9fcaa8aSmrgon both the ASCII and national layouts (such as function keys). On the other 111e9fcaa8aSmrghand, this partial map can be used to configure <emphasis> 112e9fcaa8aSmrgany</emphasis> 113e9fcaa8aSmrg ASCII keyboard to use a national layout. 114e9fcaa8aSmrg</para> 115e9fcaa8aSmrg 116e9fcaa8aSmrg<para> 117e9fcaa8aSmrgWhen a keyboard description is built, the components are processed in the order 118e9fcaa8aSmrgin which they appear in Table 20.1; later definitions override earlier ones. 119e9fcaa8aSmrg</para> 120e9fcaa8aSmrg 121eb411b4bSmrg<sect1 id='Component_Names'> 122e9fcaa8aSmrg<title>Component Names</title> 123e9fcaa8aSmrg 124e9fcaa8aSmrg<para> 125e9fcaa8aSmrgComponent names have the form "<emphasis> 126e9fcaa8aSmrgclass(member)</emphasis> 127e9fcaa8aSmrg" where <emphasis> 128e9fcaa8aSmrgclass</emphasis> 129e9fcaa8aSmrg describes a subset of the available components for a particular type and the 130e9fcaa8aSmrgoptional <emphasis> 131e9fcaa8aSmrgmember</emphasis> 132e9fcaa8aSmrg identifies a specific component from that subset. For example, the name 133e9fcaa8aSmrg"atlantis(acme)" for a symbols component might specify the symbols used for the 134e9fcaa8aSmrgatlantis national keyboard layout by the vendor "acme." Each class has an 135e9fcaa8aSmrgoptional <emphasis> 136e9fcaa8aSmrgdefault</emphasis> 137e9fcaa8aSmrg member — references that specify a class but not a member refer to the 138e9fcaa8aSmrgdefault member of the class, if one exists. Xkb places no constraints on the 139e9fcaa8aSmrginterpretation of the class and member names used in component names. 140e9fcaa8aSmrg</para> 141e9fcaa8aSmrg 142e9fcaa8aSmrg<para> 143e9fcaa8aSmrgThe <emphasis> 144e9fcaa8aSmrgclass</emphasis> 145e9fcaa8aSmrg and <emphasis> 146e9fcaa8aSmrgmember</emphasis> 147e9fcaa8aSmrg names are both specified using characters from the Latin-1 character set. Xkb 148e9fcaa8aSmrgimplementations must accept all alphanumeric characters, minus (‘-’) and 149e9fcaa8aSmrgunderscore (‘_’) in class or member names, and must not accept parentheses, 150e9fcaa8aSmrgplus, vertical bar, percent sign, asterisk, question mark, or white space. The 151e9fcaa8aSmrguse of other characters is implementation-dependent. 152e9fcaa8aSmrg</para> 153e9fcaa8aSmrg 154e9fcaa8aSmrg</sect1> 155eb411b4bSmrg<sect1 id='Listing_the_Known_Keyboard_Components'> 156e9fcaa8aSmrg<title>Listing the Known Keyboard Components</title> 157e9fcaa8aSmrg 158e9fcaa8aSmrg<para> 159e9fcaa8aSmrgYou may ask the server for a list of components for one or more component 160e9fcaa8aSmrgtypes. The request takes the form of a set of patterns, one pattern for each of 161e9fcaa8aSmrgthe component types, including a pattern for the complete keyboard description. 162e9fcaa8aSmrgTo obtain this list, use <emphasis> 163e9fcaa8aSmrgXkbListComponents</emphasis> 164e9fcaa8aSmrg. 165e9fcaa8aSmrg</para> 166e9fcaa8aSmrg 167e9fcaa8aSmrg<informaltable frame='none'> 168eb411b4bSmrg<?dbfo keep-together="always" ?> 169eb411b4bSmrg<tgroup cols='1' align='left' colsep='0' rowsep='0'> 170eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 171e9fcaa8aSmrg<tbody> 172eb411b4bSmrg <row> 173e9fcaa8aSmrg <entry role='functiondecl'> 174e9fcaa8aSmrgXkbComponentListPtr<emphasis> 175e9fcaa8aSmrg XkbListComponents</emphasis> 176e9fcaa8aSmrg(<emphasis> 177e9fcaa8aSmrgdpy</emphasis> 178e9fcaa8aSmrg, <emphasis> 179e9fcaa8aSmrgdevice_spec</emphasis> 180e9fcaa8aSmrg, <emphasis> 181e9fcaa8aSmrgptrns</emphasis> 182e9fcaa8aSmrg, <emphasis> 183e9fcaa8aSmrgmax_inout</emphasis> 184e9fcaa8aSmrg) 185e9fcaa8aSmrg </entry> 186e9fcaa8aSmrg </row> 187eb411b4bSmrg <row> 188e9fcaa8aSmrg <entry role='functionargdecl'> 189e9fcaa8aSmrgDisplay * <emphasis> 190e9fcaa8aSmrg dpy</emphasis> 191e9fcaa8aSmrg; /* connection to X server */ 192e9fcaa8aSmrg </entry> 193e9fcaa8aSmrg </row> 194eb411b4bSmrg <row> 195e9fcaa8aSmrg <entry role='functionargdecl'> 196e9fcaa8aSmrgunsigned int <emphasis> 197e9fcaa8aSmrgdevice_spec</emphasis> 198e9fcaa8aSmrg; /* device ID, or <emphasis> 199e9fcaa8aSmrgXkbUseCoreKbd</emphasis> 200e9fcaa8aSmrg */ 201e9fcaa8aSmrg </entry> 202e9fcaa8aSmrg </row> 203eb411b4bSmrg <row> 204e9fcaa8aSmrg <entry role='functionargdecl'> 205e9fcaa8aSmrgXkbComponentNamesPtr <emphasis> 206e9fcaa8aSmrgptrns</emphasis> 207e9fcaa8aSmrg; /* namelist for components of interest */ 208e9fcaa8aSmrg </entry> 209e9fcaa8aSmrg </row> 210eb411b4bSmrg <row> 211e9fcaa8aSmrg <entry role='functionargdecl'> 212e9fcaa8aSmrgint * <emphasis> 213e9fcaa8aSmrgmax_inout</emphasis> 214e9fcaa8aSmrg; /* max # returned names, # left over */ 215e9fcaa8aSmrg </entry> 216e9fcaa8aSmrg</row> 217e9fcaa8aSmrg</tbody> 218e9fcaa8aSmrg</tgroup> 219e9fcaa8aSmrg</informaltable> 220e9fcaa8aSmrg 221e9fcaa8aSmrg<para> 222e9fcaa8aSmrg<emphasis> 223e9fcaa8aSmrgXkbListComponents</emphasis> 224e9fcaa8aSmrg queries the server for a list of component names matching the patterns 225e9fcaa8aSmrgspecified in <emphasis> 226e9fcaa8aSmrgptrns</emphasis> 227e9fcaa8aSmrg. It waits for a reply and returns the matching component names in an <emphasis> 228e9fcaa8aSmrgXkbComponentListRec</emphasis> 229e9fcaa8aSmrg structure. When you are done using the structure, you should free it using 230e9fcaa8aSmrg<emphasis> 231e9fcaa8aSmrgXkbFreeComponentList</emphasis> 232e9fcaa8aSmrg. <emphasis> 233e9fcaa8aSmrgdevice_spec</emphasis> 234e9fcaa8aSmrg indicates a particular device in which the caller is interested. A server is 235e9fcaa8aSmrgallowed (but not required) to restrict its reply to portions of the database 236e9fcaa8aSmrgthat are relevant for that particular device. 237e9fcaa8aSmrg</para> 238e9fcaa8aSmrg 239e9fcaa8aSmrg 240e9fcaa8aSmrg<para> 241e9fcaa8aSmrg<emphasis> 242e9fcaa8aSmrgptrns</emphasis> 243e9fcaa8aSmrg is a pointer to an <emphasis> 244e9fcaa8aSmrgXkbComponentNamesRec</emphasis> 245e9fcaa8aSmrg, described below. Each of the fields in <emphasis> 246e9fcaa8aSmrgptrns</emphasis> 247e9fcaa8aSmrg contains a pattern naming the components of interest. Each of the patterns is 248e9fcaa8aSmrgcomposed of characters from the ISO <emphasis> 249e9fcaa8aSmrgLatin1</emphasis> 250e9fcaa8aSmrg encoding, but can contain only parentheses, the wildcard characters 251e9fcaa8aSmrg‘<emphasis> 252e9fcaa8aSmrg?</emphasis> 253e9fcaa8aSmrg’ and ‘<emphasis> 254e9fcaa8aSmrg*</emphasis> 255e9fcaa8aSmrg’, and characters permitted in a component class or member name (see section 256e9fcaa8aSmrg20.1). A pattern may be <emphasis> 257e9fcaa8aSmrgNULL</emphasis> 258e9fcaa8aSmrg, in which case no components for that type is returned. Pattern matches with 259e9fcaa8aSmrgcomponent names are case sensitive. The ‘<emphasis> 260e9fcaa8aSmrg?</emphasis> 261e9fcaa8aSmrg’ wildcard matches any single character, except a left or right parenthesis; 262e9fcaa8aSmrgthe ‘<emphasis> 263e9fcaa8aSmrg*</emphasis> 264e9fcaa8aSmrg’ wildcard matches any number of characters, except a left or right 265e9fcaa8aSmrgparenthesis. If an implementation allows additional characters in a component 266e9fcaa8aSmrgclass or member name other than those required by the Xkb extension (see 267e9fcaa8aSmrgsection 20.1), the result of comparing one of the additional characters to 268e9fcaa8aSmrgeither of the wildcard characters is implementation-dependent. 269e9fcaa8aSmrg</para> 270e9fcaa8aSmrg 271e9fcaa8aSmrg 272e9fcaa8aSmrg<para> 273e9fcaa8aSmrgIf a pattern contains illegal characters, the illegal characters are ignored. 274e9fcaa8aSmrgThe matching process is carried out as if the illegal characters were omitted 275e9fcaa8aSmrgfrom the pattern. 276e9fcaa8aSmrg</para> 277e9fcaa8aSmrg 278e9fcaa8aSmrg 279e9fcaa8aSmrg<para> 280e9fcaa8aSmrg<emphasis> 281e9fcaa8aSmrgmax_inout</emphasis> 282e9fcaa8aSmrg is used to throttle the amount of data passed to and from the server. On 283e9fcaa8aSmrginput, it specifies the maximum number of names to be returned (the total 284e9fcaa8aSmrgnumber of names in all component categories). Upon return from <emphasis> 285e9fcaa8aSmrgXkbListComponents</emphasis> 286e9fcaa8aSmrg, <emphasis> 287e9fcaa8aSmrgmax_inout</emphasis> 288e9fcaa8aSmrg contains the number of names that matched the request but were not returned 289e9fcaa8aSmrgbecause of the limit. 290e9fcaa8aSmrg</para> 291e9fcaa8aSmrg 292e9fcaa8aSmrg 293e9fcaa8aSmrg<para> 294e9fcaa8aSmrgThe component name patterns used to describe the request are passed to 295e9fcaa8aSmrg<emphasis> 296e9fcaa8aSmrgXkbListComponents</emphasis> 297e9fcaa8aSmrg using an <emphasis> 298e9fcaa8aSmrgXkbComponentNamesRec</emphasis> 299e9fcaa8aSmrg structure. This structure has no special allocation constraints or 300e9fcaa8aSmrginterrelationships with other structures; allocate and free this structure 301e9fcaa8aSmrgusing standard <emphasis> 302e9fcaa8aSmrgmalloc</emphasis> 303e9fcaa8aSmrg and <emphasis> 304e9fcaa8aSmrgfree</emphasis> 305e9fcaa8aSmrg calls or their equivalent: 306e9fcaa8aSmrg</para> 307e9fcaa8aSmrg 308e9fcaa8aSmrg<para><programlisting> 309e9fcaa8aSmrgtypedef struct _XkbComponentNames { 310e9fcaa8aSmrg char * keymap; /* keymap names */ 311e9fcaa8aSmrg char * keycodes; /* keycode names */ 312e9fcaa8aSmrg char * types; /* type names */ 313e9fcaa8aSmrg char * compat; /* compatibility map names */ 314e9fcaa8aSmrg char * symbols; /* symbol names */ 315e9fcaa8aSmrg char * geometry; /* geometry names */ 316e9fcaa8aSmrg} <emphasis>XkbComponentNamesRec</emphasis>, *XkbComponentNamesPtr; 317e9fcaa8aSmrg</programlisting></para> 318e9fcaa8aSmrg 319e9fcaa8aSmrg<para> 320e9fcaa8aSmrg<emphasis> 321e9fcaa8aSmrgXkbListComponents</emphasis> 322e9fcaa8aSmrg returns a pointer to an <emphasis> 323e9fcaa8aSmrgXkbComponentListRec</emphasis> 324e9fcaa8aSmrg: 325e9fcaa8aSmrg</para> 326e9fcaa8aSmrg 327e9fcaa8aSmrg<para><programlisting> 328e9fcaa8aSmrgtypedef struct _XkbComponentList { 329e9fcaa8aSmrg int num_keymaps; /* number of entries in keymap */ 330e9fcaa8aSmrg int num_keycodes; /* number of entries in keycodes */ 331e9fcaa8aSmrg int num_types; /* number of entries in types */ 332e9fcaa8aSmrg int num_compat; /* number of entries in compat */ 333e9fcaa8aSmrg int num_symbols; /* number of entries in symbols */ 334e9fcaa8aSmrg int num_geometry; /* number of entries in geometry; 335e9fcaa8aSmrg XkbComponentNamePtr keymap; /* keymap names */ 336e9fcaa8aSmrg XkbComponentNamePtr keycodes; /* keycode names */ 337e9fcaa8aSmrg XkbComponentNamePtr types; /* type names */ 338e9fcaa8aSmrg XkbComponentNamePtr compat; /* compatibility map names */ 339e9fcaa8aSmrg XkbComponentNamePtr symbols; /* symbol names */ 340e9fcaa8aSmrg XkbComponentNamePtr geometry; /* geometry names */ 341e9fcaa8aSmrg} <emphasis>XkbComponentListRec</emphasis>, *XkbComponentListPtr; 342e9fcaa8aSmrg</programlisting></para> 343e9fcaa8aSmrg 344e9fcaa8aSmrg<para><programlisting> 345e9fcaa8aSmrgtypedef struct _XkbComponentName { 346e9fcaa8aSmrg unsigned short flags; /* hints regarding component name */ 347e9fcaa8aSmrg char * name; /* name of component */ 348e9fcaa8aSmrg} <emphasis>XkbComponentNameRec</emphasis>, *XkbComponentNamePtr; 349e9fcaa8aSmrg</programlisting></para> 350e9fcaa8aSmrg 351e9fcaa8aSmrg<para> 352e9fcaa8aSmrgNote that the structure used to specify patterns on input is an <emphasis> 353e9fcaa8aSmrgXkbComponentNamesRec</emphasis> 354e9fcaa8aSmrg, and that used to hold the individual component names upon return is an 355e9fcaa8aSmrg<emphasis> 356e9fcaa8aSmrgXkbComponentNameRec</emphasis> 357e9fcaa8aSmrg (no trailing ‘s’ in Name). 358e9fcaa8aSmrg</para> 359e9fcaa8aSmrg 360e9fcaa8aSmrg 361e9fcaa8aSmrg<para> 362e9fcaa8aSmrgWhen you are done using the structure returned by <emphasis> 363e9fcaa8aSmrgXkbListComponents</emphasis> 364e9fcaa8aSmrg, free it using <emphasis> 365e9fcaa8aSmrgXkbFreeComponentList</emphasis> 366e9fcaa8aSmrg. 367e9fcaa8aSmrg</para> 368e9fcaa8aSmrg 369e9fcaa8aSmrg 370e9fcaa8aSmrg<informaltable frame='none'> 371eb411b4bSmrg<?dbfo keep-together="always" ?> 372eb411b4bSmrg<tgroup cols='1' align='left' colsep='0' rowsep='0'> 373eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 374e9fcaa8aSmrg<tbody> 375eb411b4bSmrg <row> 376e9fcaa8aSmrg <entry role='functiondecl'> 377e9fcaa8aSmrgvoid <emphasis> 378e9fcaa8aSmrgXkbFreeComponentList</emphasis> 379e9fcaa8aSmrg(list) 380e9fcaa8aSmrg </entry> 381e9fcaa8aSmrg </row> 382eb411b4bSmrg <row> 383e9fcaa8aSmrg <entry role='functionargdecl'> 384e9fcaa8aSmrgXkbComponentListPtr list; /* pointer to <emphasis> 385e9fcaa8aSmrgXkbComponentListRec</emphasis> 386e9fcaa8aSmrg to free */ 387e9fcaa8aSmrg </entry> 388e9fcaa8aSmrg</row> 389e9fcaa8aSmrg</tbody> 390e9fcaa8aSmrg</tgroup> 391e9fcaa8aSmrg</informaltable> 392e9fcaa8aSmrg 393e9fcaa8aSmrg 394e9fcaa8aSmrg</sect1> 395eb411b4bSmrg<sect1 id='Component_Hints'> 396e9fcaa8aSmrg<title>Component Hints</title> 397e9fcaa8aSmrg 398e9fcaa8aSmrg<para> 399e9fcaa8aSmrgA set of flags is associated with each component; these flags provide 400e9fcaa8aSmrgadditional hints about the component’s use. These hints are designated by bit 401e9fcaa8aSmrgmasks in the flags field of the <emphasis> 402e9fcaa8aSmrgXkbComponentNameRec</emphasis> 403e9fcaa8aSmrg structures contained in the <emphasis> 404e9fcaa8aSmrgXkbComponentListRec</emphasis> 405e9fcaa8aSmrg returned from <emphasis> 406e9fcaa8aSmrgXkbListComponents</emphasis> 407e9fcaa8aSmrg. The least significant byte of the flags field has the same meaning for all 408e9fcaa8aSmrgtypes of keyboard components; the interpretation of the most significant byte 409e9fcaa8aSmrgis dependent on the type of component. The flags bits are defined in Table 410e9fcaa8aSmrg20.2. The symbols hints in Table 20.2 apply only to partial symbols components 411e9fcaa8aSmrg(those with <emphasis> 412e9fcaa8aSmrgXkbLC_Partial</emphasis> 413e9fcaa8aSmrg also set); full symbols components are assumed to specify all of the pieces. 414e9fcaa8aSmrg</para> 415e9fcaa8aSmrg 416e9fcaa8aSmrg 417e9fcaa8aSmrg<para> 418e9fcaa8aSmrgThe alphanumeric, modifier, keypad or function keys symbols hints should 419e9fcaa8aSmrgdescribe the primary intent of the component designer and should not be simply 420e9fcaa8aSmrgan exhaustive list of the kinds of keys that are affected. For example, 421e9fcaa8aSmrgnational keyboard layouts affect primarily alphanumeric keys, but many affect a 422e9fcaa8aSmrgfew modifier keys as well; such mappings should set only the <emphasis> 423e9fcaa8aSmrgXkbLC_AlphanumericKeys</emphasis> 424e9fcaa8aSmrg hint. In general, symbols components should set only one of the four flags 425e9fcaa8aSmrg(<emphasis> 426e9fcaa8aSmrgXkbLC_AlternateGroup</emphasis> 427e9fcaa8aSmrg may be combined with any of the other flags). 428e9fcaa8aSmrg</para> 429e9fcaa8aSmrg 430eb411b4bSmrg<table frame='topbot'> 431e9fcaa8aSmrg<title>XkbComponentNameRec Flags Bits</title> 432eb411b4bSmrg<?dbfo keep-together="always" ?> 433eb411b4bSmrg<tgroup cols='4' align='left' colsep='0' rowsep='0'> 434eb411b4bSmrg<colspec colname='c1' colwidth='1.5*'/> 435eb411b4bSmrg<colspec colname='c2' colwidth='3.0*'/> 436eb411b4bSmrg<colspec colname='c3' colwidth='2.0*'/> 437eb411b4bSmrg<colspec colname='c4' colwidth='1.0*'/> 438e9fcaa8aSmrg<thead> 439eb411b4bSmrg<row rowsep='1'> 440e9fcaa8aSmrg <entry>Component Type</entry> 441e9fcaa8aSmrg <entry>Component Hints (flags)</entry> 442e9fcaa8aSmrg <entry>Meaning</entry> 443e9fcaa8aSmrg <entry>Value</entry> 444e9fcaa8aSmrg</row> 445e9fcaa8aSmrg</thead> 446e9fcaa8aSmrg<tbody> 447eb411b4bSmrg<row> 448e9fcaa8aSmrg <entry>All Components</entry> 449e9fcaa8aSmrg <entry><para><emphasis>XkbLC_Hidden</emphasis></para></entry> 450e9fcaa8aSmrg <entry>Do not present to user</entry> 451e9fcaa8aSmrg <entry>(1L<<0)</entry> 452e9fcaa8aSmrg</row> 453eb411b4bSmrg<row> 454e9fcaa8aSmrg <entry></entry> 455e9fcaa8aSmrg <entry><emphasis>XkbLC_Default</emphasis></entry> 456e9fcaa8aSmrg <entry>Default member of class</entry> 457e9fcaa8aSmrg <entry>(1L<<1)</entry> 458e9fcaa8aSmrg</row> 459eb411b4bSmrg<row> 460e9fcaa8aSmrg <entry></entry> 461e9fcaa8aSmrg <entry><emphasis>XkbLC_Partial</emphasis></entry> 462e9fcaa8aSmrg <entry>Partial component</entry> 463e9fcaa8aSmrg <entry>(1L<<2)</entry> 464e9fcaa8aSmrg</row> 465eb411b4bSmrg<row> 466e9fcaa8aSmrg <entry>Keymap</entry> 467e9fcaa8aSmrg <entry>none</entry> 468e9fcaa8aSmrg <entry></entry> 469e9fcaa8aSmrg <entry></entry> 470e9fcaa8aSmrg</row> 471eb411b4bSmrg<row> 472e9fcaa8aSmrg <entry>Keycodes</entry> 473e9fcaa8aSmrg <entry>none</entry> 474e9fcaa8aSmrg <entry></entry> 475e9fcaa8aSmrg <entry></entry> 476e9fcaa8aSmrg</row> 477eb411b4bSmrg<row> 478e9fcaa8aSmrg <entry>Types</entry> 479e9fcaa8aSmrg <entry>none</entry> 480e9fcaa8aSmrg <entry></entry> 481e9fcaa8aSmrg <entry></entry> 482e9fcaa8aSmrg</row> 483eb411b4bSmrg<row> 484e9fcaa8aSmrg <entry>Compatibility</entry> 485e9fcaa8aSmrg <entry>none</entry> 486e9fcaa8aSmrg <entry></entry> 487e9fcaa8aSmrg <entry></entry> 488e9fcaa8aSmrg</row> 489eb411b4bSmrg<row> 490e9fcaa8aSmrg <entry>Symbols</entry> 491e9fcaa8aSmrg <entry><emphasis>XkbLC_AlphanumericKeys</emphasis></entry> 492e9fcaa8aSmrg <entry>Bindings primarily for alphanumeric keyboard section</entry> 493e9fcaa8aSmrg <entry>(1L<<8)</entry> 494e9fcaa8aSmrg</row> 495eb411b4bSmrg<row> 496e9fcaa8aSmrg <entry></entry> 497e9fcaa8aSmrg <entry><emphasis>XkbLC_ModifierKeys</emphasis></entry> 498e9fcaa8aSmrg <entry>Bindings primarily for modifier keys</entry> 499e9fcaa8aSmrg <entry>(1L<<9)</entry> 500e9fcaa8aSmrg</row> 501eb411b4bSmrg<row> 502e9fcaa8aSmrg <entry></entry> 503e9fcaa8aSmrg <entry><emphasis>XkbLC_KeypadKeys</emphasis></entry> 504e9fcaa8aSmrg <entry>Bindings primarily for numeric keypad keys</entry> 505e9fcaa8aSmrg <entry>(1L<<10)</entry> 506e9fcaa8aSmrg</row> 507eb411b4bSmrg<row> 508e9fcaa8aSmrg <entry></entry> 509e9fcaa8aSmrg <entry><emphasis>XkbLC_FunctionKeys</emphasis></entry> 510e9fcaa8aSmrg <entry>Bindings primarily for function keys</entry> 511e9fcaa8aSmrg <entry>(1L<<11)</entry> 512e9fcaa8aSmrg</row> 513eb411b4bSmrg<row> 514e9fcaa8aSmrg <entry></entry> 515e9fcaa8aSmrg <entry><emphasis>XkbLC_AlternateGroup</emphasis></entry> 516e9fcaa8aSmrg <entry>Bindings for an alternate group</entry> 517e9fcaa8aSmrg <entry>(1L<<12)</entry> 518e9fcaa8aSmrg</row> 519eb411b4bSmrg<row> 520e9fcaa8aSmrg <entry>Geometry</entry> 521e9fcaa8aSmrg <entry>none</entry> 522e9fcaa8aSmrg <entry></entry> 523e9fcaa8aSmrg <entry></entry> 524e9fcaa8aSmrg </row> 525e9fcaa8aSmrg</tbody> 526e9fcaa8aSmrg</tgroup> 527e9fcaa8aSmrg</table> 528e9fcaa8aSmrg 529e9fcaa8aSmrg</sect1> 530eb411b4bSmrg<sect1 id='Building_a_Keyboard_Description_Using_the_Server_Database'> 531e9fcaa8aSmrg<title>Building a Keyboard Description Using the Server Database</title> 532e9fcaa8aSmrg 533e9fcaa8aSmrg<para> 534e9fcaa8aSmrgA client may request that the server fetch one or more components from its 535e9fcaa8aSmrgdatabase and use those components to build a new server keyboard description. 536e9fcaa8aSmrgThe new keyboard description may be built from scratch, or it may be built 537e9fcaa8aSmrgstarting with the current keyboard description for a particular device. Once 538e9fcaa8aSmrgthe keyboard description is built, all or part of it may be returned to the 539e9fcaa8aSmrgclient. The parts returned to the client need not include all of the parts used 540e9fcaa8aSmrgto build the description. At the time it requests the server to build a new 541e9fcaa8aSmrgkeyboard description, a client may also request that the server use the new 542e9fcaa8aSmrgdescription internally to replace the current keyboard description for a 543e9fcaa8aSmrgspecific device, in which case the behavior of the device changes accordingly. 544e9fcaa8aSmrg</para> 545e9fcaa8aSmrg 546e9fcaa8aSmrg 547e9fcaa8aSmrg<para> 548e9fcaa8aSmrgTo build a new keyboard description from a set of named components, and to 549e9fcaa8aSmrgoptionally have the server use the resulting description to replace an active 550e9fcaa8aSmrgone, use <emphasis> 551e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 552e9fcaa8aSmrg. 553e9fcaa8aSmrg</para> 554e9fcaa8aSmrg 555e9fcaa8aSmrg<informaltable frame='none'> 556eb411b4bSmrg<?dbfo keep-together="always" ?> 557eb411b4bSmrg<tgroup cols='1' align='left' colsep='0' rowsep='0'> 558eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 559e9fcaa8aSmrg<tbody> 560eb411b4bSmrg <row> 561e9fcaa8aSmrg <entry role='functiondecl'> 562e9fcaa8aSmrgXkbDescPtr <emphasis> 563e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 564e9fcaa8aSmrg(<emphasis> 565e9fcaa8aSmrgdpy</emphasis> 566e9fcaa8aSmrg, <emphasis> 567e9fcaa8aSmrgdevice_spec</emphasis> 568e9fcaa8aSmrg, <emphasis> 569e9fcaa8aSmrgnames</emphasis> 570e9fcaa8aSmrg, <emphasis> 571e9fcaa8aSmrgwant</emphasis> 572e9fcaa8aSmrg, <emphasis> 573e9fcaa8aSmrgneed</emphasis> 574e9fcaa8aSmrg, <emphasis> 575e9fcaa8aSmrgload</emphasis> 576e9fcaa8aSmrg) 577e9fcaa8aSmrg </entry> 578e9fcaa8aSmrg </row> 579eb411b4bSmrg <row> 580e9fcaa8aSmrg <entry role='functionargdecl'> 581e9fcaa8aSmrgDisplay * <emphasis> 582e9fcaa8aSmrg dpy</emphasis> 583e9fcaa8aSmrg; /* connection to X server */ 584e9fcaa8aSmrg </entry> 585e9fcaa8aSmrg </row> 586eb411b4bSmrg <row> 587e9fcaa8aSmrg <entry role='functionargdecl'> 588e9fcaa8aSmrgunsigned int <emphasis> 589e9fcaa8aSmrgdevice_spec</emphasis> 590e9fcaa8aSmrg; /* device ID, or <emphasis> 591e9fcaa8aSmrgXkbUseCoreKbd</emphasis> 592e9fcaa8aSmrg */ 593e9fcaa8aSmrg </entry> 594e9fcaa8aSmrg </row> 595eb411b4bSmrg <row> 596e9fcaa8aSmrg <entry role='functionargdecl'> 597e9fcaa8aSmrgXkbComponentNamesPtr <emphasis> 598e9fcaa8aSmrgnames</emphasis> 599e9fcaa8aSmrg; /* names of components to fetch */ 600e9fcaa8aSmrg </entry> 601e9fcaa8aSmrg </row> 602eb411b4bSmrg <row> 603e9fcaa8aSmrg <entry role='functionargdecl'> 604e9fcaa8aSmrgunsigned int <emphasis> 605e9fcaa8aSmrgwant</emphasis> 606e9fcaa8aSmrg; /* desired structures in returned record */ 607e9fcaa8aSmrg </entry> 608e9fcaa8aSmrg </row> 609eb411b4bSmrg <row> 610e9fcaa8aSmrg <entry role='functionargdecl'> 611e9fcaa8aSmrgunsigned int <emphasis> 612e9fcaa8aSmrgneed</emphasis> 613e9fcaa8aSmrg; /* mandatory structures in returned record */ 614e9fcaa8aSmrg </entry> 615e9fcaa8aSmrg </row> 616eb411b4bSmrg <row> 617e9fcaa8aSmrg <entry role='functionargdecl'> 618e9fcaa8aSmrgBool <emphasis> 619e9fcaa8aSmrgload</emphasis> 620e9fcaa8aSmrg; /* <emphasis> 621e9fcaa8aSmrgTrue</emphasis> 622e9fcaa8aSmrg => load into <emphasis> 623e9fcaa8aSmrgdevice_spec</emphasis> 624e9fcaa8aSmrg */ 625e9fcaa8aSmrg </entry> 626e9fcaa8aSmrg</row> 627e9fcaa8aSmrg</tbody> 628e9fcaa8aSmrg</tgroup> 629e9fcaa8aSmrg</informaltable> 630e9fcaa8aSmrg 631e9fcaa8aSmrg<para> 632e9fcaa8aSmrg<emphasis> 633e9fcaa8aSmrgnames</emphasis> 634e9fcaa8aSmrg contains a set of expressions describing the keyboard components the server 635e9fcaa8aSmrgshould use to build the new keyboard description. <emphasis> 636e9fcaa8aSmrgwant</emphasis> 637e9fcaa8aSmrg and <emphasis> 638e9fcaa8aSmrgneed</emphasis> 639e9fcaa8aSmrg are bit fields describing the parts of the resulting keyboard description that 640e9fcaa8aSmrgshould be present in the returned <emphasis> 641e9fcaa8aSmrgXkbDescRec</emphasis> 642e9fcaa8aSmrg. 643e9fcaa8aSmrg</para> 644e9fcaa8aSmrg 645e9fcaa8aSmrg 646e9fcaa8aSmrg<para> 647e9fcaa8aSmrgThe individual fields in <emphasis> 648e9fcaa8aSmrgnames</emphasis> 649e9fcaa8aSmrg are <emphasis> 650e9fcaa8aSmrgcomponent expressions</emphasis> 651e9fcaa8aSmrg composed of keyboard component names (no wildcarding as may be used in 652e9fcaa8aSmrg<emphasis> 653e9fcaa8aSmrgXkbListComponents</emphasis> 654e9fcaa8aSmrg), the special component name symbol ‘%’, and the special operator 655e9fcaa8aSmrgcharacters ‘<emphasis> 656e9fcaa8aSmrg+</emphasis> 657e9fcaa8aSmrg’ and ‘<emphasis> 658e9fcaa8aSmrg|</emphasis> 659e9fcaa8aSmrg’. A component expression is parsed left to right, as follows: 660e9fcaa8aSmrg</para> 661e9fcaa8aSmrg 662e9fcaa8aSmrg<itemizedlist> 663e9fcaa8aSmrg<listitem> 664e9fcaa8aSmrg <para> 665e9fcaa8aSmrgThe special component name "<emphasis> 666e9fcaa8aSmrgcomputed</emphasis> 667e9fcaa8aSmrg" may be used in <emphasis> 668e9fcaa8aSmrgkeycodes</emphasis> 669e9fcaa8aSmrg component expressions and refers to a component consisting of a set of 670e9fcaa8aSmrgkeycodes computed automatically by the server as needed. 671e9fcaa8aSmrg </para> 672e9fcaa8aSmrg</listitem> 673e9fcaa8aSmrg<listitem> 674e9fcaa8aSmrg <para> 675e9fcaa8aSmrgThe special component name "<emphasis> 676e9fcaa8aSmrgcanonical</emphasis> 677e9fcaa8aSmrg" may be used in <emphasis> 678e9fcaa8aSmrgtypes</emphasis> 679e9fcaa8aSmrg component expressions and refers to a partial component defining the four 680e9fcaa8aSmrgstandard key types: <emphasis> 681e9fcaa8aSmrgALPHABETIC</emphasis> 682e9fcaa8aSmrg, <emphasis> 683e9fcaa8aSmrgONE_LEVEL</emphasis> 684e9fcaa8aSmrg, <emphasis> 685e9fcaa8aSmrgTWO_LEVEL</emphasis> 686e9fcaa8aSmrg, and <emphasis> 687e9fcaa8aSmrgKEYPAD</emphasis> 688e9fcaa8aSmrg. 689e9fcaa8aSmrg </para> 690e9fcaa8aSmrg</listitem> 691e9fcaa8aSmrg<listitem> 692e9fcaa8aSmrg <para> 693e9fcaa8aSmrgThe special component name ‘<emphasis> 694e9fcaa8aSmrg%</emphasis> 695e9fcaa8aSmrg’ refers to the keyboard description for the device specified in <emphasis> 696e9fcaa8aSmrgdevice_spec</emphasis> 697e9fcaa8aSmrg or the keymap names component. If a keymap names component is specified that 698e9fcaa8aSmrgdoes not begin with ‘+’ or ‘|’ and does not contain ‘<emphasis> 699e9fcaa8aSmrg%</emphasis> 700e9fcaa8aSmrg’, then ‘<emphasis> 701e9fcaa8aSmrg%</emphasis> 702e9fcaa8aSmrg’ refers to the description generated by the keymap names component. 703e9fcaa8aSmrgOtherwise, it refers to the keyboard description for <emphasis> 704e9fcaa8aSmrgdevice_spec</emphasis> 705e9fcaa8aSmrg. 706e9fcaa8aSmrg </para> 707e9fcaa8aSmrg</listitem> 708e9fcaa8aSmrg<listitem> 709e9fcaa8aSmrg <para> 710e9fcaa8aSmrgThe ‘<emphasis> 711e9fcaa8aSmrg+</emphasis> 712e9fcaa8aSmrg’ operator specifies that the following component should <emphasis> 713e9fcaa8aSmrgoverride</emphasis> 714e9fcaa8aSmrg the currently assembled description; any definitions that are present in both 715e9fcaa8aSmrgcomponents are taken from the second. 716e9fcaa8aSmrg </para> 717e9fcaa8aSmrg</listitem> 718e9fcaa8aSmrg<listitem> 719e9fcaa8aSmrg <para> 720e9fcaa8aSmrgThe ‘<emphasis> 721e9fcaa8aSmrg|</emphasis> 722e9fcaa8aSmrg’ operator specifies that the next specified component should <emphasis> 723e9fcaa8aSmrgaugment</emphasis> 724e9fcaa8aSmrg the currently assembled description; any definitions that are present in both 725e9fcaa8aSmrgcomponents are taken from the first. 726e9fcaa8aSmrg </para> 727e9fcaa8aSmrg</listitem> 728e9fcaa8aSmrg<listitem> 729e9fcaa8aSmrg <para> 730e9fcaa8aSmrgIf the component expression begins with an operator, a leading ‘<emphasis> 731e9fcaa8aSmrg%</emphasis> 732e9fcaa8aSmrg’ is implied. 733e9fcaa8aSmrg </para> 734e9fcaa8aSmrg</listitem> 735e9fcaa8aSmrg<listitem> 736e9fcaa8aSmrg <para> 737e9fcaa8aSmrgIf any unknown or illegal characters appear anywhere in the expression, the 738e9fcaa8aSmrgentire expression is invalid and is ignored. 739e9fcaa8aSmrg </para> 740e9fcaa8aSmrg</listitem> 741e9fcaa8aSmrg</itemizedlist> 742e9fcaa8aSmrg 743e9fcaa8aSmrg<para> 744e9fcaa8aSmrgFor example, if <emphasis> 745e9fcaa8aSmrgnames->symbols</emphasis> 746e9fcaa8aSmrg contained the expression "+de", it specifies that the default member of the 747e9fcaa8aSmrg"de" class of symbols should be applied to the current keyboard mapping, 748e9fcaa8aSmrgoverriding any existing definitions (it could also be written "+de(default)"). 749e9fcaa8aSmrg</para> 750e9fcaa8aSmrg 751e9fcaa8aSmrg 752e9fcaa8aSmrg<para> 753e9fcaa8aSmrgHere is a slightly more involved example: the expression 754e9fcaa8aSmrg"acme(ascii)+de(basic)|iso9995-3" constructs a German (de) mapping for the 755e9fcaa8aSmrgASCII keyboard supplied by the "acme" vendor. The new definition begins with 756e9fcaa8aSmrgthe symbols for the ASCII keyboard for Acme (<emphasis> 757e9fcaa8aSmrgacme(ascii)</emphasis> 758e9fcaa8aSmrg), overrides them with definitions for the basic German keyboard (<emphasis> 759e9fcaa8aSmrgde(basic)</emphasis> 760e9fcaa8aSmrg), and then applies the definitions from the default iso9995-3 keyboard 761e9fcaa8aSmrg(<emphasis> 762e9fcaa8aSmrgiso9995-3</emphasis> 763e9fcaa8aSmrg) to any undefined keys or groups of keys (part three of the iso9995 standard 764e9fcaa8aSmrgdefines a common set of bindings for the secondary group, but allows national 765e9fcaa8aSmrglayouts to override those definitions where necessary). 766e9fcaa8aSmrg</para> 767e9fcaa8aSmrg 768e9fcaa8aSmrg<note><para>The interpretation of the above expression components (acme, ascii, 769e9fcaa8aSmrgde, basic, iso9995-3) is not defined by Xkb; only the operations and their 770e9fcaa8aSmrgordering are.</para></note> 771e9fcaa8aSmrg 772e9fcaa8aSmrg<para> 773e9fcaa8aSmrgNote that the presence of a keymap <emphasis> 774e9fcaa8aSmrgnames</emphasis> 775e9fcaa8aSmrg component that does not contain ‘<emphasis> 776e9fcaa8aSmrg%</emphasis> 777e9fcaa8aSmrg’ (either explicit or implied by virtue of an expression starting with an 778e9fcaa8aSmrgoperator) indicates a description that is independent of the keyboard 779e9fcaa8aSmrgdescription for the device specified in <emphasis> 780e9fcaa8aSmrgdevice_spec</emphasis> 781e9fcaa8aSmrg. The same is true of requests in which the keymap names component is empty and 782e9fcaa8aSmrgall five other names components contain expressions void of references to 783e9fcaa8aSmrg‘<emphasis> 784e9fcaa8aSmrg%</emphasis> 785e9fcaa8aSmrg’. Requests of this form allow you to deal with keyboard definitions 786e9fcaa8aSmrgindependent of any actual device. 787e9fcaa8aSmrg</para> 788e9fcaa8aSmrg 789e9fcaa8aSmrg 790e9fcaa8aSmrg<para> 791e9fcaa8aSmrgThe server parses all non-<emphasis> 792e9fcaa8aSmrgNULL</emphasis> 793e9fcaa8aSmrg fields in <emphasis> 794e9fcaa8aSmrgnames</emphasis> 795e9fcaa8aSmrg and uses them to build a keyboard description. However, before parsing the 796e9fcaa8aSmrgexpressions in <emphasis> 797e9fcaa8aSmrgnames</emphasis> 798e9fcaa8aSmrg, the server ORs the bits in <emphasis> 799e9fcaa8aSmrgwant</emphasis> 800e9fcaa8aSmrg and <emphasis> 801e9fcaa8aSmrgneed</emphasis> 802e9fcaa8aSmrg together and examines the result in relationship to the expressions in 803e9fcaa8aSmrg<emphasis> 804e9fcaa8aSmrgnames</emphasis> 805e9fcaa8aSmrg. Table 20.3 identifies the components that are required for each of the 806e9fcaa8aSmrgpossible bits in <emphasis> 807e9fcaa8aSmrgwant</emphasis> 808e9fcaa8aSmrg or <emphasis> 809e9fcaa8aSmrgneed</emphasis> 810e9fcaa8aSmrg. If a required component has not been specified in the <emphasis> 811e9fcaa8aSmrgnames</emphasis> 812e9fcaa8aSmrg structure (the corresponding field is <emphasis> 813e9fcaa8aSmrgNULL</emphasis> 814e9fcaa8aSmrg), the server substitutes the expression "<emphasis> 815e9fcaa8aSmrg%</emphasis> 816e9fcaa8aSmrg", resulting in the component values being taken from <emphasis> 817e9fcaa8aSmrgdevice_spec</emphasis> 818e9fcaa8aSmrg. In addition, if <emphasis> 819e9fcaa8aSmrgload</emphasis> 820e9fcaa8aSmrg is <emphasis> 821e9fcaa8aSmrgTrue</emphasis> 822e9fcaa8aSmrg, the server modifies <emphasis> 823e9fcaa8aSmrgnames</emphasis> 824e9fcaa8aSmrg if necessary (again using a "<emphasis> 825e9fcaa8aSmrg%</emphasis> 826e9fcaa8aSmrg" entry) to ensure all of the following fields are non-<emphasis> 827e9fcaa8aSmrgNULL</emphasis> 828e9fcaa8aSmrg: <emphasis> 829e9fcaa8aSmrgtypes</emphasis> 830e9fcaa8aSmrg, <emphasis> 831e9fcaa8aSmrgkeycodes</emphasis> 832e9fcaa8aSmrg, <emphasis> 833e9fcaa8aSmrgsymbols</emphasis> 834e9fcaa8aSmrg, and <emphasis> 835e9fcaa8aSmrgcompat</emphasis> 836e9fcaa8aSmrg.<emphasis> 837e9fcaa8aSmrg</emphasis> 838e9fcaa8aSmrg</para> 839e9fcaa8aSmrg 840eb411b4bSmrg<table frame='topbot'> 841e9fcaa8aSmrg<title>Want and Need Mask Bits and Required Names Components</title> 842eb411b4bSmrg<?dbfo keep-together="always" ?> 843eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'> 844eb411b4bSmrg<colspec colname='c1' colwidth='2.4*'/> 845eb411b4bSmrg<colspec colname='c2' colwidth='2.6*'/> 846eb411b4bSmrg<colspec colname='c3' colwidth='1.0*'/> 847e9fcaa8aSmrg<thead> 848eb411b4bSmrg<row rowsep='1'> 849e9fcaa8aSmrg <entry>want or need mask bit</entry> 850e9fcaa8aSmrg <entry>Required names Components</entry> 851e9fcaa8aSmrg <entry>value</entry> 852e9fcaa8aSmrg </row> 853e9fcaa8aSmrg</thead> 854e9fcaa8aSmrg<tbody> 855eb411b4bSmrg <row> 856e9fcaa8aSmrg <entry>XkbGBN_TypesMask</entry> 857e9fcaa8aSmrg <entry>Types</entry> 858e9fcaa8aSmrg <entry>(1L<<0)</entry> 859e9fcaa8aSmrg </row> 860eb411b4bSmrg <row> 861e9fcaa8aSmrg <entry>XkbGBN_CompatMapMask</entry> 862e9fcaa8aSmrg <entry>Compat</entry> 863e9fcaa8aSmrg <entry>(1L<<1)</entry> 864e9fcaa8aSmrg </row> 865eb411b4bSmrg <row> 866e9fcaa8aSmrg <entry>XkbGBN_ClientSymbolsMask</entry> 867e9fcaa8aSmrg <entry>Types + Symbols + Keycodes</entry> 868e9fcaa8aSmrg <entry>(1L<<2)</entry> 869e9fcaa8aSmrg </row> 870eb411b4bSmrg <row> 871e9fcaa8aSmrg <entry>XkbGBN_ServerSymbolsMask</entry> 872e9fcaa8aSmrg <entry>Types + Symbols + Keycodes</entry> 873e9fcaa8aSmrg <entry>(1L<<3)</entry> 874e9fcaa8aSmrg </row> 875eb411b4bSmrg <row> 876e9fcaa8aSmrg <entry>XkbGBN_SymbolsMask</entry> 877e9fcaa8aSmrg <entry>Symbols</entry> 878e9fcaa8aSmrg <entry>(1L<<1)</entry> 879e9fcaa8aSmrg </row> 880eb411b4bSmrg <row> 881e9fcaa8aSmrg <entry>XkbGBN_IndicatorMapMask</entry> 882e9fcaa8aSmrg <entry>Compat</entry> 883e9fcaa8aSmrg <entry>(1L<<4)</entry> 884e9fcaa8aSmrg </row> 885eb411b4bSmrg <row> 886e9fcaa8aSmrg <entry>XkbGBN_KeyNamesMask</entry> 887e9fcaa8aSmrg <entry>Keycodes</entry> 888e9fcaa8aSmrg <entry>(1L<<5)</entry> 889e9fcaa8aSmrg </row> 890eb411b4bSmrg <row> 891e9fcaa8aSmrg <entry>XkbGBN_GeometryMask</entry> 892e9fcaa8aSmrg <entry>Geometry</entry> 893e9fcaa8aSmrg <entry>(1L<<6)</entry> 894e9fcaa8aSmrg </row> 895eb411b4bSmrg <row> 896e9fcaa8aSmrg <entry>XkbGBN_OtherNamesMask</entry> 897e9fcaa8aSmrg <entry>Types + Symbols + Keycodes + Compat + Geometry</entry> 898e9fcaa8aSmrg <entry>(1L<<7)</entry> 899e9fcaa8aSmrg </row> 900eb411b4bSmrg <row> 901e9fcaa8aSmrg <entry>XkbGBN_AllComponentsMask</entry> 902e9fcaa8aSmrg <entry></entry> 903e9fcaa8aSmrg <entry>(0xff)</entry> 904e9fcaa8aSmrg </row> 905e9fcaa8aSmrg</tbody> 906e9fcaa8aSmrg</tgroup> 907e9fcaa8aSmrg</table> 908e9fcaa8aSmrg 909e9fcaa8aSmrg<para> 910e9fcaa8aSmrg<emphasis> 911e9fcaa8aSmrgneed</emphasis> 912e9fcaa8aSmrg specifies a set of keyboard components that the server must be able to resolve 913e9fcaa8aSmrgin order for <emphasis> 914e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 915e9fcaa8aSmrg to succeed; if any of the components specified in <emphasis> 916e9fcaa8aSmrgneed</emphasis> 917e9fcaa8aSmrg cannot be successfully resolved, <emphasis> 918e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 919e9fcaa8aSmrg fails. 920e9fcaa8aSmrg</para> 921e9fcaa8aSmrg 922e9fcaa8aSmrg 923e9fcaa8aSmrg<para> 924e9fcaa8aSmrg<emphasis> 925e9fcaa8aSmrgwant</emphasis> 926e9fcaa8aSmrg specifies a set of keyboard components that the server should attempt to 927e9fcaa8aSmrgresolve, but that are not mandatory. If the server is unable to resolve any of 928e9fcaa8aSmrgthese components, <emphasis> 929e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 930e9fcaa8aSmrg still succeeds. Bits specified in <emphasis> 931e9fcaa8aSmrgwant</emphasis> 932e9fcaa8aSmrg that are also specified in <emphasis> 933e9fcaa8aSmrgneed</emphasis> 934e9fcaa8aSmrg have no effect in the context of <emphasis> 935e9fcaa8aSmrgwant</emphasis> 936e9fcaa8aSmrg. 937e9fcaa8aSmrg</para> 938e9fcaa8aSmrg 939e9fcaa8aSmrg 940e9fcaa8aSmrg<para> 941e9fcaa8aSmrgIf <emphasis> 942e9fcaa8aSmrgload</emphasis> 943e9fcaa8aSmrg is <emphasis> 944e9fcaa8aSmrgTrue</emphasis> 945e9fcaa8aSmrg, the server updates its keyboard description for <emphasis> 946e9fcaa8aSmrgdevice_spec</emphasis> 947e9fcaa8aSmrg to match the result of the keyboard description just built. If load is 948e9fcaa8aSmrg<emphasis> 949e9fcaa8aSmrgFalse</emphasis> 950e9fcaa8aSmrg, the server’s description for device <emphasis> 951e9fcaa8aSmrgdevice_spec</emphasis> 952e9fcaa8aSmrg is not updated. In all cases, the parts specified by <emphasis> 953e9fcaa8aSmrgwant</emphasis> 954e9fcaa8aSmrg and <emphasis> 955e9fcaa8aSmrgneed</emphasis> 956e9fcaa8aSmrg from the just-built keyboard description are returned. 957e9fcaa8aSmrg</para> 958e9fcaa8aSmrg 959e9fcaa8aSmrg 960e9fcaa8aSmrg<para> 961e9fcaa8aSmrgThe <emphasis> 962e9fcaa8aSmrgnames</emphasis> 963e9fcaa8aSmrg structure in an <emphasis> 964e9fcaa8aSmrgXkbDescRec</emphasis> 965e9fcaa8aSmrg keyboard description record (see Chapter 18) contains one field for each of 966e9fcaa8aSmrgthe five component types used to build a keyboard description. When a keyboard 967e9fcaa8aSmrgdescription is built from a set of database components, the corresponding 968e9fcaa8aSmrgfields in this <emphasis> 969e9fcaa8aSmrgnames</emphasis> 970e9fcaa8aSmrg structure are set to match the expressions used to build the component. 971e9fcaa8aSmrg</para> 972e9fcaa8aSmrg 973e9fcaa8aSmrg 974e9fcaa8aSmrg<para> 975e9fcaa8aSmrgThe entire process of building a new keyboard description from the server 976e9fcaa8aSmrgdatabase of components and returning all or part of it is diagrammed in Figure 977e9fcaa8aSmrg20.1: 978e9fcaa8aSmrg</para> 979e9fcaa8aSmrg 980e9fcaa8aSmrg<mediaobject> 981e9fcaa8aSmrg <imageobject> <imagedata format="SVG" fileref="XKBlib-21.svg"/> 982e9fcaa8aSmrg </imageobject> 983e9fcaa8aSmrg <caption>Building a New Keyboard Description from the Server Database</caption> 984e9fcaa8aSmrg</mediaobject> 985e9fcaa8aSmrg 986e9fcaa8aSmrg<para> 987e9fcaa8aSmrgThe information returned to the client in the <emphasis> 988e9fcaa8aSmrgXkbDescRec</emphasis> 989e9fcaa8aSmrg is essentially the result of a series of calls to extract information from a 990e9fcaa8aSmrgfictitious device whose description matches the one just built. The calls 991e9fcaa8aSmrgcorresponding to each of the mask bits are summarized in Table 20.4, together 992e9fcaa8aSmrgwith the <emphasis> 993e9fcaa8aSmrgXkbDescRec</emphasis> 994e9fcaa8aSmrg components that are filled in. 995e9fcaa8aSmrg</para> 996e9fcaa8aSmrg 997eb411b4bSmrg<table frame='topbot'> 998e9fcaa8aSmrg<title>XkbDescRec Components Returned for Values of Want & Needs</title> 999eb411b4bSmrg<?dbfo keep-together="always" ?> 1000eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'> 1001eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 1002eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/> 1003eb411b4bSmrg<colspec colname='c3' colwidth='1.0*'/> 1004e9fcaa8aSmrg<thead> 1005eb411b4bSmrg<row rowsep='1'> 1006e9fcaa8aSmrg <entry>Request (want+need)</entry> 1007e9fcaa8aSmrg <entry>Fills in Xkb components</entry> 1008e9fcaa8aSmrg <entry>Equivalent Function Call</entry> 1009e9fcaa8aSmrg </row> 1010e9fcaa8aSmrg</thead> 1011e9fcaa8aSmrg<tbody> 1012eb411b4bSmrg <row> 1013e9fcaa8aSmrg <entry>XkbGBN_TypesMask</entry> 1014e9fcaa8aSmrg <entry>map.types</entry> 1015e9fcaa8aSmrg <entry>XkbGetUpdatedMap(dpy, XkbTypesMask, Xkb)</entry> 1016e9fcaa8aSmrg </row> 1017eb411b4bSmrg <row> 1018e9fcaa8aSmrg <entry>XkbGBN_ServerSymbolsMask</entry> 1019e9fcaa8aSmrg <entry>server</entry> 1020e9fcaa8aSmrg <entry>XkbGetUpdatedMap(dpy, XkbAllClientInfoMask, Xkb)</entry> 1021e9fcaa8aSmrg </row> 1022eb411b4bSmrg <row> 1023e9fcaa8aSmrg <entry>XkbGBN_ClientSymbolsMask</entry> 1024e9fcaa8aSmrg <entry>map, including map.types</entry> 1025e9fcaa8aSmrg <entry>XkbGetUpdatedMap(dpy, XkbAllServerInfoMask, Xkb)</entry> 1026e9fcaa8aSmrg </row> 1027eb411b4bSmrg <row> 1028e9fcaa8aSmrg <entry>XkbGBN_IndicatorMaps</entry> 1029e9fcaa8aSmrg <entry>indicators</entry> 1030e9fcaa8aSmrg <entry>XkbGetIndicatorMap(dpy, XkbAllIndicators, Xkb)</entry> 1031e9fcaa8aSmrg </row> 1032eb411b4bSmrg <row> 1033e9fcaa8aSmrg <entry>XkbGBN_CompatMapMask</entry> 1034e9fcaa8aSmrg <entry>compat</entry> 1035e9fcaa8aSmrg <entry>XkbGetCompatMap(dpy, XkbAllCompatMask, Xkb)</entry> 1036e9fcaa8aSmrg </row> 1037eb411b4bSmrg <row> 1038e9fcaa8aSmrg <entry>XkbGBN_GeometryMask</entry> 1039e9fcaa8aSmrg <entry>geom</entry> 1040e9fcaa8aSmrg <entry>XkbGetGeometry(dpy, Xkb)</entry> 1041e9fcaa8aSmrg </row> 1042eb411b4bSmrg <row> 1043e9fcaa8aSmrg <entry>XkbGBN_KeyNamesMask</entry> 1044e9fcaa8aSmrg <entry> 1045e9fcaa8aSmrg<para>names.keys</para> 1046e9fcaa8aSmrg<para>names.key_aliases</para> 1047e9fcaa8aSmrg </entry> 1048e9fcaa8aSmrg <entry> 1049e9fcaa8aSmrgXkbGetNames(dpy, XkbKeyNamesMask | XkbKeyAliasesMask, Xkb) 1050e9fcaa8aSmrg </entry> 1051e9fcaa8aSmrg </row> 1052eb411b4bSmrg <row> 1053e9fcaa8aSmrg <entry>XkbGBN_OtherNamesMask</entry> 1054e9fcaa8aSmrg <entry> 1055e9fcaa8aSmrg<para>names.keycodes</para> 1056e9fcaa8aSmrg<para>names.geometry</para> 1057e9fcaa8aSmrg<para>names.symbols</para> 1058e9fcaa8aSmrg<para>names.types</para> 1059e9fcaa8aSmrg<para>map.types[*].lvl_names[*]</para> 1060e9fcaa8aSmrg<para>names.compat</para> 1061e9fcaa8aSmrg<para>names.vmods</para> 1062e9fcaa8aSmrg<para>names.indicators</para> 1063e9fcaa8aSmrg<para>names.groups</para> 1064e9fcaa8aSmrg<para>names.radio_groups</para> 1065e9fcaa8aSmrg<para>names.phys_symbols</para> 1066e9fcaa8aSmrg </entry> 1067e9fcaa8aSmrg <entry> 1068e9fcaa8aSmrg<para>XkbGetNames(dpy, XkbAllNamesMask &</para> 1069e9fcaa8aSmrg<para>~(XkbKeyNamesMask | XkbKeyAliasesMask),</para> 1070e9fcaa8aSmrg<para>Xkb)</para> 1071e9fcaa8aSmrg </entry> 1072e9fcaa8aSmrg </row> 1073e9fcaa8aSmrg</tbody> 1074e9fcaa8aSmrg</tgroup> 1075e9fcaa8aSmrg</table> 1076e9fcaa8aSmrg 1077e9fcaa8aSmrg<para> 1078e9fcaa8aSmrgThere is no way to determine which components specified in <emphasis> 1079e9fcaa8aSmrgwant</emphasis> 1080e9fcaa8aSmrg (but not in <emphasis> 1081e9fcaa8aSmrgneed</emphasis> 1082e9fcaa8aSmrg) were actually fetched, other than breaking the call into successive calls to 1083e9fcaa8aSmrg<emphasis> 1084e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 1085e9fcaa8aSmrg and specifying individual components. 1086e9fcaa8aSmrg</para> 1087e9fcaa8aSmrg 1088e9fcaa8aSmrg 1089e9fcaa8aSmrg<para> 1090e9fcaa8aSmrg<emphasis> 1091e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 1092e9fcaa8aSmrg always sets <emphasis> 1093e9fcaa8aSmrgmin_key_code</emphasis> 1094e9fcaa8aSmrg and <emphasis> 1095e9fcaa8aSmrgmax_key_code</emphasis> 1096e9fcaa8aSmrg in the returned <emphasis> 1097e9fcaa8aSmrgXkbDescRec</emphasis> 1098e9fcaa8aSmrg structure. 1099e9fcaa8aSmrg</para> 1100e9fcaa8aSmrg 1101e9fcaa8aSmrg 1102e9fcaa8aSmrg<para> 1103e9fcaa8aSmrg<emphasis>XkbGetKeyboardByName</emphasis> 1104e9fcaa8aSmrgis synchronous; it sends the request to the server to build a new keyboard 1105e9fcaa8aSmrgdescription and waits for the reply. If successful, the return value is 1106e9fcaa8aSmrgnon-<emphasis>NULL</emphasis>. 1107e9fcaa8aSmrg<emphasis>XkbGetKeyboardByName</emphasis> 1108e9fcaa8aSmrggenerates a <emphasis>BadMatch</emphasis> 1109e9fcaa8aSmrgprotocol error if errors are encountered when building the keyboard 1110e9fcaa8aSmrgdescription. 1111e9fcaa8aSmrg</para> 1112e9fcaa8aSmrg 1113e9fcaa8aSmrg 1114e9fcaa8aSmrg<para> 1115e9fcaa8aSmrgIf you simply want to obtain information about the current keyboard device, 1116e9fcaa8aSmrgrather than generating a new keyboard description from elements in the server 1117e9fcaa8aSmrgdatabase, use <emphasis> 1118e9fcaa8aSmrgXkbGetKeyboard</emphasis> 1119e9fcaa8aSmrg (see section 6.2). 1120e9fcaa8aSmrg</para> 1121e9fcaa8aSmrg 1122e9fcaa8aSmrg<informaltable frame='none'> 1123eb411b4bSmrg<?dbfo keep-together="always" ?> 1124eb411b4bSmrg<tgroup cols='1' align='left' colsep='0' rowsep='0'> 1125eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/> 1126e9fcaa8aSmrg<tbody> 1127eb411b4bSmrg <row> 1128e9fcaa8aSmrg <entry role='functiondecl'> 1129e9fcaa8aSmrgXkbDescPtr <emphasis> 1130e9fcaa8aSmrgXkbGetKeyboard</emphasis> 1131e9fcaa8aSmrg(<emphasis> 1132e9fcaa8aSmrgdpy</emphasis> 1133e9fcaa8aSmrg, <emphasis> 1134e9fcaa8aSmrgwhich</emphasis> 1135e9fcaa8aSmrg, <emphasis> 1136e9fcaa8aSmrgdevice_spec</emphasis> 1137e9fcaa8aSmrg) 1138e9fcaa8aSmrg </entry> 1139e9fcaa8aSmrg </row> 1140eb411b4bSmrg <row> 1141e9fcaa8aSmrg <entry role='functionargdecl'> 1142e9fcaa8aSmrgDisplay * <emphasis> 1143e9fcaa8aSmrg dpy</emphasis> 1144e9fcaa8aSmrg; /* connection to X server */ 1145e9fcaa8aSmrg </entry> 1146e9fcaa8aSmrg </row> 1147eb411b4bSmrg <row> 1148e9fcaa8aSmrg <entry role='functionargdecl'> 1149e9fcaa8aSmrgunsigned int<emphasis> 1150e9fcaa8aSmrg which</emphasis> 1151e9fcaa8aSmrg; /* mask of components of <emphasis> 1152e9fcaa8aSmrgXkbDescRec</emphasis> 1153e9fcaa8aSmrg of interest */ 1154e9fcaa8aSmrg </entry> 1155e9fcaa8aSmrg </row> 1156eb411b4bSmrg <row> 1157e9fcaa8aSmrg <entry role='functionargdecl'> 1158e9fcaa8aSmrgunsigned int <emphasis> 1159e9fcaa8aSmrg device_spec</emphasis> 1160e9fcaa8aSmrg; /* device ID */ 1161e9fcaa8aSmrg </entry> 1162e9fcaa8aSmrg</row> 1163e9fcaa8aSmrg</tbody> 1164e9fcaa8aSmrg</tgroup> 1165e9fcaa8aSmrg</informaltable> 1166e9fcaa8aSmrg 1167e9fcaa8aSmrg<para> 1168e9fcaa8aSmrg<emphasis> 1169e9fcaa8aSmrgXkbGetKeyboard</emphasis> 1170e9fcaa8aSmrg is used to read the current description for one or more components of a 1171e9fcaa8aSmrgkeyboard device. It calls <emphasis> 1172e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 1173e9fcaa8aSmrg as follows: 1174e9fcaa8aSmrg</para> 1175e9fcaa8aSmrg 1176e9fcaa8aSmrg 1177e9fcaa8aSmrg<para> 1178e9fcaa8aSmrg<emphasis> 1179e9fcaa8aSmrgXkbGetKeyboardByName</emphasis> 1180e9fcaa8aSmrg(<emphasis> 1181e9fcaa8aSmrgdpy</emphasis> 1182e9fcaa8aSmrg, <emphasis> 1183e9fcaa8aSmrgdevice_spec</emphasis> 1184e9fcaa8aSmrg, <emphasis> 1185e9fcaa8aSmrgNULL</emphasis> 1186e9fcaa8aSmrg, <emphasis> 1187e9fcaa8aSmrgwhich</emphasis> 1188e9fcaa8aSmrg, <emphasis> 1189e9fcaa8aSmrgwhich</emphasis> 1190e9fcaa8aSmrg, <emphasis> 1191e9fcaa8aSmrgFalse</emphasis> 1192e9fcaa8aSmrg). 1193e9fcaa8aSmrg</para> 1194e9fcaa8aSmrg 1195e9fcaa8aSmrg</sect1> 1196e9fcaa8aSmrg</chapter> 1197