1<chapter id='Key_Event_Processing_in_the_Server'>
2<title>Key Event Processing in the Server</title>
3
4<para>
5This section describes the steps involved in processing a key event within the
6server when XKB is present. Key events can be generated due to keyboard
7activity and passed to XKB by the DDX layer, or they can be synthesized by
8another extension, such as XTEST.
9</para>
10
11<sect1 id='Applying_Global_Controls'>
12<title>Applying Global Controls</title>
13
14<para>
15When the X Keyboard Extension receives a key event, it first checks the global
16key controls to decide whether to process the event immediately or at all. The
17global key controls which might affect the event, in descending order of
18priority, are:
19</para>
20
21<itemizedlist>
22<listitem>
23  <para>If a key is pressed while the <emphasis>
24BounceKeys</emphasis>
25 control is enabled, the extension generates the event only if the key is
26active. When a key is released, the server deactivates the key and starts a
27<emphasis>
28bounce keys timer</emphasis>
29 with an interval specified by the debounce delay.
30  </para>
31  <para>
32If the bounce keys timer expires or if some other key is pressed before the
33timer expires, the server reactivates the corresponding key and deactivates the
34timer. Neither expiration nor deactivation of a bounce keys timer causes an
35event.</para>
36</listitem>
37<listitem>
38  <para>If the <emphasis>
39SlowKeys</emphasis>
40 control is enabled, the extension sets a <emphasis>
41slow keys timer</emphasis>
42 with an interval specified by the slow keys delay, but does not process the
43key event immediately. The corresponding key release deactivates this timer.
44  </para>
45  <para>
46If the slow keys timer expires, the server generates a key press for the
47corresponding key, sends an <emphasis>
48XkbAccessXNotify</emphasis>
49 and deactivates the timer.
50   </para>
51</listitem>
52<listitem>
53  <para>The extension processes key press events normally whether or not the
54<emphasis>
55RepeatKeys</emphasis>
56 control is active, but if <emphasis>
57RepeatKeys</emphasis>
58 are enabled and per-key autorepeat is enabled for the event key, the extension
59processes key press events normally, but it also initiates an <emphasis>
60autorepeat timer</emphasis>
61 with an interval specified by the autorepeat delay. The corresponding key
62release deactivates the timer.
63  </para>
64  <para>
65If the autorepeat timer expires, the server generates a key release and a key
66press for the corresponding key and reschedules the timer according to the
67autorepeat interval.
68  </para>
69</listitem>
70</itemizedlist>
71
72<para>
73Key events are processed by each global control in turn: if the <emphasis>
74BounceKeys</emphasis>
75 control accepts a key event, <emphasis>
76SlowKeys</emphasis>
77 considers it. Once <emphasis>
78SlowKeys</emphasis>
79 allows or synthesizes an event, the <emphasis>
80RepeatKeys</emphasis>
81 control acts on it.
82</para>
83
84
85</sect1>
86<sect1 id='Key_Behavior'>
87<title>Key Behavior</title>
88
89<para>
90Once an event is accepted by all of the controls or generated by a timer, the
91server checks the per-key behavior of the corresponding key. This extension
92currently defines the following key behaviors:
93</para>
94
95<informaltable frame='topbot'>
96<?dbfo keep-together="always" ?>
97<tgroup cols='2' align='left' colsep='0' rowsep='0'>
98<colspec colname='c1' colwidth='1.0*'/>
99<colspec colname='c2' colwidth='3.0*'/>
100<thead>
101  <row rowsep='1'>
102    <entry>Behavior</entry>
103    <entry>Effect</entry>
104  </row>
105</thead>
106<tbody>
107  <row>
108    <entry><emphasis>
109KB_Default</emphasis>
110 </entry>
111    <entry>Press and release events are processed normally.</entry>
112  </row>
113  <row>
114    <entry><emphasis>
115KB_Lock</emphasis>
116 </entry>
117    <entry>If a key is logically up (i.e. the corresponding bit of the core key
118map is cleared) when it is pressed, the key press is processed normally and the
119corresponding release is ignored. If the key is logically down when pressed,
120the key press is ignored but the corresponding release is processed normally.
121</entry>
122  </row>
123  <row>
124    <entry>
125    <para>
126    <emphasis>
127KB_RadioGroup
128</emphasis>
129    </para>
130    <para>
131      flags: CARD8
132    </para>
133    <para>
134      index: CARD8
135    </para>
136    </entry>
137    <entry><para>If another member of the radio group specified by <emphasis>
138index</emphasis>
139 is logically down when a key is pressed, the server synthesizes a key release
140for the member that is logically down and then processes the new key press
141event normally. </para>
142<para>
143If the key itself is logically down when pressed, the key press event is
144ignored, but the processing of the corresponding key release depends on the
145value of the <emphasis>
146RGAllowNone</emphasis>
147 bit in <emphasis>
148flags</emphasis>
149. If it is set, the key release is processed normally; otherwise the key
150release is also ignored.
151</para>
152<para>
153All other key release events are ignored.</para>
154  </entry>
155  </row>
156  <row>
157    <entry>
158   <para>
159    <emphasis>
160KB_Overlay1
161</emphasis>
162   </para>
163   <para>
164      key: KEYCODE
165   </para>
166      </entry>
167    <entry>If the <emphasis>
168Overlay1</emphasis>
169 control is enabled, events from this key are reported as if they came from the
170key specified in <emphasis>
171key</emphasis>
172. Otherwise, press and release events are processed normally.</entry>
173  </row>
174  <row>
175    <entry>
176   <para>
177    <emphasis>
178KB_Overlay2
179</emphasis>
180   </para>
181   <para>
182      key: KEYCODE
183   </para>
184      </entry>
185    <entry>If the <emphasis>
186Overlay2</emphasis>
187 control is enabled, events from this key are reported as if they came from the
188key specified in <emphasis>
189key</emphasis>
190. Otherwise, press and release events are processed normally.</entry>
191  </row>
192</tbody>
193</tgroup>
194</informaltable>
195
196<para>
197The X server uses key behavior to determine whether to process or filter out
198any given key event; key behavior is independent of keyboard modifier or group
199state (each key has exactly one behavior.
200</para>
201
202<para>
203Key behaviors can be used to simulate any of these types of keys or to indicate
204an unmodifiable physical, electrical or software driver characteristic of a
205key. An optional <emphasis>
206permanent</emphasis>
207 flag can modify any of the supported behaviors and indicates that behavior
208describes an unalterable physical, electrical or software aspect of the
209keyboard. Permanent behaviors cannot be changed or set by the <emphasis>
210XkbSetMap</emphasis>
211 request. The <emphasis>
212permanent</emphasis>
213 flag indicates a characteristic of the underlying system that XKB cannot
214affect, so XKB treats all permanent behaviors as if they were <emphasis>
215KB_Default</emphasis>
216 and does not filter key events described in the table above.
217</para>
218
219
220</sect1>
221<sect1 id='Key_Actions'>
222<title>Key Actions</title>
223
224<para>
225Once the server has applied the global controls and per-key behavior and has
226decided to process a key event, it applies <emphasis>
227key actions</emphasis>
228 to determine the effects of the key on the internal state of the server. A key
229action consists of an operator and some optional data. XKB supports actions
230which:
231</para>
232
233<itemizedlist>
234<listitem>
235  <para>change base, latched or locked modifiers or group
236  </para>
237</listitem>
238<listitem>
239  <para>move the core pointer or simulate core pointer button events
240  </para>
241</listitem>
242<listitem>
243  <para>change most aspects of keyboard behavior
244  </para>
245</listitem>
246<listitem>
247  <para>terminate or suspend the server
248  </para>
249</listitem>
250<listitem>
251  <para>send a message to interested clients
252  </para>
253</listitem>
254<listitem>
255  <para>simulate events on other keys
256  </para>
257</listitem>
258</itemizedlist>
259
260<para>
261Each key has an optional list of actions. If present, this list parallels the
262list of symbols associated with the key (i.e. it has one action per symbol
263associated with the key). For key press events, the server looks up the action
264to be applied from this list using the key symbol mapping associated with the
265event key, just as a client looks up symbols as described in <link
266linkend='Determining_the_KeySym_Associated_with_a_Key_Event'>Determining the KeySym Associated with a
267Key Event</link>; if the event key does not have any actions, the server uses
268the <emphasis>
269SA_NoAction</emphasis>
270 event for that key regardless of modifier or group state.
271</para>
272
273
274<para>
275Key actions have essentially two halves; the effects on the server when the key
276is pressed and the effects when the key is released. The action applied for a
277key press event determines the further actions, if any, that are applied to the
278corresponding release event or to events that occur while the key is held down.
279Clients can change the actions associated with a key while the key is down
280without changing the action applied next time the key is released; subsequent
281press-release pairs will use the newly bound key action.
282</para>
283
284
285<para>
286Most actions directly change the state of the keyboard or server; some actions
287also modify other actions that occur simultaneously with them. Two actions
288occur simultaneously if the keys which invoke the actions are both logically
289down at the same time, regardless of the order in which they are pressed or
290delay between the activation of one and the other.
291</para>
292
293
294<para>
295Most actions which affect keyboard modifier state accept a modifier definition
296(see <link linkend='Virtual_Modifiers'>Virtual Modifiers</link>)
297named <emphasis>
298mods</emphasis>
299 and a boolean flag name <emphasis>
300useModMap</emphasis>
301 among their arguments. These two fields combine to specify the modifiers
302affected by the action as follows: If <emphasis>
303useModMap</emphasis>
304 is <emphasis>
305True</emphasis>
306, the action sets any modifiers bound by the modifier mapping to the key that
307initiated the action; otherwise, the action sets the modifiers specified by
308<emphasis>
309mods</emphasis>
310. For brevity in the text of the following definitions, we refer to this
311combination of <emphasis>
312useModMap</emphasis>
313 and <emphasis>
314mods</emphasis>
315 as the "action modifiers."
316</para>
317
318
319<para>
320The X Keyboard Extension supports the following actions:
321</para>
322
323<informaltable frame='topbot'>
324<?dbfo keep-together="auto" ?>
325<tgroup cols='2' align='left' colsep='0' rowsep='0'>
326<colspec colname='c1' colwidth='1.0*'/>
327<colspec colname='c2' colwidth='3.0*'/>
328<thead>
329  <row rowsep='1'>
330    <entry>Action</entry>
331    <entry>Effect</entry>
332  </row>
333</thead>
334<tbody>
335  <row>
336    <entry><emphasis>SA_NoAction</emphasis></entry>
337    <entry>
338      <itemizedlist>
339        <listitem>
340          <para>
341No direct effect, though <emphasis>SA_NoAction</emphasis>
342 events may change the effect of other server actions (see below).
343          </para>
344        </listitem>
345      </itemizedlist>
346    </entry>
347  </row>
348  <row>
349    <entry>
350    <para>
351    <emphasis>SA_SetMods</emphasis>
352    </para>
353    <para>
354      mods: MOD_DEF
355    </para>
356    <para>
357      useModMap: BOOL
358    </para>
359    <para>
360      clearLocks: BOOL
361    </para>
362    </entry>
363    <entry>
364      <itemizedlist>
365      <listitem>
366        <para>
367Key press adds any action modifiers to the keyboard’s base modifiers<emphasis>.</emphasis>
368        </para>
369      </listitem>
370      <listitem>
371        <para>Key release clears any action modifiers in the keyboard’s base
372modifiers, provided that no other key which affects the same modifiers is
373logically down.
374        </para>
375      </listitem>
376      <listitem>
377        <para>If no keys were operated simultaneously with this key and <emphasis>
378clearLocks</emphasis>
379 is set, release unlocks any action modifiers.
380        </para>
381      </listitem>
382      </itemizedlist>
383    </entry>
384  </row>
385  <row>
386    <entry>
387    <para>
388    <emphasis>
389SA_LatchMods
390</emphasis>
391    </para>
392    <para>
393      mods: MOD_DEF
394    </para>
395    <para>
396      useModMap: BOOL
397    </para>
398    <para>
399      clearLocks: BOOL
400    </para>
401    <para>
402      latchToLock: BOOL
403    </para>
404      </entry>
405<entry>
406<itemizedlist>
407<listitem>
408  <para>Key press and release events have the same effect as for <emphasis>
409SA_SetMods</emphasis>
410; if no keys were operated simultaneously with the latching modifier key, key
411release events have the following additional effects:
412  </para>
413</listitem>
414<listitem>
415  <para>Modifiers that were unlocked due to <emphasis>
416clearLocks</emphasis>
417 have no further effect.
418  </para>
419</listitem>
420<listitem>
421  <para>If <emphasis>
422latchToLock</emphasis>
423 is set, key release locks and then unlatches any remaining action modifiers
424that are already latched.
425  </para>
426</listitem>
427<listitem>
428  <para>Finally, key release latches any action modifiers that were not used by
429the <emphasis>
430clearLocks</emphasis>
431 or <emphasis>
432latchToLock</emphasis>
433 flags.
434  </para>
435</listitem>
436</itemizedlist>
437</entry>
438  </row>
439  <row>
440    <entry>
441    <para>
442    <emphasis>
443SA_LockMods
444    </emphasis>
445    </para>
446    <para>
447      mods: MOD_DEF
448    </para>
449    <para>
450      useModMap: BOOL
451    </para>
452    <para>
453      noLock: BOOL
454    </para>
455    <para>
456      noUnlock: BOOL
457    </para>
458      </entry>
459<entry>
460<itemizedlist>
461<listitem>
462  <para>Key press sets the base and possibly the locked state of any action
463modifiers. If <emphasis>
464noLock</emphasis>
465 is <emphasis>
466True</emphasis>
467, only the base state is changed.
468  </para>
469</listitem>
470<listitem>
471  <para>For key release events, clears any action modifiers in the keyboard’s
472base modifiers, provided that no other key which affects the same modifiers is
473down. If <emphasis>
474noUnlock</emphasis>
475 is <emphasis>
476False</emphasis>
477 and any of the action modifiers were locked before the corresponding key press
478occurred, key release unlocks them.
479  </para>
480</listitem>
481</itemizedlist>
482</entry>
483  </row>
484  <row>
485    <entry>
486    <para>
487    <emphasis>
488SA_SetGroup
489</emphasis>
490    </para>
491    <para>
492      group: INT8
493    </para>
494    <para>
495      groupAbsolute: BOOL
496    </para>
497    <para>
498      clearLocks: BOOL
499    </para>
500      </entry>
501<entry>
502<itemizedlist>
503<listitem>
504  <para>If <emphasis>
505groupAbsolute</emphasis>
506 is set, key press events change the base keyboard group to <emphasis>
507group</emphasis>
508; otherwise, they add <emphasis>
509group</emphasis>
510 to the base keyboard group. In either case, the resulting effective keyboard
511group is brought back into range depending on the value of the <emphasis>
512GroupsWrap</emphasis>
513 control for the keyboard.
514  </para>
515</listitem>
516<listitem>
517  <para>If an <emphasis>
518SA_ISOLock</emphasis>
519 key is pressed while this key is held down, key release has no effect,
520otherwise it cancels the effects of the press.
521  </para>
522</listitem>
523<listitem>
524  <para>If no keys were operated simultaneously with this key and <emphasis>
525clearLocks</emphasis>
526 is set, key release also sets the locked keyboard group to <emphasis>
527Group1</emphasis>
528.
529  </para>
530</listitem>
531</itemizedlist>
532</entry>
533  </row>
534  <row>
535    <entry>
536    <para>
537    <emphasis>
538SA_LatchGroup
539    </emphasis>
540    </para>
541    <para>
542      group: INT8
543    </para>
544    <para>
545      groupAbsolute: BOOL
546    </para>
547    <para>
548      clearLocks: BOOL
549    </para>
550    <para>
551      latchToLock: BOOL
552    </para>
553      </entry>
554<entry>
555<itemizedlist>
556<listitem>
557  <para>Key press and release events have the same effect as an <emphasis>
558SA_SetGroup</emphasis>
559 action; if no keys were operated simultaneously with the latching group key
560and the <emphasis>
561clearLocks</emphasis>
562 flag was not set or had no effect, key release has the following additional
563effects:
564  </para>
565</listitem>
566<listitem>
567  <para>If <emphasis>
568latchToLock</emphasis>
569 is set and the latched keyboard group is non-zero, the key release adds the
570delta applied by the corresponding key press to the locked keyboard group and
571subtracts it from the latched keyboard group. The locked and effective keyboard
572group are brought back into range according to the value of the global
573<emphasis>
574GroupsWrap</emphasis>
575 control for the keyboard.
576  </para>
577</listitem>
578<listitem>
579  <para>Otherwise, key release adds the key press delta to the latched keyboard
580group.
581  </para>
582</listitem>
583</itemizedlist>
584</entry>
585  </row>
586  <row>
587    <entry>
588    <para>
589    <emphasis>
590SA_LockGroup
591    </emphasis>
592    </para>
593    <para>
594      group: INT8
595    </para>
596    <para>
597      groupAbsolute: BOOL
598    </para>
599    </entry>
600<entry>
601<itemizedlist>
602<listitem>
603  <para>If <emphasis>
604groupAbsolute</emphasis>
605 is set, key press sets the locked keyboard group to <emphasis>
606group</emphasis>
607. Otherwise, key press adds <emphasis>
608group</emphasis>
609 to the locked keyboard group. In either case, the resulting locked and
610effective group is brought back into range depending on the value of the
611<emphasis>
612GroupsWrap</emphasis>
613 control for the keyboard.
614  </para>
615</listitem>
616<listitem>
617  <para>Key release has no effect.
618  </para>
619</listitem>
620</itemizedlist>
621</entry>
622  </row>
623  <row>
624    <entry>
625    <para>
626    <emphasis>
627SA_MovePtr
628</emphasis>
629    </para>
630    <para>
631      x, y: INT16
632    </para>
633    <para>
634      noAccel: BOOL
635    </para>
636    <para>
637      absoluteX: BOOL
638    </para>
639    <para>
640      absoluteY: BOOL
641    </para>
642      </entry>
643<entry>
644<itemizedlist>
645<listitem>
646  <para>If <emphasis>
647MouseKeys</emphasis>
648 are not enabled, this action behaves like <emphasis>
649SA_NoAction</emphasis>
650, otherwise this action cancels any pending repeat key timers for this key and
651has the following additional effects.
652  </para>
653</listitem>
654<listitem>
655  <para>Key press generates a core pointer <emphasis>
656MotionNotify</emphasis>
657 event instead of the usual <emphasis>
658KeyPress</emphasis>
659. If <emphasis>
660absoluteX</emphasis>
661 is <emphasis>
662True</emphasis>
663, <emphasis>
664x</emphasis>
665 specifies the new pointer X coordinate, otherwise <emphasis>
666x</emphasis>
667 is added to the current pointer X coordinate; <emphasis>
668absoluteY</emphasis>
669 and <emphasis>
670y</emphasis>
671 specify the new Y coordinate in the same way.
672  </para>
673</listitem>
674<listitem>
675  <para>If <emphasis>
676noAccel</emphasis>
677 is <emphasis>
678False</emphasis>
679, and the <emphasis>
680MouseKeysAccel</emphasis>
681 keyboard control is enabled, key press also initiates the mouse keys timer for
682this key; every time this timer expires, the cursor moves again. The distance
683the cursor moves in these subsequent events is determined by the mouse keys
684acceleration as described in <link linkend='The_MouseKeysAccel_Control'>The
685MouseKeysAccel Control</link>.
686  </para>
687</listitem>
688<listitem>
689  <para>Key release disables the mouse keys timer (if it was initiated by the
690corresponding key press) but has no other effect and is ignored (does not
691generate an event of any type).
692  </para>
693</listitem>
694</itemizedlist>
695</entry>
696  </row>
697  <row>
698    <entry>
699    <para>
700    <emphasis>
701SA_PtrBtn
702   </emphasis>
703    </para>
704    <para>
705      button: CARD8
706    </para>
707    <para>
708      count: CARD8
709    </para>
710    <para>
711      useDfltBtn: BOOL
712    </para>
713      </entry>
714<entry>
715<itemizedlist>
716<listitem>
717  <para>If <emphasis>
718MouseKeys</emphasis>
719 are not enabled, this action behaves like <emphasis>
720SA_NoAction</emphasis>
721.
722  </para>
723</listitem>
724<listitem>
725  <para>If <emphasis>
726useDfltBtn</emphasis>
727 is set, the event is generated for the current default core button. Otherwise,
728the event is generated for the button specified by <emphasis>
729button</emphasis>
730.
731  </para>
732</listitem>
733<listitem>
734  <para>If the mouse button specified for this action is logically down, the
735key press and corresponding release are ignored and have no effect.
736  </para>
737</listitem>
738<listitem>
739  <para>Otherwise, key press causes one or more core pointer button events
740instead of the usual key press. If <emphasis>
741count</emphasis>
742 is <emphasis>
7430</emphasis>
744, key press generates a single <emphasis>
745ButtonPress</emphasis>
746 event; if <emphasis>
747count</emphasis>
748 is greater than <emphasis>
7490</emphasis>
750, key press generates <emphasis>
751count</emphasis>
752 pairs of <emphasis>
753ButtonPress</emphasis>
754 and <emphasis>
755ButtonRelease</emphasis>
756 events.
757  </para>
758</listitem>
759<listitem>
760  <para>If <emphasis>
761count</emphasis>
762 is <emphasis>
7630</emphasis>
764, key release generates a core pointer <emphasis>
765ButtonRelease</emphasis>
766 which matches the event generated by the corresponding key press; if count is
767non-zero, key release does not cause a <emphasis>
768ButtonRelease</emphasis>
769 event. Key release never causes a key release event.
770  </para>
771</listitem>
772</itemizedlist>
773</entry>
774  </row>
775  <row>
776    <entry>
777    <para>
778    <emphasis>
779SA_LockPtrBtn
780</emphasis>
781    </para>
782    <para>
783      button: BUTTON
784    </para>
785    <para>
786      noLock: BOOL
787    </para>
788    <para>
789      noUnlock: BOOL
790    </para>
791    <para>
792      useDfltBtn: BOOL
793    </para>
794      </entry>
795<entry>
796<itemizedlist>
797<listitem>
798  <para>If <emphasis>
799MouseKeys</emphasis>
800 are not enabled, this action behaves like <emphasis>
801SA_NoAction</emphasis>
802.
803  </para>
804</listitem>
805<listitem>
806  <para>Otherwise, if the button specified by <emphasis>
807useDfltBtn</emphasis>
808 and <emphasis>
809button</emphasis>
810 is not locked, key press causes a <emphasis>
811ButtonPress</emphasis>
812 instead of a key press and locks the button. If the button is already locked
813or if <emphasis>
814noLock</emphasis>
815 is <emphasis>
816True</emphasis>
817, key press is ignored and has no effect.
818  </para>
819</listitem>
820<listitem>
821  <para>If the corresponding key press was ignored, and if <emphasis>
822noUnlock</emphasis>
823 is <emphasis>
824False</emphasis>
825, key release generates a <emphasis>
826ButtonRelease</emphasis>
827 event instead of a key release event and unlocks the specified button. If the
828corresponding key press locked a button, key release is ignored and has no
829effect.
830  </para>
831</listitem>
832</itemizedlist>
833</entry>
834  </row>
835  <row>
836    <entry>
837    <para>
838    <emphasis>
839SA_SetPtrDflt
840</emphasis>
841    </para>
842    <para>
843      affect: CARD8
844    </para>
845    <para>
846      value: CARD8
847    </para>
848    <para>
849      dfltBtnAbs: BOOL
850    </para>
851      </entry>
852<entry>
853<itemizedlist>
854<listitem>
855  <para>If <emphasis>
856MouseKeys</emphasis>
857 are not enabled, this action behaves like <emphasis>
858SA_NoAction</emphasis>
859.
860  </para>
861</listitem>
862<listitem>
863  <para>Otherwise, both key press and key release are ignored, but key press
864changes the pointer value specified by <emphasis>
865affect </emphasis>
866to <emphasis>
867value</emphasis>
868, as follows:
869  </para>
870</listitem>
871<listitem>
872  <para>If <emphasis>
873which</emphasis>
874 is <emphasis>
875SA_AffectDfltBtn</emphasis>
876, <emphasis>
877value</emphasis>
878 and <emphasis>
879dfltBtnAbs</emphasis>
880 specify the default pointer button used by the various pointer actions as
881follow: If <emphasis>
882dfltBtnAbs </emphasis>
883is True, value specifies the button to be used, otherwise, <emphasis>
884value</emphasis>
885 specifies the amount to be added to the current default button. In either
886case, illegal button choices are wrapped back into range.
887  </para>
888</listitem>
889</itemizedlist>
890</entry>
891  </row>
892  <row>
893    <entry>
894      <para>
895    <emphasis>
896SA_ISOLock
897</emphasis>
898      </para>
899      <para>
900      dfltIsGroup: <emphasis>
901False
902</emphasis>
903      </para>
904      <para>
905      mods: MOD_DEF
906      </para>
907      <para>
908      useModMap: BOOL
909      </para>
910      <para>
911      noLock: BOOL
912      </para>
913      <para>
914      noUnlock: BOOL
915      </para>
916      <para>
917      noAffectMods: BOOL
918      </para>
919      <para>
920      noAffectGrp: BOOL
921      </para>
922      <para>
923      noAffectPtr: BOOL
924      </para>
925      <para>
926      noAffectCtrls: BOOL
927      </para>
928      <para>
929or
930      </para>
931      <para>
932      dfltIsGroup: <emphasis>
933True
934</emphasis>
935      </para>
936      <para>
937      group: INT8
938      </para>
939      <para>
940      groupAbsolute: BOOL
941      </para>
942      <para>
943      noAffectMods: BOOL
944      </para>
945      <para>
946      noAffectGrp: BOOL
947      </para>
948      <para>
949      noAffectPtr: BOOL
950      </para>
951      <para>
952      noAffectCtrls: BOOL
953      </para>
954      </entry>
955<entry>
956<itemizedlist>
957<listitem>
958  <para>If <emphasis>
959dfltIsGroup</emphasis>
960 is <emphasis>
961True</emphasis>
962, key press sets the base group specified by <emphasis>
963groupAbsolute</emphasis>
964 and <emphasis>
965group</emphasis>
966. Otherwise, key press sets the action modifiers in the keyboard’s base
967modifiers.
968  </para>
969</listitem>
970<listitem>
971  <para>Key release clears the base modifiers or group that were set by the key
972press; it may have additional effects if no other appropriate actions occur
973simultaneously with the <emphasis>
974SA_ISOLock</emphasis>
975 operation.
976  </para>
977</listitem>
978<listitem>
979  <para>If <emphasis>
980noAffectMods</emphasis>
981 is <emphasis>
982False</emphasis>
983, any <emphasis>
984SA_SetMods</emphasis>
985 or <emphasis>
986SA_LatchMods</emphasis>
987 actions that occur simultaneously with the <emphasis>
988ISOLock</emphasis>
989 action are treated as <emphasis>
990SA_LockMods</emphasis>
991 instead.
992  </para>
993</listitem>
994<listitem>
995  <para>If <emphasis>
996noAffectGrp</emphasis>
997 is <emphasis>
998False</emphasis>
999, any <emphasis>
1000SA_SetGroup</emphasis>
1001 or <emphasis>
1002SA_LatchGroup</emphasis>
1003 actions that occur simultaneously with this action are treated as <emphasis>
1004SA_LockGroup</emphasis>
1005 actions instead.
1006  </para>
1007</listitem>
1008<listitem>
1009  <para>If <emphasis>
1010noAffectPtr</emphasis>
1011 is <emphasis>
1012False</emphasis>
1013, <emphasis>
1014SA_PtrBtn</emphasis>
1015 actions that occur simultaneously with the <emphasis>
1016SA_ISOLock</emphasis>
1017 action are treated as <emphasis>
1018SA_LockPtrBtn</emphasis>
1019 actions instead.
1020  </para>
1021</listitem>
1022<listitem>
1023  <para>If <emphasis>
1024noAffectCtrls</emphasis>
1025 is <emphasis>
1026False</emphasis>
1027, any <emphasis>
1028SA_SetControls</emphasis>
1029 actions that occur simultaneously with the <emphasis>
1030SA_ISOLock</emphasis>
1031 action are treated as <emphasis>
1032SA_LockControls</emphasis>
1033 actions instead.
1034  </para>
1035</listitem>
1036<listitem>
1037  <para>If no other actions were transformed by the <emphasis>
1038SA_ISOLock</emphasis>
1039 action, key release locks the group or modifiers specified by the action
1040arguments.
1041  </para>
1042</listitem>
1043</itemizedlist>
1044</entry>
1045  </row>
1046  <row>
1047    <entry><emphasis>
1048SA_TerminateServer</emphasis>
1049 </entry>
1050<entry>
1051<itemizedlist>
1052<listitem>
1053  <para>Key press terminates the server. Key release is ignored.
1054  </para>
1055</listitem>
1056<listitem>
1057  <para>This action is optional; servers are free to ignore it. If ignored, it
1058behaves like <emphasis>
1059SA_NoAction</emphasis>
1060.
1061  </para>
1062</listitem>
1063</itemizedlist>
1064</entry>
1065  </row>
1066  <row>
1067    <entry>
1068    <para>
1069    <emphasis>
1070SA_SwitchScreen
1071</emphasis>
1072      </para>
1073      <para>
1074      num: INT8
1075      </para>
1076      <para>
1077      switchApp: BOOL
1078      </para>
1079      <para>
1080      screenAbs: BOOL
1081      </para>
1082</entry>
1083<entry>
1084<itemizedlist>
1085<listitem>
1086  <para>If the server supports this action and multiple screens or displays
1087(either virtual or real), this action changes to the active screen indicated by
1088<emphasis>
1089num</emphasis>
1090 and <emphasis>
1091screenAbs</emphasis>
1092. If <emphasis>
1093screenAbs</emphasis>
1094 is <emphasis>
1095True</emphasis>
1096, num specifies the index of the new screen; otherwise, num specifies an offset
1097from the current screen to the new screen.
1098  </para>
1099</listitem>
1100<listitem>
1101  <para>If <emphasis>
1102switchApp</emphasis>
1103 is <emphasis>
1104False</emphasis>
1105, it should switch to another screen on the same server. Otherwise it should
1106switch to another X server or application which shares the same physical
1107display.
1108  </para>
1109</listitem>
1110<listitem>
1111  <para>This action is optional; servers are free to ignore the action or any
1112of its flags if they do not support the requested behavior. If the action is
1113ignored, it behaves like <emphasis>
1114SA_NoAction</emphasis>
1115, otherwise neither key press nor release generate an event.
1116  </para>
1117</listitem>
1118</itemizedlist>
1119</entry>
1120  </row>
1121  <row>
1122    <entry>
1123      <para><emphasis>SA_SetControls</emphasis></para>
1124      <para>controls: KB_BOOLCTRLMASK</para>
1125    </entry>
1126    <entry>
1127      <itemizedlist>
1128        <listitem>
1129          <para>
1130Key press enables any boolean controls that are specified in <emphasis>
1131controls</emphasis>
1132 and not already enabled at the time of the key press. Key release disables any
1133controls that were enabled by the corresponding key press. This action can
1134cause <emphasis>
1135XkbControlsNotify</emphasis>
1136 events.
1137          </para>
1138	</listitem>
1139	</itemizedlist>
1140     </entry>
1141  </row>
1142  <row>
1143    <entry>
1144      <para><emphasis>SA_LockControls</emphasis></para>
1145      <para>
1146      controls: KB_BOOLCTRLMASK
1147      </para>
1148      <para>
1149      noLock: BOOL
1150      </para>
1151      <para>
1152      noUnlock: BOOL
1153      </para>
1154    </entry>
1155    <entry>
1156<itemizedlist>
1157<listitem>
1158  <para>If <emphasis>
1159noLock</emphasis>
1160 is <emphasis>
1161False</emphasis>
1162, key press locks and enables any controls that are specified in <emphasis>
1163controls</emphasis>
1164 and not already locked at the time of the key press.
1165</para>
1166<para>
1167If <emphasis>
1168noUnlock</emphasis>
1169 is <emphasis>
1170False</emphasis>
1171, key release unlocks and disables any controls that are specified in <emphasis>
1172controls</emphasis>
1173 and were not enabled at the time of the corresponding key press.
1174  </para>
1175</listitem>
1176</itemizedlist>
1177</entry>
1178  </row>
1179  <row>
1180    <entry>
1181      <para>
1182    <emphasis>
1183SA_ActionMessage</emphasis>
1184:
1185      pressMsg: BOOL
1186      </para>
1187      <para>
1188      releaseMsg: BOOL
1189      </para>
1190      <para>
1191      genEvent: BOOL
1192      </para>
1193      <para>
1194      message: STRING
1195      </para>
1196      </entry>
1197<entry>
1198<itemizedlist>
1199<listitem>
1200  <para>if <emphasis>
1201pressMsg</emphasis>
1202 is <emphasis>
1203True</emphasis>
1204, key press generates an <emphasis>
1205XkbActionMessage</emphasis>
1206 event which reports the keycode, event type and the contents of <emphasis>
1207message</emphasis>
1208.
1209  </para>
1210</listitem>
1211<listitem>
1212  <para>If <emphasis>
1213releaseMsg</emphasis>
1214 is <emphasis>
1215True</emphasis>
1216, key release generates an <emphasis>
1217XkbActionMessage</emphasis>
1218 event which reports the keycode, event type and contents of <emphasis>
1219message</emphasis>
1220.
1221  </para>
1222</listitem>
1223<listitem>
1224  <para>If <emphasis>
1225genEvent</emphasis>
1226 is <emphasis>
1227True</emphasis>
1228, both press and release generate key press and key release events, regardless
1229of whether they also cause an <emphasis>
1230XkbActionMessage</emphasis>
1231.
1232  </para>
1233</listitem>
1234</itemizedlist>
1235</entry>
1236  </row>
1237  <row>
1238    <entry>
1239    <para>
1240    <emphasis>
1241SA_RedirectKey
1242</emphasis>
1243    </para>
1244    <para>
1245      newKey: KEYCODE
1246    </para>
1247    <para>
1248      modsMask: KEYMASK
1249    </para>
1250    <para>
1251      mods: KEYMASK
1252    </para>
1253    <para>
1254      vmodsMask: CARD16
1255    </para>
1256    <para>
1257      vmods: CARD16
1258    </para>
1259      </entry>
1260<entry>
1261<itemizedlist>
1262<listitem>
1263  <para>Key press causes a key press event for the key specified by <emphasis>
1264newKey</emphasis>
1265 instead of for the actual key. The state reported in this event reports of the
1266current effective modifiers changed as follow: Any real modifiers specified in
1267<emphasis>
1268modsMask</emphasis>
1269 are set to corresponding values from <emphasis>
1270mods</emphasis>
1271. Any real modifiers bound to the virtual modifiers specified in <emphasis>
1272vmodsMask</emphasis>
1273 are either set or cleared, depending on the corresponding value in <emphasis>
1274vmods</emphasis>
1275. If the real and virtual modifier definitions specify conflicting values for a
1276single modifier, the real modifier definition has priority.
1277  </para>
1278</listitem>
1279<listitem>
1280  <para>Key release causes a key release event for the key specified by
1281<emphasis>
1282newKey</emphasis>
1283; the state field for this event consists of the effective keyboard modifiers
1284at the time of the release, changed as described above.
1285  </para>
1286</listitem>
1287<listitem>
1288  <para>The <emphasis>
1289SA_RedirectKey</emphasis>
1290 action normally redirects to another key on the same device as the key or
1291button which caused the event, unless that device does not belong to the input
1292extension KEYCLASS, in which case this action causes an event on the core
1293keyboard device.
1294  </para>
1295</listitem>
1296</itemizedlist>
1297</entry>
1298  </row>
1299  <row>
1300    <entry>
1301    <para>
1302    <emphasis>
1303SA_DeviceBtn
1304</emphasis>
1305    </para>
1306    <para>
1307      count: CARD8
1308    </para>
1309    <para>
1310      button: BUTTON
1311    </para>
1312    <para>
1313      device: CARD8
1314    </para>
1315      </entry>
1316<entry>
1317<itemizedlist>
1318<listitem>
1319  <para>The <emphasis>
1320device</emphasis>
1321 field specifies the ID of an extension device; the <emphasis>
1322button</emphasis>
1323 field specifies the index of a button on that device. If the button specified
1324by this action is logically down, the key press and corresponding release are
1325ignored and have no effect. If the device or button specified by this action
1326are illegal, this action behaves like <emphasis>
1327SA_NoAction</emphasis>
1328.
1329  </para>
1330</listitem>
1331<listitem>
1332  <para>Otherwise, key press causes one or more input extension device button
1333events instead of the usual key press event. If <emphasis>
1334count</emphasis>
1335 is <emphasis>
13360</emphasis>
1337, key press generates a single <emphasis>
1338DeviceButtonPress</emphasis>
1339 event; if <emphasis>
1340count</emphasis>
1341 is greater than <emphasis>
13420</emphasis>
1343, key press generates <emphasis>
1344count</emphasis>
1345 pairs of <emphasis>
1346DeviceButtonPress</emphasis>
1347 and <emphasis>
1348DeviceButtonRelease</emphasis>
1349 events.
1350  </para>
1351</listitem>
1352<listitem>
1353  <para>If <emphasis>
1354count</emphasis>
1355 is <emphasis>
13560</emphasis>
1357, key release generates an input extension <emphasis>
1358DeviceButtonRelease</emphasis>
1359 which matches the event generated by the corresponding key press; if count is
1360non-zero, key release does not cause a <emphasis>
1361DeviceButtonRelease</emphasis>
1362 event. Key release never causes a key release event.
1363  </para>
1364</listitem>
1365</itemizedlist>
1366</entry>
1367  </row>
1368  <row>
1369    <entry>
1370    <para>
1371    <emphasis>
1372SA_LockDeviceBtn
1373</emphasis>
1374    </para>
1375    <para>
1376      button: BUTTON
1377    </para>
1378    <para>
1379      device: CARD8
1380    </para>
1381    <para>
1382      noLock: BOOL
1383    </para>
1384    <para>
1385      noUnlock: BOOL
1386    </para>
1387      </entry>
1388<entry>
1389<itemizedlist>
1390<listitem>
1391  <para>The <emphasis>
1392device</emphasis>
1393 field specifies the ID of an extension device; the <emphasis>
1394button</emphasis>
1395 field specifies the index of a button on that device. If the device or button
1396specified by this action are illegal, it behaves like <emphasis>
1397SA_NoAction</emphasis>
1398.
1399  </para>
1400</listitem>
1401<listitem>
1402  <para>Otherwise, if the specified button is not locked and if <emphasis>
1403noLock</emphasis>
1404 is <emphasis>
1405False</emphasis>
1406, key press causes an input extension <emphasis>
1407DeviceButtonPress</emphasis>
1408 event instead of a key press event and locks the button. If the button is
1409already locked or if <emphasis>
1410noLock</emphasis>
1411 is <emphasis>
1412True</emphasis>
1413, key press is ignored and has no effect.
1414  </para>
1415</listitem>
1416<listitem>
1417  <para>If the corresponding key press was ignored, and if <emphasis>
1418noUnlock</emphasis>
1419 is <emphasis>
1420False</emphasis>
1421, key release generates an input extension <emphasis>
1422DeviceButtonRelease</emphasis>
1423 event instead of a core protocol or input extension key release event and
1424unlocks the specified button. If the corresponding key press locked a button,
1425key release is ignored and has no effect.
1426  </para>
1427</listitem>
1428</itemizedlist>
1429</entry>
1430  </row>
1431  <row>
1432    <entry>
1433<para>
1434    <emphasis>
1435SA_DeviceValuator
1436</emphasis>
1437</para>
1438<para>
1439      <emphasis>
1440device</emphasis>
1441: CARD8
1442</para>
1443<para>
1444      <emphasis>
1445val1What</emphasis>
1446: SA_DVOP
1447</para>
1448<para>
1449      <emphasis>
1450val1</emphasis>
1451: CARD8
1452</para>
1453<para>
1454      <emphasis>
1455val1Value</emphasis>
1456: INT8
1457</para>
1458<para>
1459      <emphasis>
1460val1Scale</emphasis>
1461: 0...7
1462</para>
1463<para>
1464      <emphasis>
1465val2What</emphasis>
1466: BOOL
1467</para>
1468<para>
1469      <emphasis>
1470val2</emphasis>
1471: CARD8
1472</para>
1473<para>
1474      <emphasis>
1475val2Value</emphasis>
1476: INT8
1477</para>
1478<para>
1479      <emphasis>
1480val2Scale</emphasis>
1481: 0...7
1482</para>
1483</entry>
1484<entry>
1485<itemizedlist>
1486<listitem>
1487  <para>The <emphasis>
1488device</emphasis>
1489 field specifies the ID of an extension device; <emphasis>
1490val1</emphasis>
1491 and <emphasis>
1492val2</emphasis>
1493 specify valuators on that device. If <emphasis>
1494device</emphasis>
1495 is illegal or if neither <emphasis>
1496val1</emphasis>
1497 nor <emphasis>
1498val2</emphasis>
1499 specifies a legal valuator, this action behaves like <emphasis>
1500SA_NoAction</emphasis>
1501.
1502  </para>
1503</listitem>
1504<listitem>
1505  <para>If <emphasis>
1506valn</emphasis>
1507 specifies a legal valuator and <emphasis>
1508valnWhat</emphasis>
1509 is not <emphasis>
1510SA_IgnoreVal</emphasis>
1511, the specified value is adjusted as specified by <emphasis>
1512valnWhat</emphasis>
1513:
1514  </para>
1515</listitem>
1516<listitem>
1517  <para>If <emphasis>
1518valnWhat</emphasis>
1519 is <emphasis>
1520SA_SetValMin</emphasis>
1521, <emphasis>
1522valn</emphasis>
1523 is set to its minimum legal value.
1524  </para>
1525</listitem>
1526<listitem>
1527  <para>If <emphasis>
1528valnWhat</emphasis>
1529 is <emphasis>
1530SA_SetValCenter</emphasis>
1531, <emphasis>
1532valn</emphasis>
1533 is centered (to (max-min)/2).
1534  </para>
1535</listitem>
1536<listitem>
1537  <para>If <emphasis>
1538valnWhat</emphasis>
1539 is <emphasis>
1540SA_SetValMax</emphasis>
1541, <emphasis>
1542valn</emphasis>
1543 is set to its maximum legal value.
1544  </para>
1545</listitem>
1546<listitem>
1547  <para>if <emphasis>
1548valnWhat</emphasis>
1549 is <emphasis>
1550SA_SetValRelative</emphasis>
1551, <mediaobject>
1552 <imageobject> <imagedata format="SVG" fileref="XKBproto-4.svg"/>
1553 </imageobject>
1554 </mediaobject>
1555
1556 is added to <emphasis>
1557valn</emphasis>
1558.
1559  </para>
1560</listitem>
1561<listitem>
1562  <para>if <emphasis>
1563valnWhat</emphasis>
1564 is <emphasis>
1565SA_SetValAbsolute</emphasis>
1566, <emphasis>
1567valn</emphasis>
1568 is set to <mediaobject>
1569 <imageobject> <imagedata format="SVG" fileref="XKBproto-5.svg"/>
1570 </imageobject>
1571 </mediaobject>
1572
1573.
1574  </para>
1575</listitem>
1576<listitem>
1577  <para>Illegal values for <emphasis>
1578SA_SetValRelative</emphasis>
1579 or <emphasis>
1580SA_SetValAbsolute</emphasis>
1581 are clamped into range.
1582  </para>
1583</listitem>
1584</itemizedlist>
1585</entry>
1586  </row>
1587</tbody>
1588</tgroup>
1589</informaltable>
1590
1591<para>
1592If <emphasis>
1593StickyKeys</emphasis>
1594 are enabled, all <emphasis>
1595SA_SetMods</emphasis>
1596 and <emphasis>
1597SA_SetGroup</emphasis>
1598 actions act like <emphasis>
1599SA_LatchMods</emphasis>
1600 and <emphasis>
1601SA_LatchGroup</emphasis>
1602 respectively. If the <emphasis>
1603LatchToLock</emphasis>
1604 AccessX option is set, either action behaves as if both the <emphasis>
1605SA_ClearLocks</emphasis>
1606 and <emphasis>
1607SA_LatchToLock</emphasis>
1608 flags are set.
1609</para>
1610
1611
1612<para>
1613Actions which cause an event from another key or from a button on another
1614device immediately generate the specified event. These actions do not consider
1615the behavior or actions (if any) that are bound to the key or button to which
1616the event is redirected.
1617</para>
1618
1619
1620<para>
1621Core events generated by server actions contain the keyboard state that was in
1622effect at the time the key event occurred; the reported state does not reflect
1623any changes in state that occur as a result of the actions bound to the key
1624event that caused them.
1625</para>
1626
1627
1628<para>
1629Events sent to clients that have not issued an <emphasis>
1630XkbUseExtension</emphasis>
1631 request contain a compatibility state in place of the actual XKB keyboard
1632state. See <link linkend='Effects_of_XKB_on_Core_Protocol_Events'>Effects of XKB on Core
1633Protocol Events</link> for a description of this compatibility mapping.
1634</para>
1635
1636
1637</sect1>
1638<sect1 id='Delivering_a_Key_or_Button_Event_to_a_Client'>
1639<title>Delivering a Key or Button Event to a Client</title>
1640
1641<para>
1642The window and client that receive core protocol and input extension key or
1643button events are determined using the focus policy, window hierarchy and
1644passive grabs as specified by the core protocol and the input extension, with
1645the following changes:
1646</para>
1647
1648<itemizedlist>
1649<listitem>
1650  <para>A passive grab triggers if the modifier state specified in the grab
1651matches the grab compatibility state (described in <link
1652linkend='Compatibility_Components_of_Keyboard_State'>Compatibility Components of Keyboard
1653State</link>). Clients can choose to use the XKB grab state instead by setting
1654the <emphasis>
1655GrabsUseXKBState</emphasis>
1656 per-client flag. This flag affects all passive grabs that are requested by the
1657client which sets it but does not affect passive grabs that are set by any
1658other client.
1659  </para>
1660</listitem>
1661<listitem>
1662  <para>The state field of events which trigger a passive grab reports the XKB
1663or compatibility grab state in effect at the time the grab is triggered; the
1664state field of the corresponding release event reports the corresponding grab
1665state in effect when the key or button is released.
1666  </para>
1667</listitem>
1668<listitem>
1669  <para>If the <emphasis>
1670LookupStateWhenGrabbed</emphasis>
1671 per-client flag is set, all key or button events that occur while a keyboard
1672or pointer grab is active contain the XKB or compatibility lookup state,
1673depending on the value of the <emphasis>
1674GrabsUseXKBState</emphasis>
1675 per-client flag. If <emphasis>
1676LookupStateWhenGrabbed</emphasis>
1677 is not set, they include the XKB or compatibility grab state, instead.
1678  </para>
1679</listitem>
1680<listitem>
1681  <para>Otherwise, the state field of events that do not trigger a passive grab
1682report is derived from the XKB effective modifiers and group, as described in
1683<link linkend='Computing_A_State_Field_from_an_XKB_State'>Computing A State Field from an
1684XKB State</link>.
1685  </para>
1686</listitem>
1687<listitem>
1688  <para>If a key release event is the result of an autorepeating key that is
1689being held down, and the client to which the event is reported has requested
1690detectable autorepeat (see <link linkend='Detectable_Autorepeat'>
1691Detectable Autorepeat</link>), the event is not delivered to the client.
1692  </para>
1693</listitem>
1694</itemizedlist>
1695
1696<para>
1697The following section explains the intent of the XKB interactions with core
1698protocol grabs and the reason that the per-client flags are needed.
1699</para>
1700
1701
1702<sect2 id='XKB_Interactions_With_Core_Protocol_Grabs'>
1703<title>XKB Interactions With Core Protocol Grabs</title>
1704
1705<para>
1706XKB provides the separate lookup and grab states to help work around some
1707difficulties with the way the core protocol specifies passive grabs.
1708Unfortunately, many clients work around those problems differently, and the way
1709that XKB handles grabs and reports keyboard state can sometimes interact with
1710those client workarounds in unexpected and unpleasant ways.
1711</para>
1712
1713
1714<para>
1715To provide more reasonable behavior for clients that are aware of XKB without
1716causing problems for clients that are unaware of XKB, this extension provides
1717two per-client flags that specify the way that XKB and the core protocol should
1718interact.
1719</para>
1720
1721<itemizedlist>
1722<listitem>
1723  <para>The largest problems arise from the fact that an XKB state field
1724encodes an explicit keyboard group in bits 13-14 (as described in <link
1725linkend='Computing_A_State_Field_from_an_XKB_State'>Computing A State Field from an XKB
1726State</link>), while pre-XKB clients use one of the eight keyboard modifiers
1727to select an alternate keyboard group. To make existing clients behave
1728reasonably, XKB normally uses the compatibility grab state instead of the XKB
1729grab state to determine whether or not a passive grab is triggered. XKB-aware
1730clients can set the <emphasis>
1731GrabsUseXKBState</emphasis>
1732 per-client flag to indicate that they are specifying passive grabs using an
1733XKB state.
1734  </para>
1735</listitem>
1736<listitem>
1737  <para>Some toolkits start an active grab when a passive grab is triggered, in
1738order to have more control over the conditions under which the grab is
1739terminated. Unfortunately, the fact that XKB reports a different state in
1740events that trigger or terminate grabs means that this grab simulation can fail
1741to terminate the grab under some conditions. To work around this problem, XKB
1742normally reports the grab state in all events whenever a grab is active.
1743Clients which do not use active grabs like this can set the <emphasis>
1744LookupStateWhenGrabbed</emphasis>
1745 per-client flag in order to receive the same state component whether or not a
1746grab is active.
1747  </para>
1748<para>
1749The <emphasis>
1750GrabsUseXKBState</emphasis>
1751 per-client flag also applies to the state of events sent while a grab is
1752active. If it is set, events during a grab contain the XKB lookup or grab
1753state; by default, events during a grab contain the compatibility lookup or
1754grab state.</para>
1755</listitem>
1756</itemizedlist>
1757
1758<para>
1759The state used to trigger a passive grab is controlled by the setting of the
1760<emphasis>
1761GrabsUseXKBState</emphasis>
1762 per-client flag at the time the grab is registered. Changing this flag does
1763not affect existing passive grabs.
1764</para>
1765</sect2>
1766</sect1>
1767</chapter>
1768