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