1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
4<chapter id='Xkb_Server_Keyboard_Mapping'>
5<title>Xkb Server Keyboard Mapping</title>
6
7<indexterm zone="Xkb_Server_Keyboard_Mapping">
8<primary>server map</primary></indexterm>
9<indexterm zone="Xkb_Server_Keyboard_Mapping">
10<primary>map</primary><secondary>server</secondary></indexterm>
11
12<para>
13The
14<structfield>server</structfield>
15field of the complete Xkb keyboard description (see <link linkend="The_XkbDescRec_Structure">section 6.1</link>) is a pointer
16to the Xkb server map.
17</para>
18
19
20<para>
21<link linkend="figure16.1">Figure 16.1</link> shows the relationships between elements in the server map:
22</para>
23
24<figure id='figure16.1'>
25  <title>Server Map Relationships</title>
26  <mediaobject>
27   <imageobject> <imagedata format="SVG" fileref="XKBlib-16.svg"/>
28   </imageobject>
29   </mediaobject>
30</figure>
31
32
33<!--
34<H5 CLASS="Figure">
35Server Map Relationships</H5>
36-->
37
38<para id='XkbServerMapRec'>
39<indexterm significance="preferred" zone="XkbServerMapRec">
40<primary><structname>XkbServerMapRec</structname></primary></indexterm>
41The Xkb server map contains the information the server needs to interpret key
42events and is of type
43<structname>XkbServerMapRec</structname>:
44
45<programlisting>
46#define XkbNumVirtualMods            16
47
48typedef struct {                       /* Server Map */
49    unsigned short     num_acts;       /* # of occupied entries in <structfield>acts</structfield> */
50    unsigned short     size_acts;      /* # of entries in <structfield>acts</structfield> */
51    XkbAction *        acts;           /* linear 2d tables of key actions,
52                                          1 per keycode */
53    XkbBehavior *      behaviors;      /* key behaviors, 1 per keycode */
54    unsigned short *   key_acts;       /* index into <structfield>acts</structfield>, 1 per keycode */
55    unsigned char *    explicit;       /* explicit overrides of core
56                                          remapping, 1 per key */
57    unsigned char      vmods[XkbNumVirtualMods];  /* real mods bound
58                                                     to virtual mods */
59    unsigned short *   vmodmap;        /* virtual mods bound to key,
60                                          1 per keycode */
61} <structname>XkbServerMapRec</structname>, *XkbServerMapPtr;
62</programlisting></para>
63
64<para>
65The
66<structfield>num_acts</structfield>,
67<structfield>size_acts</structfield>,
68<structfield>acts</structfield>,
69and
70<structfield>key_acts</structfield>
71fields specify the key actions, defined in <link linkend="Key_Actions">section 16.1</link>. The
72<structfield>behaviors</structfield>
73field describes the behavior for each key and is defined in <link linkend="Key_Behavior">section 16.2</link>. The
74<structfield>explicit</structfield>
75field describes the explicit components for a key and is defined in
76<link linkend="Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server">section 16.3</link>. The
77<structfield>vmods</structfield>
78and the
79<structfield>vmodmap</structfield>
80fields describe the virtual modifiers and the per-key virtual modifier mapping
81and are defined in <link linkend="Virtual_Modifier_Mapping">section 16.4</link>.
82</para>
83
84<sect1 id='Key_Actions'>
85<title>Key Actions</title>
86
87<para>
88A key action defines the effect key presses and releases have on the internal
89state of the server. For example, the expected key action associated with
90pressing the
91<symbol>Shift</symbol>
92key is to set the
93<symbol>Shift</symbol>
94modifier. There is zero or one key action associated with each keysym bound to
95each key.
96</para>
97
98
99<para>
100Just as the entire list of key symbols for the keyboard mapping is held in the
101<structfield>syms</structfield>
102field of the client map, the entire list of key actions for the keyboard
103mapping is held in the
104<structfield>acts</structfield>
105array of the server map. The total size of
106<structfield>acts</structfield>
107is specified by
108<structfield>size_acts</structfield>,
109and the number of entries is specified by
110<structfield>num_acts</structfield>.
111</para>
112
113
114<para>
115The
116<structfield>key_acts</structfield>
117array, indexed by keycode, describes the actions associated with a key. The
118<structfield>key_acts</structfield>
119array has
120<structfield>min_key_code</structfield>
121unused entries at the start to allow direct indexing using a keycode. If a
122<structfield>key_acts</structfield>
123entry is
124<emphasis>zero</emphasis>,
125it means the key does not have any actions associated with it. If an entry is
126not
127<emphasis>zero</emphasis>,
128the entry represents an index into the
129<structfield>acts</structfield>
130field of the server map, much as the
131<structfield>offset</structfield>
132field of a
133<structname>KeySymMapRec</structname>
134structure is an index into the
135<structfield>syms</structfield>
136field of the client map.
137</para>
138
139<para>
140The reason the
141<structfield>acts</structfield>
142field is a linear list of
143<structname>XkbAction</structname>s
144is to reduce the memory consumption associated with a keymap. Because Xkb
145allows individual keys to have multiple shift levels and a different number of
146groups per key, a single two-dimensional array of
147<type>KeySym</type>s
148would potentially be very large and sparse. Instead, Xkb provides a small
149two-dimensional array of
150<structname>XkbAction</structname>s
151for each key. To store all of these individual arrays, Xkb concatenates each
152array together in the
153<structfield>acts</structfield>
154field of the server map.
155</para>
156
157
158<para>
159The key action structures consist only of fields of type char or unsigned char.
160This is done to optimize data transfer when the server sends bytes over the
161wire. If the fields are anything but bytes, the server has to sift through all
162of the actions and swap any nonbyte fields. Because they consist of nothing but
163bytes, it can just copy them out.
164</para>
165
166
167<para>
168Xkb provides the following macros, to simplify accessing information pertaining
169to key actions:
170</para>
171
172<indexterm significance="preferred" zone="XkbKeyHasActions"><primary><function>XkbKeyHasActions</function></primary></indexterm>
173<funcsynopsis id="XkbKeyHasActions">
174  <funcprototype>
175    <funcdef>Bool <function>XkbKeyHasActions</function></funcdef>
176<!-- (
177<parameter>xkb, keycode</parameter>
178)                              /* macro */ -->
179
180    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
181    <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
182  </funcprototype>
183</funcsynopsis>
184<variablelist>
185  <varlistentry>
186    <term>
187      <parameter>xkb</parameter>
188    </term>
189    <listitem>
190      <para>
191        Xkb description of interest
192      </para>
193    </listitem>
194  </varlistentry>
195  <varlistentry>
196    <term>
197      <parameter>keycode</parameter>
198    </term>
199    <listitem>
200      <para>
201        keycode of interest
202      </para>
203    </listitem>
204  </varlistentry>
205</variablelist>
206
207<para>
208<function>XkbKeyHasActions</function>
209returns
210<symbol>True</symbol>
211if the key corresponding to
212<parameter>keycode</parameter>
213has any actions associated with it; otherwise, it returns
214<symbol>False</symbol>.
215</para>
216
217
218<indexterm significance="preferred" zone="XkbKeyNumActions"><primary><function>XkbKeyNumActions</function></primary></indexterm>
219<funcsynopsis id="XkbKeyNumActions">
220  <funcprototype>
221    <funcdef>int <function>XkbKeyNumActions</function></funcdef>
222<!-- (
223<parameter>xkb, keycode</parameter>
224)                              /* macro */ -->
225
226    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
227    <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
228  </funcprototype>
229</funcsynopsis>
230<variablelist>
231  <varlistentry>
232    <term>
233      <parameter>xkb</parameter>
234    </term>
235    <listitem>
236      <para>
237        Xkb description of interest
238      </para>
239    </listitem>
240  </varlistentry>
241  <varlistentry>
242    <term>
243      <parameter>keycode</parameter>
244    </term>
245    <listitem>
246      <para>
247        keycode of interest
248      </para>
249    </listitem>
250  </varlistentry>
251</variablelist>
252
253<para>
254<function>XkbKeyNumActions</function>
255computes the number of actions associated with the key corresponding to
256<parameter>keycode</parameter>.
257This should be the same value as the result of
258<function>XkbKeyNumSyms</function>
259(see <link linkend="Key_Width">section 15.3.3</link>).
260</para>
261
262
263<indexterm significance="preferred" zone="XkbKeyActionsPtr"><primary><function>XkbKeyActionsPtr</function></primary></indexterm>
264<funcsynopsis id="XkbKeyActionsPtr">
265  <funcprototype>
266    <funcdef>XkbKeyActionPtr <function>XkbKeyActionsPtr</function></funcdef>
267<!-- (
268<parameter>xkb, keycode</parameter>
269)                              /* macro */ -->
270
271    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
272    <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
273  </funcprototype>
274</funcsynopsis>
275<variablelist>
276  <varlistentry>
277    <term>
278      <parameter>xkb</parameter>
279    </term>
280    <listitem>
281      <para>
282        Xkb description of interest
283      </para>
284    </listitem>
285  </varlistentry>
286  <varlistentry>
287    <term>
288      <parameter>keycode</parameter>
289    </term>
290    <listitem>
291      <para>
292        keycode of interest
293      </para>
294    </listitem>
295  </varlistentry>
296</variablelist>
297
298<para>
299<function>XkbKeyActionsPtr</function>
300returns a pointer to the two-dimensional array of key actions associated with
301the key corresponding to
302<parameter>keycode</parameter>.
303Use
304<function>XkbKeyActionsPtr</function>
305only if the key actually has some actions associated with it, that is,
306<function>XkbKeyNumActions</function>
307(xkb, keycode) returns something greater than zero.
308</para>
309
310
311<indexterm significance="preferred" zone="XkbKeyAction"><primary><function>XkbKeyAction</function></primary></indexterm>
312<funcsynopsis id="XkbKeyAction">
313  <funcprototype>
314    <funcdef>XkbAction <function>XkbKeyAction</function></funcdef>
315<!-- (
316<parameter>xkb, keycode, idx</parameter>
317)                              /* macro */ -->
318
319    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
320    <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
321    <paramdef>int <parameter>idx</parameter></paramdef>
322  </funcprototype>
323</funcsynopsis>
324<variablelist>
325  <varlistentry>
326    <term>
327      <parameter>xkb</parameter>
328    </term>
329    <listitem>
330      <para>
331        Xkb description of interest
332      </para>
333    </listitem>
334  </varlistentry>
335  <varlistentry>
336    <term>
337      <parameter>keycode</parameter>
338    </term>
339    <listitem>
340      <para>
341        keycode of interest
342      </para>
343    </listitem>
344  </varlistentry>
345  <varlistentry>
346    <term>
347      <parameter>idx</parameter>
348    </term>
349    <listitem>
350      <para>
351        index for group and shift level
352      </para>
353    </listitem>
354  </varlistentry>
355</variablelist>
356
357<para>
358<function>XkbKeyAction</function>
359returns the key action indexed by
360<parameter>idx</parameter>
361in the two-dimensional array of key actions associated with the key
362corresponding to
363<parameter>keycode</parameter>.
364<parameter>idx</parameter>
365may be computed from the group and shift level of interest as follows:
366</para>
367
368<literallayout>
369     idx = group_index * key_width + shift_level
370</literallayout>
371
372<indexterm significance="preferred" zone="XkbKeyActionEntry"><primary><function>XkbKeyActionEntry</function></primary></indexterm>
373<funcsynopsis id="XkbKeyActionEntry">
374  <funcprototype>
375    <funcdef>XkbAction <function>XkbKeyActionEntry</function></funcdef>
376<!-- (
377<parameter>xkb, keycode, shift, grp</parameter>
378)                              /* macro */ -->
379
380    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
381    <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
382    <paramdef>int <parameter>shift</parameter></paramdef>
383    <paramdef>int <parameter>grp</parameter></paramdef>
384  </funcprototype>
385</funcsynopsis>
386<variablelist>
387  <varlistentry>
388    <term>
389      <parameter>xkb</parameter>
390    </term>
391    <listitem>
392      <para>
393        Xkb description of interest
394      </para>
395    </listitem>
396  </varlistentry>
397  <varlistentry>
398    <term>
399      <parameter>keycode</parameter>
400    </term>
401    <listitem>
402      <para>
403        keycode of interest
404      </para>
405    </listitem>
406  </varlistentry>
407  <varlistentry>
408    <term>
409      <parameter>shift</parameter>
410    </term>
411    <listitem>
412      <para>
413        shift level within group
414      </para>
415    </listitem>
416  </varlistentry>
417  <varlistentry>
418    <term>
419      <parameter>grp</parameter>
420    </term>
421    <listitem>
422      <para>
423        group index for group of interest
424      </para>
425    </listitem>
426  </varlistentry>
427</variablelist>
428
429<para>
430<function>XkbKeyActionEntry</function>
431returns the key action corresponding to group
432<parameter>grp</parameter>
433and shift level
434<parameter>shift</parameter>
435from the two-dimensional table of key actions associated with the key
436corresponding to
437<parameter>keycode</parameter>.
438</para>
439
440
441<sect2 id='The_XkbAction_Structure'>
442<title>The XkbAction Structure</title>
443<indexterm significance="preferred" zone="The_XkbAction_Structure">
444<primary><structname>XkbAction</structname></primary></indexterm>
445
446<para>
447The description for an action is held in an
448<structname>XkbAction</structname>
449structure, which is a union of all possible Xkb action types:
450
451<programlisting>
452typedef union _XkbAction {
453    XkbAnyAction              any;
454    XkbModAction              mods;
455    XkbGroupAction            group;
456    XkbISOAction              iso;
457    XkbPtrAction              ptr;
458    XkbPtrBtnAction           btn;
459    XkbPtrDfltAction          dflt;
460    XkbSwitchScreenAction     screen;
461    XkbCtrlsAction            ctrls;
462    XkbMessageAction          msg;
463    XkbRedirectKeyAction      redirect;
464    XkbDeviceBtnAction        devbtn;
465    XkbDeviceValuatorAction   devval;
466    unsigned char             type;
467} <structname>XkbAction</structname>;
468</programlisting></para>
469
470<para>
471The
472<structfield>type</structfield>
473field is provided for convenience and is the same as the type field in the
474individual structures. The following sections describe the individual
475structures for each action in detail.
476</para>
477
478
479</sect2>
480<sect2 id='The_XkbAnyAction_Structure'>
481<title>The XkbAnyAction Structure</title>
482<indexterm significance="preferred" zone="The_XkbAnyAction_Structure">
483<primary><structname>XkbAnyAction</structname></primary></indexterm>
484
485<para>
486The
487<structname>XkbAnyAction</structname>
488structure is a convenience structure that refers to any of the actions:
489
490<programlisting>
491#define      XkbAnyActionDataSize       7
492
493typedef struct _XkbAnyAction {
494    unsigned char    type;            /* type of action; determines interpretation for data */
495    unsigned char    data[XkbAnyActionDataSize];
496} <structname>XkbAnyAction</structname>;
497</programlisting></para>
498
499<para>
500The
501<structfield>data</structfield>
502field represents a structure for an action, and its interpretation depends on
503the
504<structfield>type</structfield>
505field. The valid values for the
506<structfield>type</structfield>
507field, and the data structures associated with them are shown in
508<link linkend="table16.1">Table 16.1</link>:
509</para>
510
511<table id='table16.1' frame='topbot'>
512<title>Action Types</title>
513<?dbfo keep-together="always" ?>
514<tgroup cols='4' align='left' colsep='0' rowsep='0'>
515<colspec colname='c1' colwidth='1.8*'/>
516<colspec colname='c2' colwidth='2.0*'/>
517<colspec colname='c3' colwidth='1.5*'/>
518<colspec colname='c4' colwidth='1.0*'/>
519<thead>
520<row rowsep='1'>
521  <entry>Type</entry>
522  <entry>Structure for Data</entry>
523  <entry>XkbAction Union Member</entry>
524  <entry>Section</entry>
525</row>
526</thead>
527<tbody>
528  <row>
529    <entry><symbol>XkbSA_NoAction</symbol></entry>
530    <entry>
531<symbol>XkbSA_NoAction</symbol>
532means the server does not perform an action for the key; this action does not
533have an associated data structure.
534    </entry>
535    <entry>any</entry>
536    <entry></entry>
537  </row>
538  <row>
539    <entry>
540<para><symbol>XkbSA_SetMods</symbol></para>
541<para><symbol>XkbSA_LatchMods</symbol></para>
542<para><symbol>XkbSA_LockMods</symbol></para>
543    </entry>
544    <entry><para><structname>XkbModAction</structname></para></entry>
545    <entry>mods</entry>
546    <entry><link linkend="Actions_for_Changing_Modifiers_State">16.1.3</link></entry>
547  </row>
548  <row>
549    <entry>
550<para><symbol>XkbSA_SetGroup</symbol></para>
551<para><symbol>XkbSA_LatchGroup</symbol></para>
552<para><symbol>XkbSA_LockGroup</symbol></para>
553    </entry>
554    <entry><structname>XkbGroupAction</structname></entry>
555    <entry>group</entry>
556    <entry><link linkend="Actions_for_Changing_Group_State">16.1.4</link></entry>
557  </row>
558  <row>
559    <entry><symbol>XkbSA_MovePtr</symbol></entry>
560    <entry><structname>XkbPtrAction</structname></entry>
561    <entry>ptr</entry>
562    <entry><link linkend="Actions_for_Moving_the_Pointer">16.1.5</link></entry>
563  </row>
564  <row>
565    <entry>
566<para><symbol>XkbSA_PtrBtn</symbol></para>
567<para><symbol>XkbSA_LockPtrBtn</symbol></para>
568    </entry>
569    <entry><structname>XkbPtrBtnAction</structname></entry><entry>btn</entry>
570    <entry><link linkend="Actions_for_Simulating_Pointer_Button_Press_and_Release">16.1.6</link></entry>
571  </row>
572  <row>
573    <entry><symbol>XkbSA_SetPtrDflt</symbol></entry>
574    <entry><structname>XkbPtrDfltAction</structname></entry>
575    <entry>dflt</entry>
576    <entry><link linkend="Actions_for_Changing_the_Pointer_Button_Simulated">16.1.7</link></entry>
577  </row>
578  <row>
579    <entry><symbol>XkbSA_ISOLock</symbol></entry>
580    <entry><structname>XkbISOAction</structname></entry>
581    <entry>iso</entry>
582    <entry><link linkend="Actions_for_Locking_Modifiers_and_Group">16.1.8</link></entry>
583  </row>
584  <row>
585    <entry><symbol>XkbSA_SwitchScreen</symbol></entry>
586    <entry><structname>XkbSwitchScreenAction</structname></entry>
587    <entry>screen</entry>
588    <entry><link linkend="Actions_for_Changing_the_Active_Screen">16.1.9</link></entry>
589  </row>
590  <row>
591    <entry>
592<para><symbol>XkbSA_SetControls</symbol></para>
593<para><symbol>XkbSA_LockControls</symbol></para>
594    </entry>
595    <entry><structname>XkbCtrlsAction</structname></entry>
596    <entry>ctrls</entry>
597    <entry><link linkend="Actions_for_Changing_Boolean_Controls_State">16.1.10</link></entry>
598  </row>
599  <row>
600    <entry><symbol>XkbSA_ActionMessage</symbol></entry>
601    <entry><structname>XkbMessageAction</structname></entry>
602    <entry>msg</entry>
603    <entry><link linkend="Actions_for_Generating_Messages">16.1.11</link></entry>
604  </row>
605  <row>
606    <entry><symbol>XkbSA_RedirectKey</symbol></entry>
607    <entry><structname>XkbRedirectKeyAction</structname></entry>
608    <entry>redirect</entry>
609    <entry><link linkend="Actions_for_Generating_a_Different_Keycode">16.1.12</link></entry>
610  </row>
611  <row>
612    <entry>
613<para><symbol>XkbSA_DeviceBtn</symbol></para>
614<para><symbol>XkbSA_LockDeviceBtn</symbol></para>
615    </entry>
616    <entry><structname>XkbDeviceBtnAction</structname></entry>
617    <entry>devbtn</entry>
618    <entry><link linkend="Actions_for_Generating_DeviceButtonPress_and_DeviceButtonRelease">16.1.13</link></entry>
619  </row>
620  <row>
621    <entry><symbol>XkbSA_DeviceValuator</symbol></entry>
622    <entry><structname>XkbDeviceValuatorAction</structname></entry>
623    <entry>devval</entry>
624    <entry><link linkend="Actions_for_Simulating_Events_from_Device_Valuators">16.1.14</link></entry>
625  </row>
626</tbody>
627</tgroup>
628</table>
629
630</sect2>
631<sect2 id='Actions_for_Changing_Modifiers_State'>
632<title>Actions for Changing Modifiers’ State</title>
633<indexterm significance="preferred" zone="Actions_for_Changing_Modifiers_State">
634<primary><structname>XkbModAction</structname></primary></indexterm>
635
636<para>
637Actions associated with the
638<structname>XkbModAction</structname>
639structure change the state of the modifiers when keys are pressed and released
640(see <xref linkend="Virtual_Modifiers" /> for a discussion of modifiers):
641
642<programlisting>
643typedef struct _XkbModAction {
644    unsigned char     type;         /* <symbol>XkbSA_{Set|Latch|Lock}Mods</symbol> */
645    unsigned char     flags;        /* with <structfield>type</structfield>, controls the effect
646                                       on modifiers */
647    unsigned char     mask;         /* same as <structfield>mask</structfield> field of
648                                       a modifier description */
649    unsigned char     real_mods;    /* same as <structfield>real_mods</structfield> field of
650                                       a modifier description */
651    unsigned char     vmods1;       /* derived from <structfield>vmods</structfield> field of
652                                       a modifier description */
653    unsigned char     vmods2;       /* derived from <structfield>vmods</structfield> field of
654                                       a modifier description */
655} <structname>XkbModAction</structname>;
656</programlisting></para>
657
658<para>
659In the following description, the term
660<firstterm>action modifiers</firstterm>
661<indexterm significance="preferred" zone="Actions_for_Changing_Modifiers_State">
662<primary>action modifiers</primary></indexterm>
663<indexterm significance="preferred" zone="Actions_for_Changing_Modifiers_State">
664<primary>modifiers</primary><secondary>action</secondary></indexterm>
665means the real modifier bits associated with this action. Depending on the
666value of
667<structfield>flags</structfield>
668(see <link linkend="table16.3">Table 16.3</link>),
669these are designated either in the
670<structfield>mask</structfield>
671field of the
672<structname>XkbModAction</structname>
673structure itself or the real modifiers bound to the key for which the action
674is being used. In the latter case, this is the client
675<structfield>map</structfield>-&gt;<structfield>modmap</structfield>
676[
677<parameter>keycode</parameter>
678] field.
679</para>
680
681
682<para>
683The
684<structfield>type</structfield>
685field can have any of the values shown in
686<link linkend="table16.2">Table 16.2</link>.
687</para>
688
689<table id='table16.2' frame='topbot'>
690<title>Modifier Action Types</title>
691<?dbfo keep-together="always" ?>
692<tgroup cols='2' align='left' colsep='0' rowsep='0'>
693<colspec colname='c1' colwidth='1.0*'/>
694<colspec colname='c2' colwidth='2.0*'/>
695<thead>
696<row rowsep='1'>
697  <entry>Type</entry>
698  <entry>Effect</entry>
699</row>
700</thead>
701<tbody>
702  <row>
703    <entry><symbol>XkbSA_SetMods</symbol></entry>
704    <entry>
705<itemizedlist>
706  <listitem>
707    <para>
708A key press adds any action modifiers to the keyboard’s base modifiers.
709    </para>
710  </listitem>
711  <listitem>
712    <para>
713A key release clears any action modifiers in the keyboard’s base modifiers,
714provided no other key affecting the same modifiers is logically down.
715    </para>
716  </listitem>
717  <listitem>
718    <para>
719If no other keys are physically depressed when this key is released, and
720<symbol>XkbSA_ClearLocks</symbol>
721is set in the
722<structfield>flags</structfield>
723field, the key release unlocks any action modifiers.
724    </para>
725  </listitem>
726</itemizedlist>
727    </entry>
728  </row>
729  <row>
730    <entry><symbol>XkbSA_LatchMods</symbol></entry>
731    <entry>
732<itemizedlist>
733  <listitem>
734    <para>
735Key press and key release events have the same effect as for
736<symbol>XkbSA_SetMods</symbol>;
737if no keys are physically depressed when this key is released, key release
738events have the following additional effects:
739    </para>
740  </listitem>
741  <listitem>
742    <para>
743Modifiers unlocked due to
744<symbol>XkbSA_ClearLocks</symbol>
745have no further effect.
746    </para>
747  </listitem>
748  <listitem>
749    <para>
750If
751<symbol>XkbSA_LatchToLock</symbol>
752is set in the
753<structfield>flags</structfield>
754field, a key release locks and then unlatches any remaining action modifiers
755that are already latched.
756    </para>
757  </listitem>
758  <listitem>
759    <para>
760A key release latches any action modifiers not used by the
761<symbol>XkbSA_ClearLocks</symbol>
762and
763<symbol>XkbSA_LatchToLock</symbol>
764flags.
765    </para>
766  </listitem>
767  </itemizedlist>
768    </entry>
769  </row>
770  <row>
771    <entry><symbol>XkbSA_LockMods</symbol></entry>
772    <entry>
773<itemizedlist>
774  <listitem>
775    <para>
776A key press sets the base state of any action modifiers. If
777<symbol>XkbSA_LockNoLock</symbol>
778is set in the
779<structfield>flags</structfield>
780field, a key press also sets the locked state of any action modifiers.
781    </para>
782  </listitem>
783  <listitem>
784    <para>
785A key release clears any action modifiers in the keyboard’s base modifiers,
786provided no other key that affects the same modifiers is down. If
787<symbol>XkbSA_LockNoUnlock</symbol>
788is not set in the
789<structfield>flags</structfield>
790field, and any of the action modifiers were locked before the corresponding
791key press occurred, a key release unlocks them.
792    </para>
793  </listitem>
794</itemizedlist>
795    </entry>
796  </row>
797</tbody>
798</tgroup>
799</table>
800
801<para>
802The
803<structfield>flags</structfield>
804field is composed of the bitwise inclusive OR of the masks shown in
805<link linkend="table16.3">Table 16.3</link>.
806A general meaning is given in the table, but the exact meaning depends on
807the action <structfield>type</structfield>.
808</para>
809
810<table id='table16.3' frame='topbot'>
811<title>Modifier Action Flags</title>
812<?dbfo keep-together="always" ?>
813<tgroup cols='2' align='left' colsep='0' rowsep='0'>
814<colspec colname='c1' colwidth='1.0*'/>
815<colspec colname='c2' colwidth='2.0*'/>
816<thead>
817<row rowsep='1'>
818  <entry>Flag</entry>
819  <entry>Meaning</entry>
820</row>
821</thead>
822<tbody>
823  <row>
824    <entry><symbol>XkbSA_UseModMapMods</symbol></entry>
825    <entry>
826If set, the action modifiers are determined by the modifiers bound by the
827modifier mapping of the key. Otherwise, the action modifiers are set to the
828modifiers specified by the
829<structfield>mask</structfield>,
830<structfield>real_mods</structfield>,
831<structfield>vmods1</structfield>,
832and
833<structfield>vmods2</structfield>
834fields.
835    </entry>
836  </row>
837  <row>
838    <entry><symbol>XkbSA_ClearLocks</symbol></entry>
839    <entry>
840If set and no keys are physically depressed when this key transition
841occurs, the server unlocks any action modifiers.
842   </entry>
843  </row>
844  <row>
845    <entry><symbol>XkbSA_LatchToLock</symbol></entry>
846    <entry>
847If set, and the action type is
848<symbol>XkbSA_LatchMods</symbol>,
849the server locks the action modifiers if they are already latched.
850    </entry>
851  </row>
852  <row>
853    <entry><symbol>XkbSA_LockNoLock</symbol></entry>
854    <entry>
855If set, and the action type is
856<symbol>XkbSA_LockMods</symbol>,
857the server only unlocks the action modifiers.
858    </entry>
859  </row>
860  <row>
861    <entry><symbol>XkbSA_LockNoUnlock</symbol></entry>
862    <entry>
863If set, and the action is
864<symbol>XkbSA_LockMods</symbol>,
865the server only locks the action modifiers.
866    </entry>
867  </row>
868</tbody>
869</tgroup>
870</table>
871
872<para>
873If
874<symbol>XkbSA_UseModMapMods</symbol>
875is not set in the
876<structfield>flags</structfield>
877field, the
878<structfield>mask</structfield>,
879<structfield>real_mods</structfield>,
880<structfield>vmods1</structfield>,
881and
882<structfield>vmods2</structfield>
883fields are used to determine the action modifiers. Otherwise they are ignored
884and the modifiers bound to the key (client
885<structfield>map</structfield>-&gt;<structfield>modmap</structfield>
886[
887<parameter>keycode</parameter>
888]) are used instead.
889</para>
890
891
892<para>
893The
894<structfield>mask</structfield>,
895<structfield>real_mods</structfield>,
896<structfield>vmods1</structfield>,
897and
898<structfield>vmods2</structfield>
899fields represent the components of an Xkb modifier description
900(see <link linkend="Modifier_Definitions">section 7.2</link>). While the
901<structfield>mask</structfield>
902and
903<structfield>real_mods</structfield>
904fields correspond directly to the
905<structfield>mask</structfield>
906and
907<structfield>real_mods</structfield>
908fields of an Xkb modifier description, the
909<structfield>vmods1</structfield>
910and
911<structfield>vmods2</structfield>
912fields are combined to correspond to the
913<structfield>vmods</structfield>
914field of an Xkb modifier description. Xkb provides the following macros, to
915convert between the two formats:
916</para>
917
918<indexterm significance="preferred" zone="XkbModActionVMods"><primary><function>XkbModActionVMods</function></primary></indexterm>
919<funcsynopsis id="XkbModActionVMods">
920  <funcprototype>
921    <funcdef>unsigned short <function>XkbModActionVMods</function></funcdef>
922<!-- (
923<parameter>act</parameter>
924)                              /* macro */ -->
925
926    <paramdef>XkbAction <parameter>act</parameter></paramdef>
927  </funcprototype>
928</funcsynopsis>
929<variablelist>
930  <varlistentry>
931    <term>
932      <parameter>act</parameter>
933    </term>
934    <listitem>
935      <para>
936        action from which to extract virtual mods
937      </para>
938    </listitem>
939  </varlistentry>
940</variablelist>
941
942<para>
943<function>XkbModActionVMods</function>
944returns the
945<structfield>vmods1</structfield>
946and
947<structfield>vmods2</structfield>
948fields of
949<parameter>act</parameter>
950converted to the
951<structfield>vmods</structfield>
952format of an Xkb modifier description.
953</para>
954
955
956<indexterm significance="preferred" zone="XkbSetModActionVMods"><primary><function>XkbSetModActionVMods</function></primary></indexterm>
957<funcsynopsis id="XkbSetModActionVMods">
958  <funcprototype>
959    <funcdef>void <function>XkbSetModActionVMods</function></funcdef>
960<!-- (
961<parameter>act, vmods</parameter>
962)                              /* macro */ -->
963
964    <paramdef>XkbAction <parameter>act</parameter></paramdef>
965    <paramdef>unsigned short <parameter>vmods</parameter></paramdef>
966  </funcprototype>
967</funcsynopsis>
968<variablelist>
969  <varlistentry>
970    <term>
971      <parameter>act</parameter>
972    </term>
973    <listitem>
974      <para>
975        action in which to set vmods
976      </para>
977    </listitem>
978  </varlistentry>
979  <varlistentry>
980    <term>
981      <parameter>vmods</parameter>
982    </term>
983    <listitem>
984      <para>
985        virtual mods to set
986      </para>
987    </listitem>
988  </varlistentry>
989</variablelist>
990
991<para>
992<function>XkbSetModActionVMods</function>
993sets the
994<structfield>vmods1</structfield>
995and
996<structfield>vmods2</structfield>
997fields of
998<parameter>act</parameter>
999using the
1000<parameter>vmods</parameter>
1001format of an Xkb modifier description.
1002</para>
1003
1004<note><para>Despite the fact that the first parameter of these two macros is of
1005type XkbAction, these macros may be used only with Actions of type
1006<structname>XkbModAction</structname>
1007and
1008<structname>XkbISOAction</structname>.
1009</para></note>
1010
1011
1012</sect2>
1013<sect2 id='Actions_for_Changing_Group_State'>
1014<title>Actions for Changing Group State</title>
1015<indexterm significance="preferred" zone="Actions_for_Changing_Group_State">
1016<primary><structname>XkbGroupAction</structname></primary></indexterm>
1017
1018<para>
1019Actions associated with the
1020<structname>XkbGroupAction</structname>
1021structure change the current group state when keys are pressed and released
1022(see <xref linkend="Keyboard_State" /> for a description of groups and keyboard state):
1023
1024<programlisting>
1025typedef struct _XkbGroupAction {
1026    unsigned char   type;       /* <symbol>XkbSA_{Set|Latch|Lock}Group</symbol> */
1027    unsigned char   flags;      /* with <structfield>type</structfield> , controls the effect on groups */
1028    char            group_XXX;  /* represents a group index or delta */
1029} <structname>XkbGroupAction</structname>;
1030</programlisting></para>
1031
1032<para>
1033The
1034<structfield>type</structfield>
1035field can have any of the following values:
1036</para>
1037
1038<table id='table16.4' frame='topbot'>
1039<title>Group Action Types</title>
1040<?dbfo keep-together="always" ?>
1041<tgroup cols='2' align='left' colsep='0' rowsep='0'>
1042<colspec colname='c1' colwidth='1.0*'/>
1043<colspec colname='c2' colwidth='2.0*'/>
1044<thead>
1045<row rowsep='1'>
1046  <entry>Type</entry>
1047  <entry>Effect</entry>
1048</row>
1049</thead>
1050<tbody>
1051  <row>
1052    <entry><symbol>XkbSA_SetGroup</symbol></entry>
1053    <entry>
1054<itemizedlist>
1055  <listitem>
1056    <para>
1057If the
1058<symbol>XkbSA_GroupAbsolute</symbol>
1059bit is set in the
1060<structfield>flags</structfield>
1061field, key press events change the base keyboard group to the group specified
1062by the
1063<structfield>group_XXX</structfield>
1064field. Otherwise, key press events change the base keyboard group by adding
1065the
1066<structfield>group_XXX</structfield>
1067field to the base keyboard group. In either case, the resulting effective
1068keyboard group is brought back into range depending on the value of the
1069<structfield>groups_wrap</structfield>
1070field of the controls structure (see <link linkend="The_GroupsWrap_Control">section 10.7.1</link>).
1071    </para>
1072  </listitem>
1073  <listitem>
1074    <para>
1075If a key with an
1076<symbol>XkbSA_ISOLock</symbol>
1077action (see <link linkend="Actions_for_Locking_Modifiers_and_Group">section 16.1.8</link>) is pressed while this key is down, the key release
1078of this key has no effect. Otherwise, the key release cancels the effects of
1079the key press.
1080    </para>
1081  </listitem>
1082  <listitem>
1083    <para>
1084If the
1085<symbol>XkbSA_ClearLocks</symbol>
1086bit is set in the flags field, and no keys are physically depressed when this
1087key is released, the key release also sets the locked keyboard group to
1088<emphasis>Group1</emphasis>.
1089</para>
1090  </listitem>
1091</itemizedlist>
1092    </entry>
1093  </row>
1094  <row>
1095    <entry><symbol>XkbSA_LatchGroup</symbol></entry>
1096    <entry>
1097<itemizedlist>
1098  <listitem>
1099    <para>
1100Key press and key release events have the same effect as for
1101<symbol>XkbSA_SetGroup</symbol>;
1102if no keys are physically depressed when this key is released, key release
1103events have the following additional effects.
1104    </para>
1105  </listitem>
1106  <listitem>
1107    <para>
1108If the
1109<symbol>XkbSA_LatchToLock</symbol>
1110bit is set in the
1111<structfield>flags</structfield>
1112field and the latched keyboard group index is nonzero, the key release adds
1113the delta applied by the corresponding key press to the locked keyboard group
1114and subtracts it from the latched keyboard group. The locked and effective
1115keyboard group are brought back into range according to the value of the
1116<structfield>groups_wrap</structfield>
1117field of the controls structure.
1118    </para>
1119  </listitem>
1120  <listitem>
1121    <para>
1122Otherwise, the key press adds the key press delta to the latched keyboard group.
1123    </para>
1124  </listitem>
1125</itemizedlist>
1126    </entry>
1127  </row>
1128  <row>
1129    <entry><symbol>XkbSA_LockGroup</symbol></entry>
1130    <entry>
1131<itemizedlist>
1132  <listitem>
1133    <para>
1134If the
1135<symbol>XkbSA_GroupAbsolute</symbol>
1136is set in the
1137<structfield>flags</structfield>
1138field, key press events set the locked keyboard group to the group specified
1139by the
1140<structfield>group_XXX</structfield>
1141field. Otherwise, key press events add the group specified by the
1142<structfield>group_XXX</structfield>
1143field to the locked keyboard group. In either case, the resulting locked and
1144effective keyboard groups are brought back into range depending on the value of
1145the
1146<structfield>groups_wrap</structfield>
1147field of the controls structure.
1148    </para>
1149  </listitem>
1150  <listitem>
1151    <para>
1152A key release has no effect.
1153    </para>
1154  </listitem>
1155</itemizedlist>
1156    </entry>
1157  </row>
1158</tbody>
1159</tgroup>
1160</table>
1161
1162<para>
1163The
1164<structfield>flags</structfield>
1165field is composed of the bitwise inclusive OR of the masks shown in
1166<link linkend="table16.5">Table 16.5</link>.
1167A general meaning is given in the table, but the exact meaning depends on
1168the action
1169<structfield>type</structfield>.
1170</para>
1171
1172<table id='table16.5' frame='topbot'>
1173<title>Group Action Flags</title>
1174<?dbfo keep-together="always" ?>
1175<tgroup cols='2' align='left' colsep='0' rowsep='0'>
1176<colspec colname='c1' colwidth='1.0*'/>
1177<colspec colname='c2' colwidth='2.0*'/>
1178<thead>
1179<row rowsep='1'>
1180  <entry>Flag</entry>
1181  <entry>Meaning</entry>
1182</row>
1183</thead>
1184<tbody>
1185  <row>
1186    <entry><symbol>XkbSA_ClearLocks</symbol></entry>
1187    <entry>
1188If set and no keys are physically depressed when this key transition occurs,
1189the server sets the locked keyboard group to
1190<emphasis>Group1</emphasis>
1191on a key release.
1192    </entry>
1193  </row>
1194  <row>
1195    <entry><symbol>XkbSA_LatchToLock</symbol></entry>
1196    <entry>
1197If set, and the action type is
1198<symbol>XkbSA_LatchGroup</symbol>,
1199the server locks the action group if it is already latched.
1200    </entry>
1201  </row>
1202  <row>
1203    <entry><symbol>XkbSA_GroupAbsolute</symbol></entry>
1204    <entry>
1205If set, the
1206<structfield>group_XXX</structfield>
1207field represents an absolute group number. Otherwise, it represents a group
1208delta to be added to the current group to determine the new group number.
1209    </entry>
1210  </row>
1211</tbody>
1212</tgroup>
1213</table>
1214
1215<para>
1216The
1217<structfield>group_XXX</structfield>
1218field represents a signed character. Xkb provides the following macros to
1219convert between a signed integer value and a signed character:
1220</para>
1221
1222<indexterm significance="preferred" zone="XkbSAGroup"><primary><function>XkbSAGroup</function></primary></indexterm>
1223<funcsynopsis id="XkbSAGroup">
1224  <funcprototype>
1225    <funcdef>int <function>XkbSAGroup</function></funcdef>
1226<!-- (
1227<parameter>act</parameter>
1228)                              /* macro */ -->
1229
1230    <paramdef>XkbAction <parameter>act</parameter></paramdef>
1231  </funcprototype>
1232</funcsynopsis>
1233<variablelist>
1234  <varlistentry>
1235    <term>
1236      <parameter>act</parameter>
1237    </term>
1238    <listitem>
1239      <para>
1240        action from which to extract group
1241      </para>
1242    </listitem>
1243  </varlistentry>
1244</variablelist>
1245
1246<para>
1247<function>XkbSAGroup</function>
1248returns the
1249<structfield>group_XXX</structfield>
1250field of
1251<parameter>act</parameter>
1252converted to a signed int.
1253</para>
1254
1255
1256<indexterm significance="preferred" zone="XkbSASetGroup"><primary><function>XkbSASetGroup</function></primary></indexterm>
1257<funcsynopsis id="XkbSASetGroup">
1258  <funcprototype>
1259    <funcdef>void <function>XkbSASetGroup</function></funcdef>
1260<!-- (
1261<parameter>act, grp</parameter>
1262)                              /* macro */ -->
1263
1264    <paramdef>XkbAction <parameter>act</parameter></paramdef>
1265    <paramdef>int <parameter>grp</parameter></paramdef>
1266  </funcprototype>
1267</funcsynopsis>
1268<variablelist>
1269  <varlistentry>
1270    <term>
1271      <parameter>act</parameter>
1272    </term>
1273    <listitem>
1274      <para>
1275        action from which to set group
1276      </para>
1277    </listitem>
1278  </varlistentry>
1279  <varlistentry>
1280    <term>
1281      <parameter>grp</parameter>
1282    </term>
1283    <listitem>
1284      <para>
1285        group index to set in <structfield>group_XXX</structfield>
1286      </para>
1287    </listitem>
1288  </varlistentry>
1289</variablelist>
1290
1291<para>
1292<function>XkbSASetGroup</function>
1293sets the
1294<structfield>group_XXX</structfield>
1295field of
1296<parameter>act</parameter>
1297from the group index
1298<parameter>grp</parameter>.
1299</para>
1300
1301<note><para>Despite the fact that the first parameter of these two macros is of
1302type XkbAction, these macros may only be used with Actions of type
1303<structname>XkbGroupAction</structname>
1304and
1305<structname>XkbISOAction</structname>.
1306</para></note>
1307
1308
1309</sect2>
1310<sect2 id='Actions_for_Moving_the_Pointer'>
1311<title>Actions for Moving the Pointer</title>
1312<indexterm significance="preferred" zone="Actions_for_Moving_the_Pointer">
1313<primary><structname>XkbPtrAction</structname></primary></indexterm>
1314
1315<para>
1316Actions associated with the
1317<structname>XkbPtrAction</structname>
1318structure move the pointer when keys are pressed and released:
1319
1320<programlisting>
1321typedef struct _XkbPtrAction {
1322    unsigned char      type;      /* <symbol>XkbSA_MovePtr</symbol> */
1323    unsigned char      flags;     /* determines type of pointer motion */
1324    unsigned char      high_XXX;  /* x coordinate, high bits */
1325    unsigned char      low_XXX;   /* y coordinate, low bits */
1326    unsigned char      high_YYY;  /* x coordinate, high bits */
1327    unsigned char      low_YYY;   /* y coordinate, low bits */
1328} <structname>XkbPtrAction</structname>;
1329</programlisting></para>
1330
1331<para>
1332If the
1333<emphasis>MouseKeys</emphasis>
1334control is not enabled (see <link linkend="The_MouseKeys_Control">section 10.5.1</link>),
1335<symbol>KeyPress</symbol>
1336and
1337<symbol>KeyRelease</symbol>
1338events are treated as though the action is
1339<symbol>XkbSA_NoAction</symbol>.
1340</para>
1341
1342<para>
1343If the
1344<emphasis>MouseKeys</emphasis>
1345control is enabled, a server action of type
1346<symbol>XkbSA_MovePtr</symbol>
1347instructs the server to generate core pointer
1348<symbol>MotionNotify</symbol>
1349events rather than the usual
1350<symbol>KeyPress</symbol>
1351event, and the corresponding
1352<symbol>KeyRelease</symbol>
1353event disables any mouse keys timers that were created as a result of handling
1354the
1355<symbol>XkbSA_MovePtr</symbol>
1356action.
1357</para>
1358
1359
1360<para>
1361The
1362<structfield>type</structfield>
1363field of the
1364<structname>XkbPtrAction</structname>
1365structure is always
1366<symbol>XkbSA_MovePtr</symbol>.
1367</para>
1368
1369
1370<para>
1371The
1372<structfield>flags</structfield>
1373field is a bitwise inclusive OR of the masks shown in
1374<link linkend="table16.6">Table 16.6</link>.
1375</para>
1376
1377<table id='table16.6' frame='topbot'>
1378<title>Pointer Action Types</title>
1379<?dbfo keep-together="always" ?>
1380<tgroup cols='2' align='left' colsep='0' rowsep='0'>
1381<colspec colname='c1' colwidth='1.0*'/>
1382<colspec colname='c2' colwidth='2.0*'/>
1383<thead>
1384<row rowsep='1'>
1385  <entry>Action Type</entry>
1386  <entry>Meaning</entry>
1387</row>
1388</thead>
1389<tbody>
1390  <row>
1391    <entry><symbol>XkbSA_NoAcceleration</symbol></entry>
1392    <entry>
1393If not set, and the
1394<emphasis>MouseKeysAccel</emphasis>
1395control is enabled (see <link linkend="The_MouseKeysAccel_Control">section 10.5.2</link>), the
1396<symbol>KeyPress</symbol>
1397initiates a mouse keys timer for this key; every time the timer expires, the
1398cursor moves.
1399    </entry>
1400  </row>
1401  <row>
1402    <entry><symbol>XkbSA_MoveAbsoluteX</symbol></entry>
1403    <entry>If set, the X portion of the structure specifies the new pointer X
1404coordinate. Otherwise, the X portion is added to the current pointer X
1405coordinate to determine the new pointer X coordinate.
1406    </entry>
1407  </row>
1408  <row>
1409    <entry><symbol>XkbSA_MoveAbsoluteY</symbol></entry>
1410    <entry>
1411If set, the Y portion of the structure specifies the new
1412pointer Y coordinate. Otherwise, the Y portion is added
1413to the current pointer Y coordinate to determine the new pointer Y coordinate.
1414    </entry>
1415  </row>
1416</tbody>
1417</tgroup>
1418</table>
1419
1420<para>
1421Each of the X and Y coordinates of the
1422<structname>XkbPtrAction</structname>
1423structure is composed of two signed 16-bit values, that is, the X coordinate
1424is composed of
1425<structfield>high_XXX</structfield>
1426and
1427<structfield>low_XXX</structfield>,
1428and similarly for the Y coordinate. Xkb provides the following macros, to
1429convert between a signed integer and two signed 16-bit values in
1430<structname>XkbPtrAction</structname>
1431structures:
1432</para>
1433
1434<indexterm significance="preferred" zone="XkbPtrActionX"><primary><function>XkbPtrActionX</function></primary></indexterm>
1435<funcsynopsis id="XkbPtrActionX">
1436  <funcprototype>
1437    <funcdef>int <function>XkbPtrActionX</function></funcdef>
1438<!-- (
1439<parameter>act</parameter>
1440)                              /* macro */ -->
1441
1442    <paramdef>XkbPtrAction <parameter>act</parameter></paramdef>
1443  </funcprototype>
1444</funcsynopsis>
1445<variablelist>
1446  <varlistentry>
1447    <term>
1448      <parameter>act</parameter>
1449    </term>
1450    <listitem>
1451      <para>
1452        action from which to extract X
1453      </para>
1454    </listitem>
1455  </varlistentry>
1456</variablelist>
1457
1458<para>
1459<function>XkbPtrActionX</function>
1460returns the
1461<structfield>high_XXX</structfield>
1462and
1463<structfield>low_XXX</structfield>
1464fields of
1465<parameter>act</parameter>
1466converted to a signed int.
1467</para>
1468
1469
1470<indexterm significance="preferred" zone="XkbPtrActionY"><primary><function>XkbPtrActionY</function></primary></indexterm>
1471<funcsynopsis id="XkbPtrActionY">
1472  <funcprototype>
1473    <funcdef>int <function>XkbPtrActionY</function></funcdef>
1474<!-- (
1475<parameter>act</parameter>
1476)                              /* macro */ -->
1477
1478    <paramdef>XkbPtrAction <parameter>act</parameter></paramdef>
1479  </funcprototype>
1480</funcsynopsis>
1481<variablelist>
1482  <varlistentry>
1483    <term>
1484      <parameter>act</parameter>
1485    </term>
1486    <listitem>
1487      <para>
1488        action from which to extract Y
1489      </para>
1490    </listitem>
1491  </varlistentry>
1492</variablelist>
1493
1494<para>
1495<function>XkbPtrActionY</function>
1496returns the
1497<structfield>high_YYY</structfield>
1498and
1499<structfield>low_YYY</structfield>
1500fields of
1501<parameter>act</parameter>
1502converted to a signed int.
1503</para>
1504
1505
1506<indexterm significance="preferred" zone="XkbSetPtrActionX"><primary><function>XkbSetPtrActionX</function></primary></indexterm>
1507<funcsynopsis id="XkbSetPtrActionX">
1508  <funcprototype>
1509    <funcdef>void <function>XkbSetPtrActionX</function></funcdef>
1510<!-- (
1511<parameter>act</parameter>,
1512<parameter>x</parameter>
1513)                              /* macro */ -->
1514
1515    <paramdef>XkbPtrAction <parameter>act</parameter></paramdef>
1516    <paramdef>int <parameter>x</parameter></paramdef>
1517  </funcprototype>
1518</funcsynopsis>
1519<variablelist>
1520  <varlistentry>
1521    <term>
1522      <parameter>act</parameter>
1523    </term>
1524    <listitem>
1525      <para>
1526        action in which to set X
1527      </para>
1528    </listitem>
1529  </varlistentry>
1530  <varlistentry>
1531    <term>
1532      <parameter>x</parameter>
1533    </term>
1534    <listitem>
1535      <para>
1536        new value to set
1537      </para>
1538    </listitem>
1539  </varlistentry>
1540</variablelist>
1541
1542<para>
1543<function>XkbSetPtrActionX</function>
1544sets the
1545<structfield>high_XXX</structfield>
1546and
1547<structfield>low_XXX</structfield>
1548fields of
1549<parameter>act</parameter>
1550from the signed integer value
1551<parameter>x</parameter>.
1552</para>
1553
1554
1555<indexterm significance="preferred" zone="XkbSetPtrActionY"><primary><function>XkbSetPtrActionY</function></primary></indexterm>
1556<funcsynopsis id="XkbSetPtrActionY">
1557  <funcprototype>
1558    <funcdef>void <function>XkbSetPtrActionY</function></funcdef>
1559<!-- (
1560<parameter>act, y</parameter>
1561)                              /* macro */ -->
1562
1563    <paramdef>XkbPtrAction <parameter>act</parameter></paramdef>
1564    <paramdef>int <parameter>y</parameter></paramdef>
1565  </funcprototype>
1566</funcsynopsis>
1567<variablelist>
1568  <varlistentry>
1569    <term>
1570      <parameter>act</parameter>
1571    </term>
1572    <listitem>
1573      <para>
1574        action in which to set Y
1575      </para>
1576    </listitem>
1577  </varlistentry>
1578  <varlistentry>
1579    <term>
1580      <parameter>y</parameter>
1581    </term>
1582    <listitem>
1583      <para>
1584        new value to set
1585      </para>
1586    </listitem>
1587  </varlistentry>
1588</variablelist>
1589
1590<para>
1591<function>XkbSetPtrActionX</function>
1592sets the
1593<structfield>high_YYY</structfield>
1594and
1595<structfield>low_YYY</structfield>
1596fields of
1597<parameter>act</parameter>
1598from the signed integer value
1599<parameter>y</parameter>.
1600</para>
1601
1602
1603</sect2>
1604<sect2 id='Actions_for_Simulating_Pointer_Button_Press_and_Release'>
1605<title>Actions for Simulating Pointer Button Press and Release</title>
1606<indexterm significance="preferred" zone="Actions_for_Simulating_Pointer_Button_Press_and_Release">
1607<primary><structname>XkbPtrBtnAction</structname></primary></indexterm>
1608
1609<para>
1610Actions associated with the
1611<structname>XkbPtrBtnAction</structname>
1612structure simulate the press and release of pointer buttons when keys are
1613pressed and released:
1614
1615<programlisting>
1616typedef struct _XkbPtrBtnAction {
1617    unsigned char   type;     /* <symbol>XkbSA_PtrBtn</symbol>, <symbol>XkbSA_LockPtrBtn</symbol> */
1618    unsigned char   flags;    /* with <structfield>type</structfield>, controls the effect
1619                                 on pointer buttons */
1620    unsigned char   count;    /* controls number of ButtonPress and
1621                                 ButtonRelease events */
1622    unsigned char   button;   /* pointer button to simulate */
1623} <structname>XkbPtrBtnAction</structname>;
1624</programlisting></para>
1625
1626<para>
1627If the
1628<emphasis>MouseKeys</emphasis>
1629(see <link linkend="The_MouseKeys_Control">section 10.5.1</link>) control is not enabled,
1630<symbol>KeyPress</symbol>
1631and
1632<symbol>KeyRelease</symbol>
1633events are treated as though the action is
1634<symbol>XkbSA_NoAction</symbol>.
1635</para>
1636
1637
1638<para>
1639The
1640<structfield>type</structfield>
1641field can have any one of the values shown in
1642<link linkend="table16.7">Table 16.7</link>.
1643</para>
1644
1645<table id='table16.7' frame='topbot'>
1646<title>Pointer Button Action Types</title>
1647<?dbfo keep-together="always" ?>
1648<tgroup cols='2' align='left' colsep='0' rowsep='0'>
1649<colspec colname='c1' colwidth='1.0*'/>
1650<colspec colname='c2' colwidth='2.0*'/>
1651<thead>
1652<row rowsep='1'>
1653  <entry>Type</entry>
1654  <entry>Effect</entry>
1655</row>
1656</thead>
1657<tbody>
1658  <row>
1659    <entry><symbol>XkbSA_PtrBtn</symbol></entry>
1660    <entry>
1661<itemizedlist>
1662  <listitem>
1663    <para>
1664If
1665<symbol>XkbSA_UseDfltButton</symbol>
1666is set in the
1667<structfield>flags</structfield>
1668field, the event is generated for the pointer button specified by the
1669<structfield>mk_dflt_btn</structfield>
1670attribute of the
1671<emphasis>MouseKeys</emphasis>
1672control (see <link linkend="The_MouseKeys_Control">section 10.5.1</link>). Otherwise, the event is generated for the button
1673specified by the
1674<structfield>button</structfield>
1675field.
1676    </para>
1677  </listitem>
1678  <listitem>
1679    <para>
1680If the mouse button specified for this action is logically down, the key press
1681and corresponding key release are ignored and have no effect. Otherwise, a key
1682press causes one or more core pointer button events instead of the usual
1683<symbol>KeyPress</symbol>
1684event. If
1685<structfield>count</structfield>
1686is
1687<emphasis>zero</emphasis>,
1688a key press generates a single
1689<symbol>ButtonPress</symbol>
1690event; if
1691<structfield>count</structfield>
1692is greater than
1693<emphasis>zero</emphasis>,
1694a key press generates
1695<structfield>count</structfield>
1696pairs of
1697<symbol>ButtonPress</symbol>
1698and
1699<symbol>ButtonRelease</symbol>
1700events.
1701    </para>
1702  </listitem>
1703  <listitem>
1704    <para>
1705If
1706<structfield>count</structfield>
1707is
1708<emphasis>zero</emphasis>,
1709a key release generates a core pointer
1710<symbol>ButtonRelease</symbol>
1711that matches the event generated by the corresponding
1712<symbol>KeyPress</symbol>;
1713if
1714<structfield>count</structfield>
1715is nonzero, a key release does not cause a
1716<symbol>ButtonRelease</symbol>
1717event. A key release never generates a key
1718<symbol>KeyRelease</symbol>
1719event.
1720    </para>
1721  </listitem>
1722</itemizedlist>
1723    </entry>
1724  </row>
1725  <row>
1726    <entry><symbol>XkbSA_LockPtrBtn</symbol></entry>
1727    <entry>
1728<itemizedlist>
1729  <listitem>
1730    <para>
1731If the button specified by the
1732<emphasis>MouseKeys</emphasis>
1733default button
1734or
1735<structfield>button</structfield>
1736is not locked, a key press causes a
1737<symbol>ButtonPress</symbol>
1738event instead of a
1739<symbol>KeyPress</symbol>
1740event and locks the button. If the button is already locked or if
1741<symbol>XkbSA_LockNoUnlock</symbol>
1742is set in the
1743<structfield>flags</structfield>
1744field, a key press is ignored and has no effect.
1745    </para>
1746  </listitem>
1747  <listitem>
1748    <para>
1749If the corresponding key press was ignored, and if
1750<symbol>XkbSA_LockNoLock</symbol>
1751is not set in the
1752<structfield>flags</structfield>
1753field, a key release generates a
1754<symbol>ButtonRelease</symbol>
1755event instead of a
1756<symbol>KeyRelease</symbol>
1757event and unlocks the specified button. If the corresponding key press locked
1758a button, the key release is ignored and has no effect.
1759    </para>
1760  </listitem>
1761</itemizedlist>
1762    </entry>
1763  </row>
1764</tbody>
1765</tgroup>
1766</table>
1767
1768<para>
1769The
1770<structfield>flags</structfield>
1771field is composed of the bitwise inclusive OR of the masks shown in
1772<link linkend="table16.8">Table 16.8</link>.
1773A general meaning is given in the table, but the exact meaning depends on
1774the action
1775<structfield>type</structfield>:
1776</para>
1777
1778<table id='table16.8' frame='topbot'>
1779<title>Pointer Button Action Flags</title>
1780<?dbfo keep-together="always" ?>
1781<tgroup cols='2' align='left' colsep='0' rowsep='0'>
1782<colspec colname='c1' colwidth='1.0*'/>
1783<colspec colname='c2' colwidth='2.0*'/>
1784<thead>
1785<row rowsep='1'>
1786  <entry>Flag</entry>
1787  <entry>Meaning</entry>
1788</row>
1789</thead>
1790<tbody>
1791  <row>
1792    <entry><symbol>XkbSA_UseDfltButton</symbol></entry>
1793    <entry>
1794If set, the action uses the pointer button specified by the
1795<structfield>mk_dflt_btn</structfield>
1796attribute of the
1797<emphasis>MouseKeys</emphasis>
1798control (see <link linkend="The_MouseKeys_Control">section 10.5.1</link>). Otherwise, the action uses the pointer button
1799specified by the
1800<structfield>button</structfield>
1801field.
1802    </entry>
1803  </row>
1804  <row>
1805    <entry><symbol>XkbSA_LockNoLock</symbol></entry>
1806    <entry>
1807If set, and the action type is
1808<symbol>XkbSA_LockPtrBtn</symbol>,
1809the server only unlocks the pointer button.
1810    </entry>
1811  </row>
1812  <row>
1813    <entry><symbol>XkbSA_LockNoUnlock</symbol></entry>
1814    <entry>
1815If set, and the action type is
1816<symbol>XkbSA_LockPtrBtn</symbol>,
1817the server only locks the pointer button.
1818    </entry>
1819  </row>
1820</tbody>
1821</tgroup>
1822</table>
1823
1824</sect2>
1825<sect2 id='Actions_for_Changing_the_Pointer_Button_Simulated'>
1826<title>Actions for Changing the Pointer Button Simulated</title>
1827<indexterm significance="preferred" zone="Actions_for_Changing_the_Pointer_Button_Simulated">
1828<primary><structname>XkbPtrDfltAction</structname></primary></indexterm>
1829
1830<para>
1831Actions associated with the
1832<structname>XkbPtrDfltAction</structname>
1833structure change the
1834<structfield>mk_dflt_btn</structfield>
1835attribute of the
1836<emphasis>MouseKeys</emphasis>
1837control (see <link linkend="The_MouseKeys_Control">section 10.5.1</link>):
1838
1839<programlisting>
1840typedef struct _XkbPtrDfltAction {
1841    unsigned char   type;      /* <symbol>XkbSA_SetPtrDflt</symbol> */
1842    unsigned char   flags;     /* controls the pointer button number */
1843    unsigned char   affect;    /* <symbol>XkbSA_AffectDfltBtn</symbol> */
1844    char            valueXXX;  /* new default button member */
1845} <structname>XkbPtrDfltAction</structname>;
1846</programlisting></para>
1847
1848<para>
1849If the
1850<emphasis>MouseKeys</emphasis>
1851control is not enabled,
1852<symbol>KeyPress</symbol>
1853and
1854<symbol>KeyRelease</symbol>
1855events are treated as though the action is
1856<symbol>XkbSA_NoAction</symbol>.
1857Otherwise, this action changes the
1858<structfield>mk_dflt_btn</structfield>
1859attribute of the
1860<emphasis>MouseKeys</emphasis>
1861control.
1862</para>
1863
1864
1865<para>
1866The
1867<structfield>type</structfield>
1868field of the
1869<structname>XkbPtrDfltAction</structname>
1870structure should always be
1871<symbol>XkbSA_SetPtrDflt</symbol>.
1872</para>
1873
1874
1875<para>
1876The
1877<structfield>flags</structfield>
1878field is composed of the bitwise inclusive OR of the values shown in
1879<link linkend="table16.9">Table 16.9</link>
1880(currently there is only one value defined).
1881</para>
1882
1883<table id='table16.9' frame='topbot'>
1884<title>Pointer Default Flags</title>
1885<?dbfo keep-together="always" ?>
1886<tgroup cols='2' align='left' colsep='0' rowsep='0'>
1887<colspec colname='c1' colwidth='1.0*'/>
1888<colspec colname='c2' colwidth='2.0*'/>
1889<thead>
1890<row rowsep='1'>
1891  <entry>Flag</entry>
1892  <entry>Meaning</entry>
1893</row>
1894</thead>
1895<tbody>
1896  <row>
1897    <entry><symbol>XkbSA_DfltBtnAbsolute</symbol></entry>
1898    <entry>
1899If set, the
1900<structfield>value</structfield>
1901field represents an absolute pointer button. Otherwise, the
1902<structfield>value</structfield>
1903field represents the amount to be added to the current default button.
1904    </entry>
1905  </row>
1906</tbody>
1907</tgroup>
1908</table>
1909
1910<para>
1911The
1912<structfield>affect</structfield>
1913field specifies what changes as a result of this action. The only valid value
1914for the
1915<structfield>affect</structfield>
1916field is <symbol>XkbSA_AffectDfltBtn</symbol>.
1917</para>
1918
1919<para>
1920The
1921<structfield>valueXXX</structfield>
1922field is a signed character that represents the new button value for the
1923<structfield>mk_dflt_btn</structfield>
1924attribute of the
1925<emphasis>MouseKeys</emphasis>
1926control (see <link linkend="The_MouseKeys_Control">section 10.5.1</link>). If
1927<symbol>XkbSA_DfltBtnAbsolute</symbol>
1928is set in
1929<structfield>flags</structfield>,
1930<structfield>valueXXX</structfield>
1931specifies the button to be used; otherwise,
1932<structfield>valueXXX</structfield>
1933specifies the amount to be added to the current default button. In either
1934case, illegal button choices are wrapped back around into range. Xkb provides
1935the following macros, to convert between the integer and signed character
1936values in
1937<structname>XkbPtrDfltAction</structname>
1938structures:
1939</para>
1940
1941<indexterm significance="preferred" zone="XkbSAPtrDfltValue"><primary><function>XkbSAPtrDfltValue</function></primary></indexterm>
1942<funcsynopsis id="XkbSAPtrDfltValue">
1943  <funcprototype>
1944    <funcdef>int <function>XkbSAPtrDfltValue</function></funcdef>
1945<!-- (
1946<parameter>act</parameter>
1947)                              /* macro */ -->
1948
1949    <paramdef>XkbAction <parameter>act</parameter></paramdef>
1950  </funcprototype>
1951</funcsynopsis>
1952<variablelist>
1953  <varlistentry>
1954    <term>
1955      <parameter>act</parameter>
1956    </term>
1957    <listitem>
1958      <para>
1959        action from which to extract group
1960      </para>
1961    </listitem>
1962  </varlistentry>
1963</variablelist>
1964
1965<para>
1966<function>XkbSAPtrDfltValue</function>
1967returns the
1968<structfield>valueXXX</structfield>
1969field of
1970<parameter>act</parameter>
1971converted to a signed int.
1972</para>
1973
1974
1975<indexterm significance="preferred" zone="XkbSASetPtrDfltValue"><primary><function>XkbSASetPtrDfltValue</function></primary></indexterm>
1976<funcsynopsis id="XkbSASetPtrDfltValue">
1977  <funcprototype>
1978    <funcdef>void <function>XkbSASetPtrDfltValue</function></funcdef>
1979<!-- (
1980<parameter>act, val</parameter>
1981)                              /* macro */ -->
1982
1983    <paramdef>XkbPtrDfltAction <parameter>act</parameter></paramdef>
1984    <paramdef>int <parameter>val</parameter></paramdef>
1985  </funcprototype>
1986</funcsynopsis>
1987<variablelist>
1988  <varlistentry>
1989    <term>
1990      <parameter>act</parameter>
1991    </term>
1992    <listitem>
1993      <para>
1994        action in which to set <structfield>valueXXX</structfield>
1995      </para>
1996    </listitem>
1997  </varlistentry>
1998  <varlistentry>
1999    <term>
2000      <parameter>val</parameter>
2001    </term>
2002    <listitem>
2003      <para>
2004        value to set in <structfield>valueXXX</structfield>
2005      </para>
2006    </listitem>
2007  </varlistentry>
2008</variablelist>
2009
2010<para>
2011<function>XkbSASetPtrDfltValue</function>
2012sets the
2013<structfield>valueXXX</structfield>
2014field of
2015<parameter>act</parameter>
2016from
2017<parameter>val</parameter>.
2018</para>
2019
2020
2021</sect2>
2022<sect2 id='Actions_for_Locking_Modifiers_and_Group'>
2023<title>Actions for Locking Modifiers and Group</title>
2024<indexterm significance="preferred" zone="Actions_for_Locking_Modifiers_and_Group">
2025<primary><structname>XkbISOAction</structname></primary></indexterm>
2026
2027<para>
2028Actions associated with the
2029<structname>XkbISOAction</structname>
2030structure lock modifiers and the group according to the ISO9995 specification.
2031</para>
2032
2033
2034<para>
2035Operated by itself, the
2036<structname>XkbISOAction</structname>
2037is just a caps lock. Operated simultaneously with another modifier key, it
2038transforms the other key into a locking key. For example, press
2039<keysym>ISO_Lock</keysym>,
2040press and release
2041<keysym>Control_L</keysym>,
2042release
2043<keysym>ISO_Lock</keysym>
2044ends up locking the
2045<symbol>Control</symbol>
2046modifier.
2047</para>
2048
2049
2050<para>
2051The default behavior is to convert:
2052
2053<simplelist type='vert' columns='1'>
2054  <member>{Set,Latch}Mods to: LockMods</member>
2055  <member>{Set,Latch}Group to: LockGroup</member>
2056  <member>SetPtrBtn to: LockPtrBtn</member>
2057  <member>SetControls to: LockControls</member>
2058</simplelist>
2059</para>
2060
2061<para>
2062The
2063<emphasis>affects</emphasis>
2064field allows you to turn those effects on or off individually. Set
2065<symbol>XkbSA_ISONoAffectMods</symbol>
2066to disable the first,
2067<symbol>XkbSA_ISONoAffectGroup</symbol>
2068to disable the second, and so forth.
2069</para>
2070
2071<para><programlisting>
2072typedef struct _XkbISOAction {
2073    unsigned char   type;        /* <symbol>XkbSA_ISOLock</symbol> */
2074    unsigned char   flags;       /* controls changes to group or
2075                                    modifier state */
2076    unsigned char   mask;        /* same as <structfield>mask</structfield> field of
2077                                    a modifier description */
2078    unsigned char   real_mods;   /* same as <structfield>real_mods</structfield> field of
2079                                    a modifier description */
2080    char            group_XXX;   /* group index or delta group */
2081    unsigned char   affect;      /* specifies whether to affect
2082                                    mods, group, ptrbtn, or controls */
2083    unsigned char   vmods1;      /* derived from <structfield>vmods</structfield> field of
2084                                    a modifier description */
2085    unsigned char   vmods2;      /* derived from <structfield>vmods</structfield> field of
2086                                    a modifier description */
2087} <structname>XkbISOAction</structname>;
2088</programlisting></para>
2089
2090<para>
2091The
2092<structfield>type</structfield>
2093field of the
2094<structname>XkbISOAction</structname>
2095structure should always be
2096<symbol>XkbSA_ISOLock</symbol>.
2097</para>
2098
2099
2100<para>
2101The interpretation of the
2102<structfield>flags</structfield>
2103field depends on whether the
2104<symbol>XkbSA_ISODfltIsGroup</symbol>
2105is set in the
2106<structfield>flags</structfield>
2107field or not.
2108</para>
2109
2110
2111<para>
2112If the
2113<symbol>XkbSA_ISODfltIsGroup</symbol>
2114is set in the
2115<structfield>flags</structfield>
2116field, the action is used to change the group state. The remaining valid bits
2117of the
2118<structfield>flags</structfield>
2119field are composed of a bitwise inclusive OR using the masks shown in
2120<link linkend="table16.10">Table 16.10</link>.
2121</para>
2122
2123<table id='table16.10' frame='topbot'>
2124<title>ISO Action Flags when XkbSA_ISODfltIsGroup is Set</title>
2125<?dbfo keep-together="always" ?>
2126<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2127<colspec colname='c1' colwidth='1.0*'/>
2128<colspec colname='c2' colwidth='2.0*'/>
2129<thead>
2130<row rowsep='1'>
2131  <entry>Flag</entry>
2132  <entry>Meaning</entry>
2133</row>
2134</thead>
2135<tbody>
2136  <row>
2137    <entry><symbol>XkbSA_ISODfltIsGroup</symbol></entry>
2138    <entry>
2139      <para>
2140If set, the action is used to change the base group state. Must be set for the
2141remaining bits in this table to carry their interpretations.
2142      </para>
2143      <para>
2144A key press sets the base group as specified by the
2145<structfield>group_XXX</structfield>
2146field and the
2147<symbol>XkbSA_GroupAbsolute</symbol>
2148bit of the
2149<structfield>flags</structfield>
2150field (see section Note). If no other actions are transformed by the
2151<symbol>XkbSA_ISOLock</symbol>
2152action, a key release locks the group. Otherwise, a key release clears group
2153set by the key press.
2154      </para>
2155    </entry>
2156  </row>
2157  <row>
2158    <entry><symbol>XkbSA_GroupAbsolute</symbol></entry>
2159    <entry>
2160If set, the
2161<structfield>group_XXX</structfield>
2162field represents an absolute group number. Otherwise, it represents a group
2163delta to be added to the current group to determine the new group number.
2164    </entry>
2165  </row>
2166  <row>
2167    <entry><symbol>XkbSA_ISONoAffectMods</symbol></entry>
2168    <entry>
2169If not set, any
2170<symbol>XkbSA_SetMods</symbol>
2171or
2172<symbol>XkbSA_LatchMods</symbol>
2173actions that occur simultaneously with the
2174<symbol>XkbSA_ISOLock</symbol>
2175action are treated as
2176<symbol>XkbSA_LockMods</symbol>
2177actions instead.
2178    </entry>
2179  </row>
2180  <row>
2181    <entry><symbol>XkbSA_ISONoAffectGroup</symbol></entry>
2182    <entry>
2183If not set, any
2184<symbol>XkbSA_SetGroup</symbol>
2185or
2186<symbol>XkbSA_LatchGroup</symbol>
2187actions that occur simultaneously with the
2188<symbol>XkbSA_ISOLock</symbol>
2189action are treated as
2190<symbol>XkbSA_LockGroup</symbol>
2191actions instead.
2192    </entry>
2193  </row>
2194  <row>
2195    <entry><symbol>XkbSA_ISONoAffectPtr</symbol></entry>
2196    <entry>
2197If not set, any
2198<symbol>XkbSA_PtrBtn</symbol>
2199actions that occur simultaneously with the
2200<symbol>XkbSA_ISOLock</symbol>
2201action are treated as
2202<symbol>XkbSA_LockPtrBtn</symbol>
2203actions instead.
2204    </entry>
2205  </row>
2206  <row>
2207    <entry><symbol>XkbSA_ISONoAffectCtrls</symbol></entry>
2208    <entry>
2209If not set, any
2210<symbol>XkbSA_SetControls</symbol>
2211actions that occur simultaneously with the
2212<symbol>XkbSA_ISOLock</symbol>
2213action are treated as
2214<symbol>XkbSA_LockControls</symbol>
2215actions instead.
2216    </entry>
2217  </row>
2218</tbody>
2219</tgroup>
2220</table>
2221
2222<para>
2223If the
2224<symbol>XkbSA_ISODfltIsGroup</symbol>
2225is not set in the
2226<structfield>flags</structfield>
2227field, the action is used to change the modifier state and the remaining valid
2228bits of the
2229<structfield>flags</structfield>
2230field are composed of a bitwise inclusive OR using the masks shown in
2231<link linkend="table16.11">Table 16.11</link>.
2232</para>
2233
2234<table id='table16.11' frame='topbot'>
2235<title>ISO Action Flags when XkbSA_ISODfltIsGroup is Not Set</title>
2236<?dbfo keep-together="always" ?>
2237<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2238<colspec colname='c1' colwidth='1.0*'/>
2239<colspec colname='c2' colwidth='2.0*'/>
2240<thead>
2241<row rowsep='1'>
2242  <entry>Flag</entry>
2243  <entry>Meaning</entry>
2244</row>
2245</thead>
2246<tbody>
2247  <row>
2248    <entry><symbol>XkbSA_ISODfltIsGroup</symbol> </entry>
2249    <entry>
2250      <para>
2251If not set, action is used to change the base modifier state. Must not be set
2252for the remaining bits in this table to carry their interpretations.
2253      </para>
2254      <para>
2255A key press sets the action modifiers in the keyboard’s base modifiers using
2256the
2257<structfield>mask</structfield>,
2258<structfield>real_mods</structfield>,
2259<structfield>vmods1</structfield>,
2260and
2261<structfield>vmods2</structfield>
2262fields (see <link linkend="Actions_for_Changing_Modifiers_State">section 16.1.3</link>). If no other actions are transformed by the
2263<symbol>XkbSA_ISOLock</symbol>
2264action, a key release locks the action modifiers. Otherwise, a key release
2265clears the base modifiers set by the key press.
2266      </para>
2267    </entry>
2268  </row>
2269  <row>
2270    <entry><symbol>XkbSA_UseModMapMods</symbol></entry>
2271    <entry>
2272If set, the action modifiers are determined by the modifiers bound by the
2273modifier mapping of the key. Otherwise, the action modifiers are set to the
2274modifiers specified by the
2275<structfield>mask</structfield>,
2276<structfield>real_mods</structfield>,
2277<structfield>vmods1</structfield>,
2278and
2279<structfield>vmods2</structfield>
2280fields.
2281    </entry>
2282  </row>
2283  <row>
2284    <entry><symbol>XkbSA_LockNoLock</symbol></entry>
2285    <entry>If set, the server only unlocks the action modifiers.</entry>
2286  </row>
2287  <row>
2288    <entry><symbol>XkbSA_LockNoUnlock</symbol></entry>
2289    <entry>If set, the server only locks the action modifiers. </entry>
2290  </row>
2291  <row>
2292    <entry><symbol>XkbSA_ISONoAffectMods</symbol></entry>
2293    <entry>
2294If not set, any
2295<symbol>XkbSA_SetMods</symbol>
2296or
2297<symbol>XkbSA_LatchMods</symbol>
2298actions that occur simultaneously with the
2299<symbol>XkbSA_ISOLock</symbol>
2300action are treated as
2301<symbol>XkbSA_LockMods</symbol>
2302actions instead.
2303    </entry>
2304  </row>
2305  <row>
2306    <entry><symbol>XkbSA_ISONoAffectGroup</symbol></entry>
2307    <entry>
2308If not set, any
2309<symbol>XkbSA_SetGroup</symbol>
2310or
2311<symbol>XkbSA_LatchGroup</symbol>
2312actions that occur simultaneously with the
2313<symbol>XkbSA_ISOLock</symbol>
2314action are treated as
2315<symbol>XkbSA_LockGroup</symbol>
2316actions instead.
2317    </entry>
2318  </row>
2319  <row>
2320    <entry><symbol>XkbSA_ISONoAffectPtr</symbol></entry>
2321    <entry>
2322If not set, any
2323<symbol>XkbSA_PtrBtn</symbol>
2324actions that occur simultaneously with the
2325<symbol>XkbSA_ISOLock</symbol>
2326action are treated as
2327<symbol>XkbSA_LockPtrBtn</symbol>
2328actions instead.
2329    </entry>
2330  </row>
2331  <row>
2332    <entry><symbol>XkbSA_ISONoAffectCtrls</symbol></entry>
2333    <entry>
2334If not set, any
2335<symbol>XkbSA_SetControls</symbol>
2336actions that occur simultaneously with the
2337<symbol>XkbSA_ISOLock</symbol>
2338action are treated as
2339<symbol>XkbSA_LockControls</symbol>
2340actions instead.
2341    </entry>
2342  </row>
2343</tbody>
2344</tgroup>
2345</table>
2346
2347<para>
2348The
2349<structfield>group_XXX</structfield>
2350field represents a signed character. Xkb provides macros to convert between a
2351signed integer value and a signed character as shown in section Note.
2352</para>
2353
2354
2355<para>
2356The
2357<structfield>mask</structfield>,
2358<structfield>real_mods</structfield>,
2359<structfield>vmods1</structfield>,
2360and
2361<structfield>vmods2</structfield>
2362fields represent the components of an Xkb modifier description
2363(see <link linkend="Modifier_Definitions">section 7.2</link>). While the
2364<structfield>mask</structfield>
2365and
2366<structfield>real_mods</structfield>
2367fields correspond directly to the
2368<structfield>mask</structfield>
2369and
2370<structfield>real_mods</structfield>
2371fields of an Xkb modifier description, the
2372<structfield>vmods1</structfield>
2373and
2374<structfield>vmods2</structfield>
2375fields are combined to correspond to the
2376<structfield>vmods</structfield>
2377field of an Xkb modifier description. Xkb provides macros to convert between
2378the two formats as shown in <link linkend="Actions_for_Changing_Modifiers_State">section 16.1.3</link>.
2379</para>
2380
2381
2382<para>
2383The
2384<structfield>affect</structfield>
2385field is composed of a bitwise inclusive OR using the masks shown in
2386<link linkend="table16.11">Table 16.11</link>.
2387</para>
2388
2389<table id='table16.12' frame='topbot'>
2390<title>ISO Action Affect Field Values</title>
2391<?dbfo keep-together="always" ?>
2392<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2393<colspec colname='c1' colwidth='1.0*'/>
2394<colspec colname='c2' colwidth='2.0*'/>
2395<thead>
2396<row rowsep='1'>
2397  <entry>Affect</entry>
2398  <entry>Meaning</entry>
2399</row>
2400</thead>
2401<tbody>
2402  <row>
2403    <entry><symbol>XkbSA_ISONoAffectMods</symbol></entry>
2404    <entry>
2405If
2406<symbol>XkbSA_ISONoAffectMods</symbol>
2407is not set, any
2408<emphasis>SA_SetMods</emphasis>
2409or
2410<emphasis>SA_LatchMods</emphasis>
2411actions occurring simultaneously with the
2412<structname>XkbISOAction</structname>
2413are treated as
2414<emphasis>SA_LockMods</emphasis>
2415instead.
2416    </entry>
2417  </row>
2418  <row>
2419    <entry><symbol>XkbSA_ISONoAffectGroup</symbol></entry>
2420    <entry>
2421If
2422<symbol>XkbSA_ISONoAffectGroup</symbol>
2423is not set, any
2424<emphasis>SA_SetGroup</emphasis>
2425or
2426<emphasis>SA_LatchGroup</emphasis>
2427actions occurring simultaneously with the
2428<structname>XkbISOAction</structname>
2429are treated as
2430<emphasis>SA_LockGroup</emphasis>
2431instead.
2432    </entry>
2433  </row>
2434  <row>
2435    <entry><symbol>XkbSA_ISONoAffectPtr</symbol></entry>
2436    <entry>
2437If
2438<symbol>XkbSA_ISONoAffectPtr</symbol>
2439is not set, any
2440<emphasis>SA_PtrBtn</emphasis>
2441actions occurring simultaneously with the
2442<structname>XkbISOAction</structname>
2443are treated as
2444<emphasis>SA_LockPtrBtn</emphasis>
2445instead.
2446    </entry>
2447  </row>
2448  <row>
2449    <entry><symbol>XkbSA_ISONoAffectCtrls</symbol></entry>
2450    <entry>
2451If
2452<symbol>XkbSA_ISONoAffectCtrls</symbol>
2453is not set, any
2454<emphasis>SA_SetControls</emphasis>
2455actions occurring simultaneously with the
2456<structname>XkbISOAction</structname>
2457are treated as
2458<emphasis>SA_LockControls</emphasis>
2459instead.
2460    </entry>
2461  </row>
2462</tbody>
2463</tgroup>
2464</table>
2465
2466</sect2>
2467<sect2 id='Actions_for_Changing_the_Active_Screen'>
2468<title>Actions for Changing the Active Screen</title>
2469<indexterm significance="preferred" zone="Actions_for_Changing_the_Active_Screen">
2470<primary><structname>XkbSwitchScreenAction</structname></primary></indexterm>
2471
2472<para>
2473Actions associated with the
2474<structname>XkbSwitchScreenAction</structname>
2475action structure change the active screen on a multiscreen display:
2476</para>
2477
2478<note><para>This action is optional. Servers are free to ignore the action or
2479any of its flags if they do not support the requested behavior. If the action
2480is ignored, it behaves like
2481<symbol>XkbSA_NoAction</symbol>.
2482Otherwise, key press and key release events do not generate an event.
2483</para></note>
2484
2485<para><programlisting>
2486typedef struct _XkbSwitchScreenAction {
2487    unsigned char   type;        /* <symbol>XkbSA_SwitchScreen</symbol> */
2488    unsigned char   flags;       /* controls screen switching */
2489    char            screenXXX;   /* screen number or delta */
2490} <structname>XkbSwitchScreenAction</structname>;
2491</programlisting></para>
2492
2493<para>
2494The
2495<structfield>type</structfield>
2496field of the
2497<structname>XkbSwitchScreenAction</structname>
2498structure should always be
2499<symbol>XkbSA_SwitchScreen</symbol>.
2500</para>
2501
2502
2503<para>
2504The
2505<structfield>flags</structfield>
2506field is composed of the bitwise inclusive OR of the masks shown in
2507<link linkend="table16.13">Table 16.13</link>.
2508</para>
2509
2510<table id='table16.13' frame='topbot'>
2511<title>Switch Screen Action Flags</title>
2512<?dbfo keep-together="always" ?>
2513<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2514<colspec colname='c1' colwidth='1.0*'/>
2515<colspec colname='c2' colwidth='2.0*'/>
2516<thead>
2517<row rowsep='1'>
2518  <entry>Flag</entry>
2519  <entry>Meaning</entry>
2520</row>
2521</thead>
2522<tbody>
2523  <row>
2524    <entry><symbol>XkbSA_SwitchAbsolute</symbol></entry>
2525    <entry>
2526If set, the
2527<structfield>screenXXX</structfield>
2528field represents the index of the new screen. Otherwise, it represents an
2529offset from the current screen to the new screen.
2530    </entry>
2531  </row>
2532  <row>
2533    <entry><symbol>XkbSA_SwitchApplication</symbol></entry>
2534    <entry>
2535If not set, the action should switch to another screen on the same
2536server. Otherwise, it should switch to another X server or application that
2537shares the same physical display.
2538    </entry>
2539  </row>
2540</tbody>
2541</tgroup>
2542</table>
2543
2544<para>
2545The
2546<structfield>screenXXX</structfield>
2547field is a signed character value that represents either the relative or
2548absolute screen index, depending on the state of the
2549<symbol>XkbSA_SwitchAbsolute</symbol>
2550bit in the
2551<structfield>flags</structfield>
2552field. Xkb provides the following macros to convert between the integer and
2553signed character value for screen numbers in
2554<structname>XkbSwitchScreenAction</structname>
2555structures:
2556</para>
2557
2558<indexterm significance="preferred" zone="XkbSAScreen"><primary><function>XkbSAScreen</function></primary></indexterm>
2559<funcsynopsis id="XkbSAScreen">
2560  <funcprototype>
2561    <funcdef>int <function>XkbSAScreen</function></funcdef>
2562<!-- (
2563<parameter>act</parameter>
2564)                        /* macro */ -->
2565
2566    <paramdef>XkbSwitchScreenAction <parameter>act</parameter></paramdef>
2567  </funcprototype>
2568</funcsynopsis>
2569<variablelist>
2570  <varlistentry>
2571    <term>
2572      <parameter>act</parameter>
2573    </term>
2574    <listitem>
2575      <para>
2576        action from which to extract screen
2577      </para>
2578    </listitem>
2579  </varlistentry>
2580</variablelist>
2581
2582<para>
2583<function>XkbSAScreen</function>
2584returns the
2585<structfield>screenXXX</structfield>
2586field of
2587<parameter>act</parameter>
2588converted to a signed int.
2589</para>
2590
2591
2592<indexterm significance="preferred" zone="XkbSASetScreen"><primary><function>XkbSASetScreen</function></primary></indexterm>
2593<funcsynopsis id="XkbSASetScreen">
2594  <funcprototype>
2595    <funcdef>void <function>XkbSASetScreen</function></funcdef>
2596<!-- (
2597<parameter>act, s</parameter>
2598)                        /* macro */ -->
2599
2600    <paramdef>XkbSwitchScreenAction <parameter>act</parameter></paramdef>
2601    <paramdef>int <parameter>s</parameter></paramdef>
2602  </funcprototype>
2603</funcsynopsis>
2604<variablelist>
2605  <varlistentry>
2606    <term>
2607      <parameter>act</parameter>
2608    </term>
2609    <listitem>
2610      <para>
2611        action in which to set <structfield>screenXXX</structfield>
2612      </para>
2613    </listitem>
2614  </varlistentry>
2615  <varlistentry>
2616    <term>
2617      <parameter>s</parameter>
2618    </term>
2619    <listitem>
2620      <para>
2621        value to set in <structfield>screenXXX</structfield>
2622      </para>
2623    </listitem>
2624  </varlistentry>
2625</variablelist>
2626
2627<para>
2628<function>XkbSASetScreen</function>
2629sets the
2630<structfield>screenXXX</structfield>
2631field of
2632<parameter>act</parameter>
2633from
2634<parameter>s</parameter>.
2635</para>
2636
2637
2638</sect2>
2639<sect2 id='Actions_for_Changing_Boolean_Controls_State'>
2640<title>Actions for Changing Boolean Controls State</title>
2641<indexterm significance="preferred" zone="Actions_for_Changing_Boolean_Controls_State">
2642<primary><structname>XkbCtrlsAction</structname></primary></indexterm>
2643
2644<para>
2645Actions associated with the
2646<structname>XkbCtrlsAction</structname>
2647structure change the state of the boolean controls (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>):
2648
2649<programlisting>
2650typedef struct _XkbCtrlsAction {
2651    unsigned char     type;        /* <symbol>XkbSA_SetControls</symbol>,
2652                                      <symbol>XkbSA_LockControls</symbol> */
2653    unsigned char     flags;       /* with <structfield>type</structfield>, controls enabling
2654                                      and disabling of controls */
2655    unsigned char     ctrls3;      /* <structfield>ctrls0</structfield> through <structfield>ctrls3</structfield>
2656                                      represent the boolean controls */
2657    unsigned char     ctrls2;      /* <structfield>ctrls0</structfield> through <structfield>ctrls3</structfield>
2658                                      represent the boolean controls */
2659    unsigned char     ctrls1;      /* <structfield>ctrls0</structfield> through <structfield>ctrls3</structfield>
2660                                      represent the boolean controls */
2661    unsigned char     ctrls0;      /* <structfield>ctrls0</structfield> through <structfield>ctrls3</structfield>
2662                                      represent the boolean controls */
2663} <structname>XkbCtrlsAction</structname>;
2664</programlisting></para>
2665
2666<para>
2667The
2668<structfield>type</structfield>
2669field can have any one of the values shown in
2670<link linkend="table16.14">Table 16.14</link>.
2671</para>
2672
2673<table id='table16.14' frame='topbot'>
2674<title>Controls Action Types</title>
2675<?dbfo keep-together="always" ?>
2676<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2677<colspec colname='c1' colwidth='1.0*'/>
2678<colspec colname='c2' colwidth='2.0*'/>
2679<thead>
2680<row rowsep='1'>
2681  <entry>Type</entry>
2682  <entry>Effect</entry>
2683</row>
2684</thead>
2685<tbody>
2686  <row>
2687    <entry><symbol>XkbSA_SetControls</symbol></entry>
2688    <entry>
2689<itemizedlist>
2690  <listitem>
2691    <para>
2692A key press enables any boolean controls specified in the
2693<structfield>ctrls</structfield>
2694fields that were not already enabled at the time of the key press.
2695    </para>
2696  </listitem>
2697  <listitem>
2698    <para>
2699A key release disables any controls enabled by the key press.
2700    </para>
2701  </listitem>
2702  <listitem>
2703    <para>
2704This action can cause
2705<symbol>XkbControlsNotify</symbol>
2706events (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>).
2707    </para>
2708  </listitem>
2709</itemizedlist>
2710    </entry>
2711  </row>
2712  <row>
2713    <entry><symbol>XkbSA_LockControls</symbol></entry>
2714    <entry>
2715<itemizedlist>
2716  <listitem>
2717    <para>
2718If the
2719<symbol>XkbSA_LockNoLock</symbol>
2720bit is not set in the
2721<structfield>flags</structfield>
2722field, a key press enables any controls specified in the
2723<structfield>ctrls</structfield>
2724fields that were not already enabled at the time of the key press.
2725    </para>
2726  </listitem>
2727  <listitem>
2728    <para>
2729If the
2730<symbol>XkbSA_LockNoUnlock</symbol>
2731bit is not set in the
2732<structfield>flags</structfield>
2733field, a key release disables any controls specified in the
2734<structfield>ctrls</structfield>
2735fields that were not already disabled at the time of the key press.
2736    </para>
2737  </listitem>
2738  <listitem>
2739    <para>
2740This action can cause
2741<symbol>XkbControlsNotify</symbol>
2742events (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>).
2743    </para>
2744  </listitem>
2745</itemizedlist>
2746    </entry>
2747  </row>
2748</tbody>
2749</tgroup>
2750</table>
2751
2752<para>
2753The
2754<structfield>flags</structfield>
2755field is composed of the bitwise inclusive OR of the masks shown in
2756<link linkend="table16.15">Table 16.15</link>.
2757</para>
2758
2759<table id='table16.15' frame='topbot'>
2760<title>Control Action Flags</title>
2761<?dbfo keep-together="always" ?>
2762<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2763<colspec colname='c1' colwidth='1.0*'/>
2764<colspec colname='c2' colwidth='2.0*'/>
2765<thead>
2766<row rowsep='1'>
2767  <entry>Flag</entry>
2768  <entry>Meaning</entry>
2769</row>
2770</thead>
2771<tbody>
2772  <row>
2773    <entry><symbol>XkbSA_LockNoLock</symbol></entry>
2774    <entry>
2775If set, and the action type is
2776<symbol>XkbSA_LockControls</symbol>,
2777the server only disables controls.
2778    </entry>
2779  </row>
2780  <row>
2781    <entry><symbol>XkbSA_LockNoUnlock</symbol></entry>
2782    <entry>
2783If set, and the action type is
2784<symbol>XkbSA_LockControls</symbol>,
2785the server only enables controls.
2786    </entry>
2787  </row>
2788</tbody>
2789</tgroup>
2790</table>
2791
2792<para>
2793The
2794<symbol>XkbSA_SetControls</symbol>
2795action implements a key that enables a boolean control when pressed and
2796disables it when released. The
2797<symbol>XkbSA_LockControls</symbol>
2798action is used to implement a key that toggles the state of a boolean control
2799each time it is pressed and released. The
2800<symbol>XkbSA_LockNoLock</symbol>
2801and
2802<symbol>XkbSA_LockNoUnlock</symbol>
2803flags allow modifying the toggling behavior to only unlock or only lock the
2804boolean control.
2805</para>
2806
2807
2808<para>
2809The
2810<structfield>ctrls0</structfield>,
2811<structfield>ctrls1</structfield>,
2812<structfield>ctrls2</structfield>,
2813and
2814<structfield>ctrls3</structfield>
2815fields represent the boolean controls in the
2816<structfield>enabled_ctrls</structfield>
2817field of the controls structure (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>). Xkb provides the following
2818macros, to convert between the two formats:
2819</para>
2820
2821<indexterm significance="preferred" zone="XkbActionCtrls"><primary><function>XkbActionCtrls</function></primary></indexterm>
2822<funcsynopsis id="XkbActionCtrls">
2823  <funcprototype>
2824    <funcdef>unsigned int <function>XkbActionCtrls</function></funcdef>
2825<!-- (
2826<parameter>act</parameter>
2827)                        /* macro */ -->
2828
2829    <paramdef>XkbCtrlsAction <parameter>act</parameter></paramdef>
2830  </funcprototype>
2831</funcsynopsis>
2832<variablelist>
2833  <varlistentry>
2834    <term>
2835      <parameter>act</parameter>
2836    </term>
2837    <listitem>
2838      <para>
2839        action from which to extract controls
2840      </para>
2841    </listitem>
2842  </varlistentry>
2843</variablelist>
2844
2845<para>
2846<function>XkbActionCtrls</function>
2847returns the
2848<structfield>ctrls</structfield>
2849fields of
2850<parameter>act</parameter>
2851converted to an unsigned int.
2852</para>
2853
2854
2855<indexterm significance="preferred" zone="XkbActionSetCtrls"><primary><function>XkbActionSetCtrls</function></primary></indexterm>
2856<funcsynopsis id="XkbActionSetCtrls">
2857  <funcprototype>
2858    <funcdef>void <function>XkbActionSetCtrls</function></funcdef>
2859<!-- (
2860<parameter>act, ctrls</parameter>
2861)                        /* macro */ -->
2862
2863    <paramdef>XkbCtrlsAction <parameter>act</parameter></paramdef>
2864    <paramdef>unsigned int <parameter>ctrls</parameter></paramdef>
2865  </funcprototype>
2866</funcsynopsis>
2867<variablelist>
2868  <varlistentry>
2869    <term>
2870      <parameter>act</parameter>
2871    </term>
2872    <listitem>
2873      <para>
2874        action in which to set ctrls0-ctrls3
2875      </para>
2876    </listitem>
2877  </varlistentry>
2878  <varlistentry>
2879    <term>
2880      <parameter>ctrls</parameter>
2881    </term>
2882    <listitem>
2883      <para>
2884        value to set in ctrls0-ctrls3
2885      </para>
2886    </listitem>
2887  </varlistentry>
2888</variablelist>
2889
2890<para>
2891<function>XkbActionSetCtrls</function>
2892sets the
2893<structfield>ctrls0</structfield>
2894through
2895<structfield>ctrls3</structfield>
2896fields of
2897<parameter>act</parameter>
2898from
2899<parameter>ctrls</parameter>.
2900</para>
2901
2902
2903</sect2>
2904<sect2 id='Actions_for_Generating_Messages'>
2905<title>Actions for Generating Messages</title>
2906<indexterm significance="preferred" zone="Actions_for_Generating_Messages">
2907<primary><structname>XkbMessageAction</structname></primary></indexterm>
2908
2909<para>
2910Actions associated with the
2911<structname>XkbMessageAction</structname>
2912structure generate
2913<symbol>XkbActionMessage</symbol>
2914events:
2915
2916<programlisting>
2917#define             XkbActionMessageLength                  6
2918
2919typedef struct _XkbMessageAction {
2920    unsigned char   type;             /* <symbol>XkbSA_ActionMessage</symbol> */
2921    unsigned char   flags;            /* controls event generation via
2922                                         key presses and releases */
2923    unsigned char   message[XkbActionMessageLength];    /* message */
2924} <structname>XkbMessageAction</structname>;
2925</programlisting></para>
2926
2927<para>
2928The
2929<structfield>type</structfield>
2930field of the
2931<structname>XkbMessageAction</structname>
2932structure should always be
2933<symbol>XkbSA_ActionMessage</symbol>.
2934</para>
2935
2936
2937<para>
2938The
2939<structfield>flags</structfield>
2940field is composed of the bitwise inclusive OR of the masks shown in
2941<link linkend="table16.16">Table 16.16</link>.
2942</para>
2943
2944<table id='table16.16' frame='topbot'>
2945<title>Message Action Flags</title>
2946<?dbfo keep-together="always" ?>
2947<tgroup cols='2' align='left' colsep='0' rowsep='0'>
2948<colspec colname='c1' colwidth='1.0*'/>
2949<colspec colname='c2' colwidth='2.0*'/>
2950<thead>
2951<row rowsep='1'>
2952  <entry>Flag</entry>
2953  <entry>Meaning</entry>
2954</row>
2955</thead>
2956<tbody>
2957  <row>
2958    <entry><symbol>XkbSA_MessageOnPress</symbol></entry>
2959    <entry>
2960If set, key press events generate an
2961<symbol>XkbActionMessage</symbol>
2962event that reports the keycode, event type, and contents of the
2963<structfield>message</structfield>
2964field.
2965    </entry>
2966  </row>
2967  <row>
2968    <entry><symbol>XkbSA_MessageOnRelease</symbol></entry>
2969    <entry>
2970If set, key release events generate an
2971<symbol>XkbActionMessage</symbol>
2972event that reports the keycode, event type, and contents of the
2973<structfield>message</structfield>
2974field.
2975    </entry>
2976  </row>
2977  <row>
2978    <entry><symbol>XkbSA_MessageGenKeyEvent</symbol></entry>
2979    <entry>
2980If set, key press and key release events generate
2981<symbol>KeyPress</symbol>
2982and
2983<symbol>KeyRelease</symbol>
2984events, regardless of whether they generate
2985<symbol>XkbActionMessage</symbol>
2986events.
2987    </entry>
2988  </row>
2989</tbody>
2990</tgroup>
2991</table>
2992
2993<para>
2994The
2995<structfield>message</structfield>
2996field is an array of
2997<symbol>XkbActionMessageLength</symbol>
2998unsigned characters and may be set to anything the keymap designer wishes.
2999</para>
3000
3001<sect3 id='Detecting_Key_Action_Messages'>
3002<title>Detecting Key Action Messages</title>
3003<indexterm significance="preferred" zone="Detecting_Key_Action_Messages">
3004<primary>events</primary><secondary><symbol>XkbActionMessage</symbol></secondary></indexterm>
3005<indexterm significance="preferred" zone="Detecting_Key_Action_Messages">
3006<primary><structname>XkbActionMessageEvent</structname></primary></indexterm>
3007
3008<para>
3009To receive
3010<symbol>XkbActionMessage</symbol>
3011events by calling either
3012<function>XkbSelectEvents</function>
3013or
3014<function>XkbSelectEventDetails</function>
3015(see <link linkend="Selecting_Xkb_Events">section 4.3</link>).
3016</para>
3017
3018
3019<para>
3020To receive
3021<symbol>XkbActionMessage</symbol>
3022events under all possible conditions, use
3023<function>XkbSelectEvents</function>
3024and pass
3025<symbol>XkbActionMessageMask</symbol>
3026in both
3027<parameter>bits_to_change</parameter>
3028and
3029<parameter>values_for_bits</parameter>.
3030</para>
3031
3032
3033<para>
3034The
3035<symbol>XkbActionMessage</symbol>
3036event has no event details. However, you can call
3037<function>XkbSelectEventDetails</function>
3038using
3039<symbol>XkbActionMessage</symbol>
3040as the
3041<structfield>event_type</structfield>
3042and specifying
3043<symbol>XkbAllActionMessagesMask</symbol>
3044in
3045<parameter>bits_to_change</parameter>
3046and
3047<parameter>values_for_bits</parameter>.
3048This has the same effect as a call to
3049<function>XkbSelectEvents</function>.
3050</para>
3051
3052
3053<para>
3054The structure for the
3055<symbol>XkbActionMessage</symbol>
3056event is defined as follows:
3057
3058<programlisting>
3059typedef struct _XkbActionMessage {
3060    int            type;             /* Xkb extension base event code */
3061    unsigned long  serial;           /* X server serial number for event */
3062    Bool           send_event;       /* <symbol>True</symbol> &rArr; synthetically generated */
3063    Display *      display;          /* server connection where event generated */
3064    Time           time;             /* server time when event generated */
3065    int            xkb_type;         /* <symbol>XkbActionMessage</symbol> */
3066    int            device;           /* Xkb device ID,
3067                                        will not be <symbol>XkbUseCoreKbd</symbol> */
3068    KeyCode        keycode;          /* keycode of key triggering event */
3069    Bool           press;            /* <symbol>True</symbol> &rArr; key press,
3070                                        <symbol>False</symbol> &rArr; release */
3071    Bool           key_event_follows;/* <symbol>True</symbol> &rArr; KeyPress/KeyRelease follows */
3072    char           message[XkbActionMessageLength+1];  /* message text */
3073} <structname>XkbActionMessageEvent</structname>;
3074</programlisting></para>
3075
3076<para>
3077The
3078<structfield>keycode</structfield>
3079is the keycode of the key that was pressed or released. The
3080<structfield>press</structfield>
3081field specifies whether the event was the result of a key press or key
3082release.
3083</para>
3084
3085
3086<para>
3087The
3088<structfield>key_event_follows</structfield>
3089specifies whether a
3090<symbol>KeyPress</symbol>
3091(if
3092<structfield>press</structfield>
3093is
3094<symbol>True</symbol>)
3095or
3096<symbol>KeyRelease</symbol>
3097(if
3098<structfield>press</structfield>
3099is
3100<symbol>False</symbol>)
3101event is also sent to the client. As with all other Xkb events,
3102<structname>XkbActionMessageEvent</structname>s
3103are delivered to all clients requesting them, regardless of the current
3104keyboard focus. However, the
3105<symbol>KeyPress</symbol>
3106or
3107<symbol>KeyRelease</symbol>
3108event that conditionally follows an
3109<structname>XkbActionMessageEvent</structname>
3110is sent only to the client selected by the current keyboard focus.
3111<structfield>key_event_follows</structfield>
3112is
3113<symbol>True</symbol>
3114only for the client that is actually sent the following
3115<symbol>KeyPress</symbol>
3116or
3117<symbol>KeyRelease</symbol>
3118event.
3119</para>
3120
3121
3122<para>
3123The
3124<structfield>message</structfield>
3125field is set to the message specified in the action and is guaranteed to be
3126<symbol>NULL</symbol>
3127-terminated; the Xkb extension forces a
3128<symbol>NULL</symbol>
3129into
3130<structfield>message</structfield>
3131[
3132<symbol>XkbActionMessageLength</symbol>
3133].
3134</para>
3135
3136
3137</sect3>
3138</sect2>
3139<sect2 id='Actions_for_Generating_a_Different_Keycode'>
3140<title>Actions for Generating a Different Keycode</title>
3141<indexterm significance="preferred" zone="Actions_for_Generating_a_Different_Keycode">
3142<primary><structname>XkbRedirectKeyAction</structname></primary></indexterm>
3143
3144<para>
3145Actions associated with the
3146<structname>XkbRedirectKeyAction</structname>
3147structure generate
3148<symbol>KeyPress</symbol>
3149and
3150<symbol>KeyRelease</symbol>
3151events containing a keycode different from the key that was pressed or
3152released:
3153
3154<programlisting>
3155typedef struct      _XkbRedirectKeyAction {
3156    unsigned char      type;          /* <symbol>XkbSA_RedirectKey</symbol> */
3157    unsigned char      new_key;       /* keycode to be put in event */
3158    unsigned char      mods_mask;     /* mask of real mods to be reset */
3159    unsigned char      mods;          /* mask of real mods to take values from */
3160    unsigned char      vmods_mask0;   /* first half of mask of virtual mods
3161                                         to be reset */
3162    unsigned char      vmods_mask1;   /* other half of mask of virtual mods
3163                                         to be reset */
3164    unsigned char      vmods0;        /* first half of mask of virtual mods
3165                                         to take values from */
3166    unsigned char      vmods1;        /* other half of mask of virtual mods
3167                                         to take values from */
3168} <structname>XkbRedirectKeyAction</structname>;
3169</programlisting></para>
3170
3171<para>
3172The
3173<structfield>type</structfield>
3174field for the
3175<structname>XkbRedirectKeyAction</structname>
3176structure should always be
3177<symbol>XkbSA_RedirectKey</symbol>.
3178</para>
3179
3180
3181<para>
3182Key presses cause a
3183<symbol>KeyPress</symbol>
3184event for the key specified by the
3185<structfield>new_key</structfield>
3186field instead of the actual key. The state reported in this event reports the
3187current effective modifiers changed as follows: any real modifiers selected by
3188the
3189<structfield>mods_mask</structfield>
3190field are set to corresponding values from the
3191<structfield>mods</structfield>
3192field. Any real modifiers bound to the virtual modifiers specified by the
3193<structfield>vmods_mask0</structfield>
3194and
3195<structfield>vmods_mask1</structfield>
3196fields are either set or cleared, depending on the corresponding values in the
3197<structfield>vmods0</structfield>
3198and
3199<structfield>vmods1</structfield>
3200fields. If the real and virtual modifier definitions specify conflicting
3201values for a single modifier, the real modifier definition has priority.
3202</para>
3203
3204
3205<para>
3206Key releases cause a
3207<symbol>KeyRelease</symbol>
3208event for the key specified by the
3209<structfield>new_key</structfield>
3210field instead of the actual key. The state for this event consists of the
3211effective keyboard modifiers at the time of the release, changed as described
3212previously.
3213</para>
3214
3215
3216<para>
3217The
3218<symbol>XkbSA_RedirectKey</symbol>
3219action normally redirects to another key on the same device as the key that
3220caused the event, unless that device does not belong to the input extension
3221<symbol>KeyClass</symbol>,
3222in which case this action causes an event on the core keyboard device. (The
3223input extension categorizes devices by breaking them into classes. Keyboards,
3224and other input devices with keys, are classified as KeyClass devices by the
3225input extension.)
3226</para>
3227
3228
3229<para>
3230The
3231<structfield>vmods_mask0</structfield>
3232and
3233<structfield>vmods_mask1</structfield>
3234fields actually represent one
3235<emphasis>vmods_mask</emphasis>
3236value, as described in <xref linkend="Virtual_Modifiers" />. Xkb provides the following macros, to
3237convert between the two formats:
3238</para>
3239
3240<indexterm significance="preferred" zone="XkbSARedirectVModsMask"><primary><function>XkbSARedirectVModsMask</function></primary></indexterm>
3241<funcsynopsis id="XkbSARedirectVModsMask">
3242  <funcprototype>
3243    <funcdef>unsigned int <function>XkbSARedirectVModsMask</function></funcdef>
3244<!-- (
3245<parameter>act</parameter>
3246)                              /* macro */ -->
3247
3248    <paramdef>XkbRedirectKeyAction <parameter>act</parameter></paramdef>
3249  </funcprototype>
3250</funcsynopsis>
3251<variablelist>
3252  <varlistentry>
3253    <term>
3254      <parameter>act</parameter>
3255    </term>
3256    <listitem>
3257      <para>
3258        action from which to extract vmods
3259      </para>
3260    </listitem>
3261  </varlistentry>
3262</variablelist>
3263
3264<para>
3265<function>XkbSARedirectVModsMask</function>
3266returns the
3267<structfield>vmods_mask0</structfield>
3268and
3269<structfield>vmods_mask1</structfield>
3270fields of
3271<parameter>act</parameter>
3272converted to an unsigned int.
3273</para>
3274
3275
3276<indexterm significance="preferred" zone="XkbSARedirectSetVModsMask"><primary><function>XkbSARedirectSetVModsMask</function></primary></indexterm>
3277<funcsynopsis id="XkbSARedirectSetVModsMask">
3278  <funcprototype>
3279    <funcdef>void <function>XkbSARedirectSetVModsMask</function></funcdef>
3280<!-- (
3281<parameter>act, vm</parameter>
3282)                              /* macro */ -->
3283
3284    <paramdef>XkbRedirectKeyAction <parameter>act</parameter></paramdef>
3285    <paramdef>unsigned int <parameter>vm</parameter></paramdef>
3286  </funcprototype>
3287</funcsynopsis>
3288<variablelist>
3289  <varlistentry>
3290    <term>
3291      <parameter>act</parameter>
3292    </term>
3293    <listitem>
3294      <para>
3295        action in which to set vmods
3296      </para>
3297    </listitem>
3298  </varlistentry>
3299  <varlistentry>
3300    <term>
3301      <parameter>vm</parameter>
3302    </term>
3303    <listitem>
3304      <para>
3305        new value for virtual modifier mask
3306      </para>
3307    </listitem>
3308  </varlistentry>
3309</variablelist>
3310
3311<para>
3312<function>XkbSARedirectSetVModsMask</function>
3313sets the
3314<structfield>vmods_mask0</structfield>
3315and
3316<structfield>vmods_mask1</structfield>
3317fields of
3318<parameter>act</parameter>
3319from
3320<parameter>vm</parameter>.
3321</para>
3322
3323
3324<para>
3325Similarly, the
3326<structfield>vmods0</structfield>
3327and
3328<structfield>vmods1</structfield>
3329fields actually represent one
3330<structfield>vmods</structfield>
3331value, as described in <xref linkend="Virtual_Modifiers" />. To convert between the two formats, Xkb
3332provides the following convenience macros:
3333</para>
3334
3335
3336<indexterm significance="preferred" zone="XkbSARedirectVMods"><primary><function>XkbSARedirectVMods</function></primary></indexterm>
3337<funcsynopsis id="XkbSARedirectVMods">
3338  <funcprototype>
3339    <funcdef>unsigned int <function>XkbSARedirectVMods</function></funcdef>
3340<!-- (
3341<parameter>act</parameter>
3342)                              /* macro */ -->
3343
3344    <paramdef>XkbRedirectKeyAction <parameter>act</parameter></paramdef>
3345  </funcprototype>
3346</funcsynopsis>
3347<variablelist>
3348  <varlistentry>
3349    <term>
3350      <parameter>act</parameter>
3351    </term>
3352    <listitem>
3353      <para>
3354        action from which to extract vmods
3355      </para>
3356    </listitem>
3357  </varlistentry>
3358</variablelist>
3359
3360<para>
3361     <function>XkbSARedirectVModsMask</function> returns the <structfield>vmods0</structfield>
3362     and <structfield>vmods1</structfield> fields of <parameter>act</parameter>
3363     converted to an unsigned int.
3364</para>
3365
3366<indexterm significance="preferred" zone="XkbSARedirectSetVMods"><primary><function>XkbSARedirectSetVMods</function></primary></indexterm>
3367<funcsynopsis id="XkbSARedirectSetVMods">
3368  <funcprototype>
3369    <funcdef>void <function>XkbSARedirectSetVMods</function></funcdef>
3370<!-- (
3371<parameter>act, vm</parameter>
3372)                              /* macro */ -->
3373
3374    <paramdef>XkbRedirectKeyAction <parameter>act</parameter></paramdef>
3375    <paramdef>unsigned int <parameter>v</parameter></paramdef>
3376  </funcprototype>
3377</funcsynopsis>
3378<variablelist>
3379  <varlistentry>
3380    <term>
3381      <parameter>act</parameter>
3382    </term>
3383    <listitem>
3384      <para>
3385        action in which to set vmods
3386      </para>
3387    </listitem>
3388  </varlistentry>
3389  <varlistentry>
3390    <term>
3391      <parameter>v</parameter>
3392    </term>
3393    <listitem>
3394      <para>
3395        new value for virtual modifiers
3396      </para>
3397    </listitem>
3398  </varlistentry>
3399</variablelist>
3400<para>
3401     <function>XkbSARedirectSetVModsMask</function> sets the <structfield>vmods0</structfield>
3402     and <structfield>vmods1</structfield> of <parameter>act</parameter> from <parameter>v</parameter>.
3403</para>
3404
3405</sect2>
3406<sect2 id='Actions_for_Generating_DeviceButtonPress_and_DeviceButtonRelease'>
3407<title>Actions for Generating DeviceButtonPress and DeviceButtonRelease</title>
3408<indexterm significance="preferred" zone="Actions_for_Generating_DeviceButtonPress_and_DeviceButtonRelease">
3409<primary><structname>XkbDeviceBtnAction</structname></primary></indexterm>
3410
3411<para>
3412Actions associated with
3413<structname>XkbDeviceBtnAction</structname>
3414structures generate
3415<symbol>DeviceButtonPress</symbol>
3416and
3417<symbol>DeviceButtonRelease</symbol>
3418events instead of normal
3419<symbol>KeyPress</symbol>
3420and
3421<symbol>KeyRelease</symbol>
3422events:
3423
3424<programlisting>
3425typedef struct _XkbDeviceBtnAction {
3426    unsigned char    type;      /* <symbol>XkbSA_DeviceBtn</symbol>, <symbol>XkbSA_LockDeviceBtn</symbol> */
3427    unsigned char    flags;     /* with <structfield>type</structfield>, specifies locking or unlocking */
3428    unsigned char    count;     /* controls number of DeviceButtonPress
3429                                   and Release events */
3430    unsigned char    button;    /* index of button on <structfield>device</structfield> */
3431    unsigned char    device;    /* device ID of an X input extension device */
3432} <structname>XkbDeviceBtnAction</structname>;
3433</programlisting></para>
3434
3435<para>
3436The
3437<structfield>type</structfield>
3438field can have any one of the values shown in
3439<link linkend="table16.17">Table 16.17</link>.
3440</para>
3441
3442<table id='table16.17' frame='topbot'>
3443<title>Device Button Action Types</title>
3444<?dbfo keep-together="always" ?>
3445<tgroup cols='2' align='left' colsep='0' rowsep='0'>
3446<colspec colname='c1' colwidth='1.0*'/>
3447<colspec colname='c2' colwidth='2.0*'/>
3448<thead>
3449<row rowsep='1'>
3450  <entry>Type</entry>
3451  <entry>Effect</entry>
3452</row>
3453</thead>
3454<tbody>
3455  <row>
3456    <entry><symbol>XkbSA_DeviceBtn</symbol></entry>
3457    <entry>
3458<itemizedlist>
3459  <listitem>
3460    <para>
3461If the button specified by this action is logically down, the key press and
3462corresponding release are ignored and have no effect. If the device or button
3463specified by this action are illegal, this action behaves like
3464<symbol>XkbSA_NoAction</symbol>.
3465    </para>
3466  </listitem>
3467  <listitem>
3468    <para>
3469Otherwise, key presses cause one or more input extension device events instead
3470of the usual key press event. If the
3471<structfield>count</structfield>
3472field is zero, a key press generates a single
3473<symbol>DeviceButtonPress</symbol>
3474event. If count is greater than zero, a key press event generates
3475<structfield>count</structfield>
3476pairs of
3477<symbol>DeviceButtonPress</symbol>
3478and
3479<symbol>DeviceButtonRelease</symbol>
3480events.
3481    </para>
3482  </listitem>
3483  <listitem>
3484    <para>
3485If
3486<structfield>count</structfield>
3487is zero, a key release generates an input extension
3488<symbol>DeviceButtonRelease</symbol>
3489event that matches the event generated by the corresponding key press. If
3490<structfield>count</structfield>
3491is nonzero, a key release does not cause a
3492<symbol>DeviceButtonRelease</symbol>
3493event. Key releases never cause
3494<symbol>KeyRelease</symbol>
3495events.
3496    </para>
3497  </listitem>
3498</itemizedlist>
3499    </entry>
3500  </row>
3501  <row>
3502    <entry><symbol>XkbSA_LockDeviceBtn</symbol></entry>
3503    <entry>
3504<itemizedlist>
3505  <listitem>
3506    <para>
3507If the device or button specified by this action are illegal, this action
3508behaves like <symbol>XkbSA_NoAction</symbol>.
3509    </para>
3510  </listitem>
3511  <listitem>
3512    <para>
3513Otherwise, if the specified button is not locked and the
3514<symbol>XkbSA_LockNoLock</symbol>
3515bit is not set in the
3516<structfield>flags</structfield>
3517field, a key press generates an input extension
3518<symbol>DeviceButtonPress</symbol>
3519event instead of a
3520<symbol>KeyPress</symbol>
3521event and locks the button. If the button is already locked or if
3522<symbol>XkbSA_LockNoLock</symbol>
3523bit is set in the
3524<structfield>flags</structfield>
3525field, the key press is ignored and has no effect.
3526    </para>
3527  </listitem>
3528  <listitem>
3529    <para>
3530If the corresponding key press was ignored, and if the
3531<symbol>XkbSA_LockNoUnlock</symbol>
3532bit is not set in the
3533<structfield>flags</structfield>
3534field, a key release generates an input extension
3535<symbol>DeviceButtonRelease</symbol>
3536event instead of a
3537<symbol>KeyRelease</symbol>
3538event and unlocks the button. If the corresponding key press locked a button,
3539the key release is ignored and has no effect.
3540    </para>
3541  </listitem>
3542</itemizedlist>
3543    </entry>
3544  </row>
3545</tbody>
3546</tgroup>
3547</table>
3548
3549<para>
3550The
3551<structfield>flags</structfield>
3552field is composed of the bitwise inclusive OR of the masks shown in
3553<link linkend="table16.18">Table 16.18</link>.
3554</para>
3555
3556<table id='table16.18' frame='topbot'>
3557<title>Device Button Action Flags</title>
3558<?dbfo keep-together="always" ?>
3559<tgroup cols='2' align='left' colsep='0' rowsep='0'>
3560<colspec colname='c1' colwidth='1.0*'/>
3561<colspec colname='c2' colwidth='2.0*'/>
3562<thead>
3563<row rowsep='1'>
3564  <entry>Flag</entry>
3565  <entry>Meaning</entry>
3566</row>
3567</thead>
3568<tbody>
3569  <row>
3570    <entry><symbol>XkbSA_LockNoLock</symbol></entry>
3571    <entry>
3572If set, and the action type is
3573<symbol>XkbSA_LockDeviceBtn</symbol>,
3574the server only unlocks the button.
3575    </entry>
3576  </row>
3577  <row>
3578    <entry><symbol>XkbSA_LockNoUnlock</symbol></entry>
3579    <entry>
3580If set, and the action type is
3581<symbol>XkbSA_LockDeviceBtn</symbol>,
3582the server only locks the button.
3583    </entry>
3584  </row>
3585</tbody>
3586</tgroup>
3587</table>
3588
3589</sect2>
3590<sect2 id='Actions_for_Simulating_Events_from_Device_Valuators'>
3591<title>Actions for Simulating Events from Device Valuators</title>
3592<indexterm significance="preferred" zone="Actions_for_Simulating_Events_from_Device_Valuators">
3593<primary><structname>XkbDeviceValuatorAction</structname></primary></indexterm>
3594
3595<para>
3596A
3597<firstterm>valuator</firstterm>
3598<indexterm significance="preferred" zone="Actions_for_Simulating_Events_from_Device_Valuators">
3599<primary>valuator</primary></indexterm>
3600manipulates a range of values for some entity, like a mouse axis, a slider or
3601a dial. Actions associated with
3602<structname>XkbDeviceValuatorAction</structname>
3603structures are used to simulate events from one or two input extension device
3604valuators.
3605</para>
3606
3607<para><programlisting>
3608typedef struct _XkbDeviceValuatorAction {
3609    unsigned char    type;        /* <symbol>XkbSA_DeviceValuator</symbol> */
3610    unsigned char    device;      /* device ID */
3611    unsigned char    v1_what;     /* determines how valuator is
3612                                     to behave for valuator 1 */
3613    unsigned char    v1_ndx;      /* specifies a real valuator */
3614    unsigned char    v1_value;    /* the value for valuator 1 */
3615    unsigned char    v2_what;     /* determines how valuator is
3616                                     to behave for valuator 2 */
3617    unsigned char    v2_ndx;      /* specifies a real valuator */
3618    unsigned char    v2_value;    /* the value for valuator 1 */
3619} <structname>XkbDeviceValuatorAction</structname>;
3620</programlisting></para>
3621
3622<para>
3623If
3624<structfield>device</structfield>
3625is illegal or if neither
3626<structfield>v1_ndx</structfield>
3627nor
3628<structfield>v2_ndx</structfield>
3629specifies a legal valuator, this action behaves like
3630<symbol>XkbSA_NoAction</symbol>.
3631</para>
3632
3633
3634<para>
3635The low four bits of
3636<structfield>v1_what</structfield>
3637and
3638<structfield>v2_what</structfield>
3639specify the corresponding scale value (denoted
3640<structfield>val&lt;n&gt;Scale</structfield>
3641in <link linkend="table16.17">Table 16.17</link>), if needed.
3642The high four bits of
3643<structfield>v1_what</structfield>
3644and
3645<structfield>v2_what</structfield>
3646specify the operation to perform to set the values. The high four bits of
3647<structfield>v1_what</structfield>
3648and
3649<structfield>v2_what</structfield>
3650can have the values shown in <link linkend="table16.17">Table 16.17</link>;
3651the use of
3652<structfield>val&lt;n&gt;Scale</structfield>
3653is shown in that table also.
3654</para>
3655
3656<table id='table16.19' frame='topbot'>
3657<title>Device Valuator v&lt;n&gt;_what High Bits Values</title>
3658<?dbfo keep-together="always" ?>
3659<tgroup cols='2' align='left' colsep='0' rowsep='0'>
3660<colspec colname='c1' colwidth='1.0*'/>
3661<colspec colname='c2' colwidth='2.0*'/>
3662<thead>
3663<row rowsep='1'>
3664  <entry>Value of high bits</entry>
3665  <entry>Effect</entry>
3666</row>
3667</thead>
3668<tbody>
3669  <row>
3670    <entry><symbol>XkbSA_IgnoreVal</symbol></entry>
3671    <entry>No action</entry>
3672  </row>
3673  <row>
3674    <entry><symbol>XkbSA_SetValMin</symbol></entry>
3675    <entry>
3676<structfield>v&lt;n&gt;_value</structfield> is set to its minimum legal value.
3677    </entry>
3678  </row>
3679  <row>
3680    <entry><symbol>XkbSA_SetValCenter</symbol></entry>
3681    <entry>
3682<structfield>v&lt;n&gt;_value</structfield>is centered (to (max-min)/2).
3683    </entry>
3684  </row>
3685  <row>
3686    <entry><symbol>XkbSA_SetValMax</symbol></entry>
3687    <entry>
3688<structfield>v&lt;n&gt;_value</structfield> is set to its maximum legal value.
3689    </entry>
3690  </row>
3691  <row>
3692    <entry><symbol>XkbSA_SetValRelative</symbol></entry>
3693    <entry>
3694<structfield>v&lt;n&gt;_value</structfield> * (2
3695<structfield>val&lt;n&gt;Scale</structfield>) is added to
3696<structfield>v&lt;n&gt;_value</structfield>.
3697    </entry>
3698  </row>
3699  <row>
3700    <entry><symbol>XkbSA_SetValAbsolute</symbol></entry>
3701    <entry>
3702<structfield>v&lt;n&gt;_value</structfield>
3703is set to (2 <structfield>val&lt;n&gt;Scale</structfield>).
3704    </entry>
3705  </row>
3706</tbody>
3707</tgroup>
3708</table>
3709
3710<para>
3711Illegal values for
3712<symbol>XkbSA_SetValRelative</symbol>
3713or
3714<symbol>XkbSA_SetValAbsolute</symbol>
3715are clamped into range. Note that all of these possibilities are legal for
3716absolute valuators. For relative valuators, only
3717<symbol>XkbSA_SetValRelative</symbol>
3718is permitted. Part of the input extension description of a device is the range
3719of legal values for all absolute valuators, whence the maximum and minimum
3720legal values shown in <link linkend="table16.17">Table 16.17</link>.
3721</para>
3722
3723
3724<para>
3725The following two masks are provided as a convenience to select either portion
3726of
3727<structfield>v1_what</structfield>
3728or
3729<structfield>v2_what</structfield>:
3730
3731<programlisting>
3732#define XkbSA_ValOpMask         (0x70)
3733#define XkbSA_ValScaleMask      (0x07)
3734</programlisting>
3735</para>
3736
3737<para>
3738<structfield>v1_ndx</structfield>
3739and
3740<structfield>v2_ndx</structfield>
3741specify valuators that actually exists. For example, most mice have two
3742valuators (x and y axes) so the only legal values for a mouse would be 0 and 1.
3743For a dial box with eight dials, any value in the range 0..7 would be correct.
3744</para>
3745
3746
3747</sect2>
3748<sect2 id='Obtaining_Key_Actions_for_Keys_from_the_Server'>
3749<title>Obtaining Key Actions for Keys from the Server</title>
3750
3751<para>
3752To update the actions (the
3753<structfield>key_acts</structfield>
3754array) for a subset of the keys in a keyboard description, use
3755<function>XkbGetKeyActions</function>.
3756</para>
3757
3758<indexterm significance="preferred" zone="XkbGetKeyActions"><primary><function>XkbGetKeyActions</function></primary></indexterm>
3759<funcsynopsis id="XkbGetKeyActions">
3760  <funcprototype>
3761    <funcdef>Status <function>XkbGetKeyActions</function></funcdef>
3762<!-- (
3763<parameter>dpy</parameter>,
3764<parameter>first</parameter>,
3765<parameter>num</parameter>,
3766<parameter>xkb</parameter>
3767) -->
3768
3769    <paramdef>Display *<parameter>dpy</parameter></paramdef>
3770    <paramdef>unsigned int <parameter>first</parameter></paramdef>
3771    <paramdef>unsigned int <parameter>num</parameter></paramdef>
3772    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
3773  </funcprototype>
3774</funcsynopsis>
3775<variablelist>
3776  <varlistentry>
3777    <term>
3778      <parameter>dpy</parameter>
3779    </term>
3780    <listitem>
3781      <para>
3782        connection to X server
3783      </para>
3784    </listitem>
3785  </varlistentry>
3786  <varlistentry>
3787    <term>
3788      <parameter>first</parameter>
3789    </term>
3790    <listitem>
3791      <para>
3792        keycode of first key of interest
3793      </para>
3794    </listitem>
3795  </varlistentry>
3796  <varlistentry>
3797    <term>
3798      <parameter>num</parameter>
3799    </term>
3800    <listitem>
3801      <para>
3802        number of keys desired
3803      </para>
3804    </listitem>
3805  </varlistentry>
3806  <varlistentry>
3807    <term>
3808      <parameter>xkb</parameter>
3809    </term>
3810    <listitem>
3811      <para>
3812        pointer to keyboard description where result is stored
3813      </para>
3814    </listitem>
3815  </varlistentry>
3816</variablelist>
3817
3818<para>
3819<function>XkbGetKeyActions</function>
3820sends a request to the server to obtain the actions for
3821<parameter>num</parameter>
3822keys on the keyboard starting with key
3823<parameter>first</parameter>.
3824It waits for a reply and returns the actions in the
3825<structfield>server</structfield>-&gt;<structfield>key_acts</structfield>
3826field of
3827<parameter>xkb</parameter>.
3828If successful,
3829<function>XkbGetKeyActions</function>
3830returns
3831<symbol>Success</symbol>.
3832The
3833<parameter>xkb</parameter>
3834parameter must be a pointer to a valid Xkb keyboard description.
3835</para>
3836
3837
3838<para>
3839If the
3840<structfield>server</structfield>
3841map in the
3842<parameter>xkb</parameter>
3843parameter has not been allocated,
3844<function>XkbGetKeyActions</function>
3845allocates and initializes it before obtaining the actions.
3846</para>
3847
3848
3849<para>
3850If the server does not have a compatible version of Xkb, or the Xkb extension
3851has not been properly initialized,
3852<function>XkbGetKeyActions</function>
3853returns
3854<errorname>BadAccess</errorname>.
3855If
3856<parameter>num</parameter>
3857is less than 1 or greater than
3858<symbol>XkbMaxKeyCount</symbol>,
3859<function>XkbGetKeyActions</function>
3860returns
3861<errorname>BadValue</errorname>.
3862If any allocation errors occur,
3863<function>XkbGetKeyActions</function>
3864returns
3865<errorname>BadAlloc</errorname>.
3866</para>
3867
3868
3869</sect2>
3870<sect2 id='Changing_the_Number_of_Actions_Bound_to_a_Key'>
3871<title>Changing the Number of Actions Bound to a Key</title>
3872
3873<para>
3874To change the number of actions bound to a key, use
3875<function>XkbResizeKeyActions</function>.
3876</para>
3877
3878<indexterm significance="preferred" zone="XkbResizeKeyActions"><primary><function>XkbResizeKeyActions</function></primary></indexterm>
3879<funcsynopsis id="XkbResizeKeyActions">
3880  <funcprototype>
3881    <funcdef>XkbAction *<function>XkbResizeKeyActions</function></funcdef>
3882<!-- (
3883<parameter>xkb</parameter>,
3884<parameter>key</parameter>,
3885<parameter>needed</parameter>
3886) -->
3887
3888    <paramdef>XkbDescRec *<parameter>xkb</parameter></paramdef>
3889    <paramdef>int <parameter>key</parameter></paramdef>
3890    <paramdef>int <parameter>needed</parameter></paramdef>
3891  </funcprototype>
3892</funcsynopsis>
3893<variablelist>
3894  <varlistentry>
3895    <term>
3896      <parameter>xkb</parameter>
3897    </term>
3898    <listitem>
3899      <para>
3900        keyboard description to change
3901      </para>
3902    </listitem>
3903  </varlistentry>
3904  <varlistentry>
3905    <term>
3906      <parameter>key</parameter>
3907    </term>
3908    <listitem>
3909      <para>
3910        keycode of key to change
3911      </para>
3912    </listitem>
3913  </varlistentry>
3914  <varlistentry>
3915    <term>
3916      <parameter>needed</parameter>
3917    </term>
3918    <listitem>
3919      <para>
3920        new number of actions required
3921      </para>
3922    </listitem>
3923  </varlistentry>
3924</variablelist>
3925
3926<para>
3927The
3928<parameter>xkb</parameter>
3929parameter points to the keyboard description containing the
3930<parameter>key</parameter>
3931whose number of actions is to be changed. The
3932<parameter>key</parameter>
3933parameter is the keycode of the key to change, and
3934<parameter>needed</parameter>
3935specifies the new number of actions required for the key.
3936</para>
3937
3938
3939<para>
3940<function>XkbResizeKeyActions</function>
3941reserves the space needed for the actions and returns a pointer to the
3942beginning of the new array that holds the actions. It can change the
3943<structfield>acts</structfield>,
3944<structfield>num_acts</structfield>,
3945and
3946<structfield>size_acts</structfield>
3947fields of
3948<parameter>xkb</parameter>-&gt;<structfield>server</structfield>
3949if it is necessary to reallocate the
3950<structfield>acts</structfield>
3951array.
3952</para>
3953
3954
3955<para>
3956If
3957<parameter>needed</parameter>
3958is greater than the current number of keysyms for the key,
3959<function>XkbResizeKeyActions</function>
3960initializes all new actions in the array to
3961<emphasis>NoAction</emphasis>.
3962</para>
3963
3964
3965<para>
3966Because the number of actions needed by a key is normally computed as width *
3967number of groups, and
3968<function>XkbResizeKeyActions</function>
3969does not modify either the width or number of groups for the key, a
3970discrepancy exists on return from
3971<function>XkbResizeKeyActions</function>
3972between the space allocated for the actions and the number required. The
3973unused entries in the list of actions returned by
3974<function>XkbResizeKeyActions</function>
3975are not preserved across future calls to any of the map editing functions, so
3976you must update the key actions (which updates the width and number of groups
3977for the key) before calling another allocator function. A call to
3978<function>XkbChangeTypesOfKey</function>
3979updates these.
3980</para>
3981
3982
3983<para>
3984If any allocation errors occur while resizing the number of actions bound to
3985the key,
3986<function>XkbResizeKeyActions</function>
3987returns
3988<symbol>NULL</symbol>.
3989</para>
3990
3991<note><para>A change to the number of actions bound to a key should be
3992accompanied by a change in the number of symbols bound to a key. Refer to
3993<link linkend="Changing_the_Number_of_Symbols_Bound_to_a_Key">section 15.3.7</link> for more information on changing the number of symbols bound to
3994a key.</para></note>
3995
3996
3997</sect2>
3998</sect1>
3999<sect1 id='Key_Behavior'>
4000<title>Key Behavior</title>
4001
4002<para>
4003Key behavior refers to the demeanor of a key. For example, the expected
4004behavior of the
4005<keycap>CapsLock</keycap>
4006key is that it logically locks when pressed, and then logically unlocks when
4007pressed again.
4008</para>
4009
4010
4011<sect2 id='Radio_Groups_2'>
4012<title>Radio Groups</title>
4013
4014<para>
4015Keys that belong to the same radio group have the
4016<symbol>XkbKB_RadioGroup</symbol>
4017type in the
4018<structfield>type</structfield>
4019field and the radio group index specified in the
4020<structfield>data</structfield>
4021field in the
4022<structname>XkbBehavior</structname>
4023structure. If the radio group has a name in the
4024<structname>XkbNamesRec</structname>
4025structure, the radio group index is the index into the
4026<structfield>radio_group</structfield>
4027array in the
4028<structname>XkbNamesRec</structname>
4029structure. A radio group key when pressed stays logically down until another
4030key in the radio group is pressed, when the first key becomes logically up and
4031the new key becomes logically down. Setting the
4032<symbol>XkbKB_RGAllowNone</symbol>
4033bit in the behavior for all of the keys of the radio group means that pressing
4034the logically down member of the radio group causes it to logically release, in
4035which case none of the keys of the radio group would be logically down. If
4036<symbol>XkbKB_RGAllowNone</symbol>
4037is not set, there is no way to release the logically down member of the group.
4038</para>
4039
4040
4041<para>
4042The low five bits of the
4043<structfield>data</structfield>
4044field of the
4045<structname>XkbBehavior</structname>
4046structure are the group number, the high three bits are flags. The only flag
4047currently defined is:
4048
4049<programlisting>
4050#define      XkbKB_RGAllowNone      0x80
4051</programlisting></para>
4052
4053</sect2>
4054<sect2 id='The_XkbBehavior_Structure'>
4055<title>The XkbBehavior Structure</title>
4056<indexterm significance="preferred" zone="The_XkbBehavior_Structure">
4057<primary><structname>XkbBehavior</structname></primary></indexterm>
4058
4059<para>
4060The
4061<structfield>behaviors</structfield>
4062field of the server map is an array of
4063<structname>XkbBehavior</structname>
4064structures, indexed by keycode, and contains the behavior for each key. The
4065<structname>XkbBehavior</structname>
4066structure is defined as follows:
4067
4068<programlisting>
4069typedef struct _XkbBehavior {
4070    unsigned char  type;              /* behavior type + optional
4071                                         <symbol>XkbKB_Permanent</symbol> bit */
4072    unsigned char  data;
4073} <structname>XkbBehavior</structname>;
4074</programlisting></para>
4075
4076<para>
4077The
4078<structfield>type</structfield>
4079field specifies the Xkb behavior, and the value of the
4080<structfield>data</structfield>
4081field depends on the
4082<structfield>type</structfield>.
4083Xkb supports the key behaviors shown in
4084<link linkend="table16.20">Table 16.20</link>.
4085</para>
4086
4087<table id='table16.20' frame='topbot'>
4088<title>Key Behaviors</title>
4089<?dbfo keep-together="always" ?>
4090<tgroup cols='2' align='left' colsep='0' rowsep='0'>
4091<colspec colname='c1' colwidth='1.0*'/>
4092<colspec colname='c2' colwidth='2.0*'/>
4093<thead>
4094<row rowsep='1'>
4095  <entry>Type</entry>
4096  <entry>Effect</entry>
4097</row>
4098</thead>
4099<tbody>
4100  <row>
4101    <entry><symbol>XkbKB_Default</symbol></entry>
4102    <entry>
4103Press and release events are processed normally. The
4104<structfield>data</structfield>
4105field is unused.
4106    </entry>
4107  </row>
4108  <row>
4109    <entry><symbol>XkbKB_Lock</symbol></entry>
4110    <entry>
4111If a key is logically up (that is, the corresponding bit of the core key map is
4112cleared) when it is pressed, the key press is processed normally and the
4113corresponding release is ignored. If the key is logically down when pressed,
4114the key press is ignored but the corresponding release is processed normally.
4115The
4116<structfield>data</structfield>
4117field is unused.
4118    </entry>
4119  </row>
4120  <row>
4121    <entry><symbol>XkbKB_RadioGroup</symbol></entry>
4122    <entry>
4123      <para>
4124If another member of the radio group is logically down (all members of the
4125radio group have the same index, specified in
4126<structfield>data</structfield>)
4127when a key is pressed, the server synthesizes a key release for the member
4128that is logically down and then processes the new key press event normally.
4129      </para>
4130      <para>
4131If the key itself is logically down when pressed, the key press event is
4132ignored, but the processing of the corresponding key release depends on the
4133value of the
4134<symbol>XkbKB_RGAllowNone</symbol>
4135bit in
4136<structfield>flags</structfield>.
4137If it is set, the key release is processed normally; otherwise, the key
4138release is also ignored.
4139      </para>
4140      <para>
4141All other key release events are ignored.
4142      </para>
4143    </entry>
4144  </row>
4145  <row>
4146    <entry><symbol>XkbKB_Overlay1</symbol></entry>
4147    <entry>
4148If the
4149<emphasis>Overlay1</emphasis>
4150control is enabled (see <link linkend="Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls">section 10.4</link>),
4151<structfield>data</structfield>
4152is interpreted as a keycode, and events from this key are reported as if they
4153came from
4154<structfield>data</structfield>’s
4155keycode. Otherwise, press and release events are processed normally.
4156    </entry>
4157  </row>
4158  <row>
4159    <entry><symbol>XkbKB_Overlay2</symbol></entry>
4160    <entry>
4161If the
4162<emphasis>Overlay2</emphasis>
4163control is enabled (see <link linkend="Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls">section 10.4</link>),
4164<structfield>data</structfield>
4165is interpreted as a keycode, and events from this key are reported as if they
4166came from
4167<structfield>data</structfield>’s
4168keycode. Otherwise, press and release events are processed normally.
4169    </entry>
4170  </row>
4171</tbody>
4172</tgroup>
4173</table>
4174
4175<para>
4176Xkb also provides the mask,
4177<symbol>XkbKB_Permanent</symbol>
4178to specify whether the key behavior type should be simulated by Xkb or whether
4179the key behavior describes an unalterable physical, electrical, or software
4180aspect of the keyboard. If the
4181<symbol>XkbKB_Permanent</symbol>
4182bit is not set in the
4183<structfield>type</structfield>
4184field, Xkb simulates the behavior in software. Otherwise, Xkb relies upon the
4185keyboard to implement the behavior.
4186</para>
4187
4188
4189</sect2>
4190<sect2 id='Obtaining_Key_Behaviors_for_Keys_from_the_Server'>
4191<title>Obtaining Key Behaviors for Keys from the Server</title>
4192
4193<para>
4194To obtain the behaviors (the
4195<structfield>behaviors</structfield>
4196array) for a subset of the keys in a keyboard description from the server, use
4197<function>XkbGetKeyBehaviors</function>:
4198
4199</para>
4200
4201<indexterm significance="preferred" zone="XkbGetKeyBehaviors"><primary><function>XkbGetKeyBehaviors</function></primary></indexterm>
4202<funcsynopsis id="XkbGetKeyBehaviors">
4203  <funcprototype>
4204    <funcdef>Status <function>XkbGetKeyBehaviors</function></funcdef>
4205<!-- (
4206<parameter>dpy</parameter>,
4207<parameter>first</parameter>,
4208<parameter>num</parameter>,
4209<parameter>xkb</parameter>
4210) -->
4211
4212    <paramdef>Display *<parameter>dpy</parameter></paramdef>
4213    <paramdef>unsigned int <parameter>first</parameter></paramdef>
4214    <paramdef>unsigned int <parameter>num</parameter></paramdef>
4215    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
4216  </funcprototype>
4217</funcsynopsis>
4218<variablelist>
4219  <varlistentry>
4220    <term>
4221      <parameter>dpy</parameter>
4222    </term>
4223    <listitem>
4224      <para>
4225        connection to server
4226      </para>
4227    </listitem>
4228  </varlistentry>
4229  <varlistentry>
4230    <term>
4231      <parameter>first</parameter>
4232    </term>
4233    <listitem>
4234      <para>
4235        keycode of first key to get
4236      </para>
4237    </listitem>
4238  </varlistentry>
4239  <varlistentry>
4240    <term>
4241      <parameter>num</parameter>
4242    </term>
4243    <listitem>
4244      <para>
4245        number of keys for which behaviors are desired
4246      </para>
4247    </listitem>
4248  </varlistentry>
4249  <varlistentry>
4250    <term>
4251      <parameter>xkb</parameter>
4252    </term>
4253    <listitem>
4254      <para>
4255        Xkb description to contain the result
4256      </para>
4257    </listitem>
4258  </varlistentry>
4259</variablelist>
4260
4261<para>
4262<function>XkbGetKeyBehaviors</function>
4263sends a request to the server to obtain the behaviors for
4264<parameter>num</parameter>
4265keys on the keyboard starting with the key whose keycode is
4266<parameter>first</parameter>.
4267It waits for a reply and returns the behaviors in the
4268<structfield>server</structfield>-&gt;<structfield>behaviors</structfield>
4269field of
4270<parameter>xkb</parameter>.
4271If successful,
4272<function>XkbGetKeyBehaviors</function>
4273returns
4274<symbol>Success</symbol>.
4275</para>
4276
4277
4278<para>
4279If the
4280<structfield>server</structfield>
4281map in the
4282<parameter>xkb</parameter>
4283parameter has not been allocated,
4284<function>XkbGetKeyBehaviors</function>
4285allocates and initializes it before obtaining the actions.
4286</para>
4287
4288
4289<para>
4290If the server does not have a compatible version of Xkb, or the Xkb extension
4291has not been properly initialized,
4292<function>XkbGetKeyBehaviors</function>
4293returns
4294<errorname>BadAccess</errorname>.
4295If
4296<parameter>num</parameter>
4297is less than 1 or greater than
4298<symbol>XkbMaxKeyCount</symbol>,
4299<function>XkbGetKeyBehaviors</function>
4300returns
4301<errorname>BadValue</errorname>.
4302If any allocation errors occur,
4303<function>XkbGetKeyBehaviors</function>
4304returns
4305<errorname>BadAlloc</errorname>.
4306</para>
4307
4308
4309</sect2>
4310</sect1>
4311<sect1 id='Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server'>
4312<title>Explicit Components—Avoiding Automatic Remapping by the Server</title>
4313
4314<para>
4315Whenever a client remaps the keyboard using core protocol requests, Xkb
4316examines the map to determine likely default values for the components that
4317cannot be specified using the core protocol (see <link linkend="Core_Keyboard_Mapping_to_Xkb_Keyboard_Mapping_Transformation">section 17.1.2</link> for more
4318information on how Xkb chooses the default values).
4319</para>
4320
4321
4322<para>
4323This automatic remapping might replace definitions explicitly requested by an
4324application, so the Xkb keyboard description defines an explicit components
4325mask for each key. Any aspects of the automatic remapping listed in the
4326explicit components mask for a key are not changed by the automatic keyboard
4327mapping.
4328</para>
4329
4330
4331<para>
4332The explicit components masks are held in the
4333<structfield>explicit</structfield>
4334field of the server map, which is an array indexed by keycode. Each entry in
4335this array is a mask that is a bitwise inclusive OR of the values shown in
4336<link linkend="table16.21">Table 16.21</link>.
4337</para>
4338
4339<table id='table16.21' frame='topbot'>
4340<title>Explicit Component Masks</title>
4341<?dbfo keep-together="always" ?>
4342<tgroup cols='3' align='left' colsep='0' rowsep='0'>
4343<colspec colname='c1' colwidth='1.0*'/>
4344<colspec colname='c2' colwidth='1.0*'/>
4345<colspec colname='c3' colwidth='2.0*'/>
4346<thead>
4347<row rowsep='1'>
4348  <entry>Bit in Explicit Mask</entry>
4349  <entry>Value</entry>
4350  <entry>Protects Against</entry>
4351</row>
4352</thead>
4353<tbody>
4354  <row>
4355    <entry><emphasis>ExplicitKeyType1</emphasis></entry>
4356    <entry>(1&lt;&lt;0)</entry>
4357    <entry>
4358Automatic determination of the key type associated with
4359<emphasis>Group1</emphasis>.
4360    </entry>
4361  </row>
4362  <row>
4363    <entry><emphasis>ExplicitKeyType2</emphasis></entry>
4364    <entry>(1&lt;&lt;1)</entry>
4365    <entry>
4366Automatic determination of the key type associated with
4367<emphasis>Group2</emphasis>.
4368    </entry>
4369  </row>
4370  <row>
4371    <entry><emphasis>ExplicitKeyType3</emphasis></entry>
4372    <entry>(1&lt;&lt;2)</entry>
4373    <entry>
4374Automatic determination of the key type associated with
4375<emphasis>Group3</emphasis>.
4376    </entry>
4377  </row>
4378  <row>
4379    <entry><emphasis>ExplicitKeyType4</emphasis></entry>
4380    <entry>(1&lt;&lt;3)</entry>
4381    <entry>
4382Automatic determination of the key type associated with
4383<emphasis>Group4</emphasis>.
4384    </entry>
4385  </row>
4386  <row>
4387    <entry><emphasis>ExplicitInterpret</emphasis></entry>
4388    <entry>(1&lt;&lt;4)</entry>
4389    <entry>
4390Application of any of the fields of a symbol interpretation to the
4391key in question.
4392    </entry>
4393  </row>
4394  <row>
4395    <entry><emphasis>ExplicitAutoRepeat</emphasis></entry>
4396    <entry>(1&lt;&lt;5)</entry>
4397    <entry>Automatic determination of auto-repeat status for the key, as
4398specified in a symbol interpretation.</entry>
4399  </row>
4400  <row>
4401    <entry><emphasis>ExplicitBehavior</emphasis></entry>
4402    <entry>(1&lt;&lt;6)</entry>
4403    <entry>
4404Automatic assignment of the
4405<symbol>XkbKB_Lock</symbol>
4406behavior to the key, if the
4407<symbol>XkbSI_LockingKey</symbol>
4408flag is set in a symbol interpretation.
4409    </entry>
4410  </row>
4411  <row>
4412    <entry><emphasis>ExplicitVModMap</emphasis></entry>
4413    <entry>(1&lt;&lt;7)</entry>
4414    <entry>
4415Automatic determination of the virtual modifier map for the key
4416based on the actions assigned to the key and the symbol interpretations that
4417match the key.
4418    </entry>
4419  </row>
4420</tbody>
4421</tgroup>
4422</table>
4423
4424<sect2 id='Obtaining_Explicit_Components_for_Keys_from_the_Server'>
4425<title>Obtaining Explicit Components for Keys from the Server</title>
4426
4427<para>
4428To obtain the explicit components (the
4429<structfield>explicit</structfield>
4430array) for a subset of the keys in a keyboard description, use
4431<function>XkbGetKeyExplicitComponents</function>.
4432</para>
4433
4434<indexterm significance="preferred" zone="XkbGetKeyExplicitComponents"><primary><function>XkbGetKeyExplicitComponents</function></primary></indexterm>
4435<funcsynopsis id="XkbGetKeyExplicitComponents">
4436  <funcprototype>
4437    <funcdef>Status <function>XkbGetKeyExplicitComponents</function></funcdef>
4438<!-- (
4439<parameter>dpy</parameter>,
4440<parameter>first</parameter>,
4441<parameter>num</parameter>,
4442<parameter>xkb</parameter>
4443) -->
4444
4445    <paramdef>Display *<parameter>dpy</parameter></paramdef>
4446    <paramdef>unsigned int <parameter>first</parameter></paramdef>
4447    <paramdef>unsigned int <parameter>num</parameter></paramdef>
4448    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
4449  </funcprototype>
4450</funcsynopsis>
4451<variablelist>
4452  <varlistentry>
4453    <term>
4454      <parameter>dpy</parameter>
4455    </term>
4456    <listitem>
4457      <para>
4458        connection to server
4459      </para>
4460    </listitem>
4461  </varlistentry>
4462  <varlistentry>
4463    <term>
4464      <parameter>first</parameter>
4465    </term>
4466    <listitem>
4467      <para>
4468        keycode of first key to fetch
4469      </para>
4470    </listitem>
4471  </varlistentry>
4472  <varlistentry>
4473    <term>
4474      <parameter>num</parameter>
4475    </term>
4476    <listitem>
4477      <para>
4478        number of keys for which to get explicit info
4479      </para>
4480    </listitem>
4481  </varlistentry>
4482  <varlistentry>
4483    <term>
4484      <parameter>xkb</parameter>
4485    </term>
4486    <listitem>
4487      <para>
4488        Xkb description in which to put results
4489      </para>
4490    </listitem>
4491  </varlistentry>
4492</variablelist>
4493
4494<para>
4495<function>XkbGetKeyExplicitComponents</function>
4496sends a request to the server to obtain the explicit components for
4497<parameter>num</parameter>
4498keys on the keyboard starting with key
4499<parameter>first</parameter>.
4500It waits for a reply and returns the explicit components in the
4501<structfield>server</structfield>-&gt;<structfield>explicit</structfield>
4502array of
4503<parameter>xkb</parameter>.
4504If successful,
4505<function>XkbGetKeyExplicitComponents</function>
4506returns
4507<symbol>Success</symbol>.
4508The
4509<parameter>xkb</parameter>
4510parameter must be a pointer to a valid Xkb keyboard description.
4511</para>
4512
4513
4514<para>
4515If the
4516<structfield>server</structfield>
4517map in the
4518<parameter>xkb</parameter>
4519parameter has not been allocated,
4520<function>XkbGetKeyExplicitComponents</function>
4521allocates and initializes it before obtaining the actions.
4522</para>
4523
4524
4525<para>
4526If the server does not have a compatible version of Xkb, or the Xkb extension
4527has not been properly initialized,
4528<function>XkbGetKeyExplicitComponents</function>
4529returns
4530<errorname>BadMatch</errorname>.
4531If
4532<parameter>num</parameter>
4533is less than 1 or greater than
4534<symbol>XkbMaxKeyCount</symbol>,
4535<function>XkbGetKeyExplicitComponents</function>
4536returns
4537<errorname>BadValue</errorname>.
4538If any allocation errors occur,
4539<function>XkbGetKeyExplicitComponents</function>
4540returns
4541<errorname>BadAlloc</errorname>.
4542</para>
4543
4544
4545</sect2>
4546</sect1>
4547<sect1 id='Virtual_Modifier_Mapping'>
4548<title>Virtual Modifier Mapping</title>
4549
4550<para>
4551The
4552<structfield>vmods</structfield>
4553member of the server map is a fixed-length array containing
4554<symbol>XkbNumVirtualMods</symbol>
4555entries. Each entry corresponds to a virtual modifier and provides the binding
4556of the virtual modifier to the real modifier bits. Each entry in the
4557<structfield>vmods</structfield>
4558array is a bitwise inclusive OR of the legal modifier masks:
4559</para>
4560
4561<simplelist type='vert' columns='1'>
4562     <member><symbol>ShiftMask</symbol></member>
4563     <member><symbol>LockMask</symbol></member>
4564     <member><symbol>ControlMask</symbol></member>
4565     <member><symbol>Mod1Mask</symbol></member>
4566     <member><symbol>Mod2Mask</symbol></member>
4567     <member><symbol>Mod3Mask</symbol></member>
4568     <member><symbol>Mod4Mask</symbol></member>
4569     <member><symbol>Mod5Mask</symbol></member>
4570</simplelist>
4571
4572<para>
4573The
4574<structfield>vmodmap</structfield>
4575member of the server map is similar to the
4576<structfield>modmap</structfield>
4577array of the client map (see <link linkend="The_Per_Key_Modifier_Map">section 15.4</link>), but is used to define the virtual
4578modifier mapping for each key. Like the
4579<structfield>modmap</structfield>
4580member, it is indexed by keycode, and each entry is a mask representing the
4581virtual modifiers bound to the corresponding key:
4582</para>
4583
4584<itemizedlist>
4585  <listitem>
4586    <para>
4587Each of the bits in a
4588<structfield>vmodmap</structfield>
4589entry represents an index into the
4590<structfield>vmods</structfield>
4591member. That is, bit 0 of a
4592<structfield>vmodmap</structfield>
4593entry refers to index 0 of the
4594<structfield>vmods</structfield>
4595array, bit 1 refers to index 1, and so on.
4596    </para>
4597  </listitem>
4598  <listitem>
4599    <para>
4600If a bit is set in the
4601<structfield>vmodmap</structfield>
4602entry for a key, that key is bound to the corresponding virtual modifier in
4603the
4604<structfield>vmods</structfield>
4605array.
4606    </para>
4607  </listitem>
4608</itemizedlist>
4609
4610<para>
4611The
4612<structfield>vmodmap</structfield>
4613and
4614<structfield>vmods</structfield>
4615members of the server map are the <quote>master</quote> virtual modifier definitions. Xkb
4616automatically propagates any changes to these fields to all other fields that
4617use virtual modifier mappings.
4618</para>
4619
4620
4621<para>
4622The overall relationship of fields dealing with virtual modifiers in an Xkb
4623keyboard description are shown in <link linkend="figure16.2">Figure 16.2</link>.
4624</para>
4625
4626<figure id='figure16.2'>
4627  <title>Virtual Modifier Relationships</title>
4628  <mediaobject>
4629   <imageobject> <imagedata format="SVG" fileref="XKBlib-17.svg"/>
4630   </imageobject>
4631  </mediaobject>
4632</figure>
4633
4634
4635
4636<!--
4637<H5 CLASS="Figure">
4638Virtual Modifier Relationships</H5>
4639-->
4640
4641<sect2 id='Obtaining_Virtual_Modifier_Bindings_from_the_Server'>
4642<title>Obtaining Virtual Modifier Bindings from the Server</title>
4643
4644<para>
4645To obtain a subset of the virtual modifier bindings (the
4646<structfield>vmods</structfield>
4647array) in a keyboard description, use
4648<function>XkbGetVirtualMods</function>:
4649
4650</para>
4651
4652<indexterm significance="preferred" zone="XkbGetVirtualMods"><primary><function>XkbGetVirtualMods</function></primary></indexterm>
4653<funcsynopsis id="XkbGetVirtualMods">
4654  <funcprototype>
4655    <funcdef>Status <function>XkbGetVirtualMods</function></funcdef>
4656<!-- (
4657<parameter>dpy</parameter>,
4658<parameter>which</parameter>,
4659<parameter>xkb</parameter>
4660) -->
4661
4662    <paramdef>Display *<parameter>dpy</parameter></paramdef>
4663    <paramdef>unsigned int <parameter>which</parameter></paramdef>
4664    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
4665  </funcprototype>
4666</funcsynopsis>
4667<variablelist>
4668  <varlistentry>
4669    <term>
4670      <parameter>dpy</parameter>
4671    </term>
4672    <listitem>
4673      <para>
4674        connection to server
4675      </para>
4676    </listitem>
4677  </varlistentry>
4678  <varlistentry>
4679    <term>
4680      <parameter>which</parameter>
4681    </term>
4682    <listitem>
4683      <para>
4684        mask indicating virtual modifier bindings to get
4685      </para>
4686    </listitem>
4687  </varlistentry>
4688  <varlistentry>
4689    <term>
4690      <parameter>xkb</parameter>
4691    </term>
4692    <listitem>
4693      <para>
4694        Xkb description where results will be placed
4695      </para>
4696    </listitem>
4697  </varlistentry>
4698</variablelist>
4699
4700<para>
4701<function>XkbGetVirtualMods</function>
4702sends a request to the server to obtain the
4703<structfield>vmods</structfield>
4704entries for the virtual modifiers specified in the mask,
4705<parameter>which</parameter>,
4706and waits for a reply. See <link linkend="Virtual_Modifier_Names_and_Masks">section 7.1</link> for a description of how to determine
4707the virtual modifier mask. For each bit set in
4708<parameter>which</parameter>,
4709<function>XkbGetVirtualMods</function>
4710updates the corresponding virtual modifier definition in the
4711<structfield>server-&gt;vmods</structfield>
4712array of
4713<parameter>xkb</parameter>.
4714The
4715<parameter>xkb</parameter>
4716parameter must be a pointer to a valid Xkb keyboard description. If
4717successful,
4718<function>XkbGetVirtualMods</function>
4719returns
4720<symbol>Success</symbol>.
4721</para>
4722
4723
4724<para>
4725If the
4726<structfield>server</structfield>
4727map has not been allocated in the
4728<parameter>xkb</parameter>
4729parameter,
4730<function>XkbGetVirtualMods</function>
4731allocates and initializes it before obtaining the virtual modifier bindings.
4732</para>
4733
4734
4735<para>
4736If the server does not have a compatible version of Xkb, or the Xkb extension
4737has not been properly initialized,
4738<function>XkbGetVirtualMods</function>
4739returns
4740<errorname>BadMatch</errorname>.
4741Any errors in allocation cause
4742<function>XkbGetVirtualMods</function>
4743to return
4744<errorname>BadAlloc</errorname>.
4745</para>
4746
4747
4748</sect2>
4749<sect2 id='Obtaining_Per_Key_Virtual_Modifier_Mappings_from_the_Server'>
4750<title>Obtaining Per-Key Virtual Modifier Mappings from the Server</title>
4751
4752<para>
4753To obtain the virtual modifier map (the
4754<structfield>vmodmap</structfield>
4755array) for a subset of the keys in a keyboard description, use
4756<function>XkbGetKeyVirtualModMap</function>:
4757
4758</para>
4759
4760<indexterm significance="preferred" zone="XkbGetKeyVirtualModMap"><primary><function>XkbGetKeyVirtualModMap</function></primary></indexterm>
4761<funcsynopsis id="XkbGetKeyVirtualModMap">
4762  <funcprototype>
4763    <funcdef>Status <function>XkbGetKeyVirtualModMap</function></funcdef>
4764<!-- (
4765<parameter>dpy</parameter>,
4766<parameter>first</parameter>,
4767<parameter>num</parameter>,
4768<parameter>xkb</parameter>
4769) -->
4770
4771    <paramdef>Display *<parameter>dpy</parameter></paramdef>
4772    <paramdef>unsigned int <parameter>first</parameter></paramdef>
4773    <paramdef>unsigned int <parameter>num</parameter></paramdef>
4774    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
4775  </funcprototype>
4776</funcsynopsis>
4777<variablelist>
4778  <varlistentry>
4779    <term>
4780      <parameter>dpy</parameter>
4781    </term>
4782    <listitem>
4783      <para>
4784        connection to server
4785      </para>
4786    </listitem>
4787  </varlistentry>
4788  <varlistentry>
4789    <term>
4790      <parameter>first</parameter>
4791    </term>
4792    <listitem>
4793      <para>
4794        keycode of first key to fetch
4795      </para>
4796    </listitem>
4797  </varlistentry>
4798  <varlistentry>
4799    <term>
4800      <parameter>num</parameter>
4801    </term>
4802    <listitem>
4803      <para>
4804        # keys for which virtual mod maps are desired
4805      </para>
4806    </listitem>
4807  </varlistentry>
4808  <varlistentry>
4809    <term>
4810      <parameter>xkb</parameter>
4811    </term>
4812    <listitem>
4813      <para>
4814        Xkb description where results will be placed
4815      </para>
4816    </listitem>
4817  </varlistentry>
4818</variablelist>
4819
4820<para>
4821<function>XkbGetKeyVirtualModmap</function>
4822sends a request to the server to obtain the virtual modifier mappings for
4823<parameter>num</parameter>
4824keys on the keyboard starting with key
4825<parameter>first</parameter>.
4826It waits for a reply and returns the virtual modifier mappings in the
4827<structfield>server</structfield>-&gt;<structfield>vmodmap</structfield>
4828array of
4829<parameter>xkb</parameter>.
4830If successful,
4831<function>XkbGetKeyVirtualModMap</function>
4832returns
4833<symbol>Success</symbol>.
4834The
4835<parameter>xkb</parameter>
4836parameter must be a pointer to a valid Xkb keyboard description
4837</para>
4838
4839
4840<para>
4841If the
4842<structfield>server</structfield>
4843map in the
4844<parameter>xkb</parameter>
4845parameter has not been allocated,
4846<function>XkbGetKeyVirtualModMap</function>
4847allocates and initializes it before obtaining the virtual modifier mappings.
4848</para>
4849
4850
4851<para>
4852If the server does not have a compatible version of Xkb, or the Xkb extension
4853has not been properly initialized,
4854<function>XkbGetKeyVirtualModMap</function>
4855returns
4856<errorname>BadMatch</errorname>.
4857If
4858<parameter>num</parameter>
4859is less than 1 or greater than
4860<symbol>XkbMaxKeyCount</symbol>,
4861<function>XkbGetKeyVirtualModMap</function>
4862returns
4863<errorname>BadValue</errorname>.
4864If any allocation errors occur,
4865<function>XkbGetKeyVirtualModMap</function>
4866returns
4867<errorname>BadAlloc</errorname>.
4868</para>
4869
4870</sect2>
4871</sect1>
4872</chapter>
4873