1 2<chapter id='Key_Event_Processing_Overview'> 3<title>Key Event Processing Overview</title> 4 5<para> 6There are three steps to processing each key event in the X server, and at 7least three in the client. This section describes each of these steps briefly; 8the following sections describe each step in more detail. 9</para> 10 11<orderedlist> 12<listitem> 13 <para>First, the server applies global keyboard controls to determine whether 14the key event should be processed immediately, deferred, or ignored. For 15example, the <emphasis> 16SlowKeys</emphasis> 17 control can cause a key event to be deferred until the slow keys delay has 18elapsed while the <emphasis> 19RepeatKeys</emphasis> 20 control can cause multiple X events from a single physical key press if the 21key is held down for an extended period. The global keyboard controls affect 22all of the keys on the keyboard and are described in 23<link linkend='Global_Keyboard_Controls'>Global Keyboard Controls</link>. 24 </para> 25</listitem> 26<listitem> 27 <para>Next, the server applies per-key behavior. Per key-behavior can be used 28to simulate or indicate some special kinds of key behavior. For example, 29keyboard overlays, in which a key generates an alternate keycode under certain 30circumstances, can be implemented using per-key behavior. Every key has a 31single behavior, so the effect of key behavior does not depend on keyboard 32modifier or group state, though it might depend on global keyboard controls. 33Per-key behaviors are described in detail in 34<link linkend='Key_Behavior'>Key Behavior</link>. 35 </para> 36</listitem> 37<listitem> 38 <para>Finally, the server applies key actions. Logically, every keysym on the 39keyboard has some action associated with it. The key action tells the server 40what to do when an event which yields the corresponding keysym is generated. 41Key actions might change or suppress the event, generate some other event, or 42change some aspect of the server. Key actions are described in <link linkend='Key_Actions'>Key Actions</link>. 43 </para> 44</listitem> 45</orderedlist> 46 47<para> 48If the global controls, per-key behavior and key action combine to cause a key 49event, the client which receives the event processes it in several steps. 50</para> 51 52<orderedlist> 53<listitem> 54 <para>First the client extracts the effective keyboard group and a set of 55modifiers from the state field of the event. See <link linkend='Computing_A_State_Field_from_an_XKB_State'>Computing A State Field from an XKB 56State</link> for details. 57 </para> 58</listitem> 59<listitem> 60 <para>Using the modifiers and effective keyboard group, the client selects a 61symbol from the list of keysyms bound to the key. <link linkend='Determining_the_KeySym_Associated_with_a_Key_Event'>Determining the KeySym Associated with a 62Key Event</link> discusses symbol selection. 63 </para> 64</listitem> 65<listitem> 66 <para>If necessary, the client transforms the symbol and resulting string 67using any modifiers that are "left over" from the process of looking up a 68symbol. For example, if the <emphasis> 69Lock</emphasis> 70 modifier is left over, the resulting keysym is capitalized according to the 71capitalization rules specified by the system. See 72<link linkend='Transforming_the_KeySym_Associated_with_a_Key_Event'> 73Transforming the KeySym Associated with a 74Key Event</link> for a more detailed discussion of the transformations defined 75by XKB. 76 </para> 77</listitem> 78<listitem> 79 <para>Finally, the client uses the keysym and remaining modifiers in an 80application-specific way. For example, applications based on the X toolkit 81might apply translations based on the symbol and modifiers reported by the 82first three steps. 83 </para> 84</listitem> 85</orderedlist> 86</chapter> 87