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_Events'>
5<title>Xkb Events</title>
6<indexterm zone="Xkb_Events"><primary>events</primary></indexterm>
7
8<para>
9The primary way the X server communicates with clients is by sending X events
10to them. Some events are sent to all clients, while others are sent only to
11clients that have requested them. Some of the events that can be requested are
12associated with a particular window and are only sent to those clients who have
13both requested the event and specified the window in which the event occurred.
14</para>
15
16
17<para>
18The Xkb extension uses events to communicate the keyboard status to interested
19clients. These events are not associated with a particular window. Instead, all
20Xkb keyboard status events are reported to all interested clients, regardless
21of which window currently has the keyboard focus and regardless of the grab
22state of the keyboard.<footnote><para>The one exception to this rule is the
23XkbExtensionDeviceNotify event report that is sent when a client attempts to
24use an unsupported feature of an X Input Extension device (see <link linkend="Setting_Xkb_Features_for_Non_KeyClass_Input_Extension_Devices">section 21.4</link>).
25</para></footnote>
26</para>
27
28
29<para>
30The X server reports the events defined by the Xkb extension to your client
31application only if you have requested them. You may request Xkb events by
32calling either
33<function>XkbSelectEvents</function>
34or
35<function>XkbSelectEventDetails</function>.
36<function>XkbSelectEvents</function>
37requests Xkb events by their event type and causes them to be reported to your
38client application under all circumstances. You can specify a finer granularity
39for event reporting by using
40<function>XkbSelectEventDetails</function>;
41in this case events are reported only when the specific detail conditions you
42specify have been met.
43</para>
44
45<sect1 id='Xkb_Event_Types'>
46<title>Xkb Event Types</title>
47
48<para>
49The Xkb Extension adds new event types to the X protocol definition. An Xkb
50event type is defined by two fields in the X event data structure. One is the
51<structfield>type</structfield>
52field, containing the
53<emphasis>base event code</emphasis>.
54This base event code is a value the X server assigns to each X extension at
55runtime and that identifies the extension that generated the event; thus, the
56event code in the
57<structfield>type</structfield>
58field identifies the event as an Xkb extension event, rather than an event
59from another extension or a core X protocol event. You can obtain the base
60event code via a call to
61<function>XkbQueryExtension</function>
62or
63<function>XkbOpenDisplay</function>.
64The second field is the Xkb event type, which contains a value uniquely
65identifying each different Xkb event type. Possible values are defined by
66constants declared in the header file
67<filename class="headerfile">&lt;X11/extensions/Xkb.h&gt;</filename>.
68</para>
69
70
71<para>
72<link linkend="table4.1">Table 4.1</link>
73lists the categories of events defined by Xkb and their associated
74event types, as defined in
75<filename class="headerfile">Xkb.h</filename>.
76Each event is described in more detail in the section referenced for that
77event.
78</para>
79
80<table id='table4.1' frame='topbot'>
81<title>Xkb Event Types</title>
82<?dbfo keep-together="always" ?>
83<tgroup cols='3' align='left' colsep='0' rowsep='0'>
84<colspec colname='c1' colwidth='3.0*'/>
85<colspec colname='c2' colwidth='4.0*'/>
86<colspec colname='c3' colwidth='1.0*'/>
87<thead>
88<row rowsep='1'>
89  <entry>Event Type</entry>
90  <entry>Conditions Generating Event</entry>
91  <entry>Section</entry>
92</row>
93</thead>
94<tbody>
95<row>
96  <entry><symbol>XkbNewKeyboardNotify</symbol></entry>
97  <entry>Keyboard geometry; keycode range change</entry>
98  <entry><link linkend="Replacing_a_Keyboard_On_the_Fly">19</link></entry>
99</row>
100<row>
101  <entry><symbol>XkbMapNotify</symbol></entry>
102  <entry>Keyboard mapping change</entry>
103  <entry><link linkend="Tracking_Changes_to_Map_Components">14.4</link></entry>
104</row>
105<row>
106  <entry><symbol>XkbStateNotify</symbol></entry>
107  <entry>Keyboard state change</entry>
108  <entry><link linkend="Tracking_Keyboard_State">5.4</link></entry>
109</row>
110<row>
111  <entry><symbol>XkbControlsNotify</symbol></entry>
112  <entry>Keyboard controls state change</entry>
113  <entry><link linkend="Tracking_Changes_to_Keyboard_Controls">10.11</link></entry>
114</row>
115<row>
116  <entry><symbol>XkbIndicatorStateNotify</symbol></entry>
117  <entry>Keyboard indicators state change</entry>
118  <entry><link linkend="Tracking_Changes_to_Indicator_State_or_Map">8.5</link></entry>
119</row>
120<row>
121  <entry><symbol>XkbIndicatorMapNotify</symbol></entry>
122  <entry>Keyboard indicators map change</entry>
123  <entry><link linkend="Tracking_Changes_to_Indicator_State_or_Map">8.5</link></entry>
124</row>
125<row>
126  <entry><symbol>XkbNamesNotify</symbol></entry>
127  <entry>Keyboard name change</entry>
128  <entry><link linkend="Tracking_Name_Changes">18.5</link></entry>
129</row>
130<row>
131  <entry><symbol>XkbCompatMapNotify</symbol></entry>
132  <entry>Keyboard compatibility map change</entry>
133  <entry><link linkend="Tracking_Changes_to_the_Compatibility_Map">17.5</link></entry>
134</row>
135<row>
136  <entry><symbol>XkbBellNotify</symbol></entry>
137  <entry>Keyboard bell generated</entry>
138  <entry><link linkend="Detecting_Bells">9.4</link></entry>
139</row>
140<row>
141  <entry><symbol>XkbActionMessage</symbol></entry>
142  <entry>Keyboard action message</entry>
143  <entry><link linkend="Actions_for_Generating_Messages">16.1.11</link></entry>
144</row>
145<row>
146  <entry><symbol>XkbAccessXNotify</symbol></entry>
147  <entry>AccessX state change</entry>
148  <entry><link linkend="AccessXNotify_Events">10.6.4</link></entry>
149</row>
150<row>
151  <entry><symbol>XkbExtensionDeviceNotify</symbol></entry>
152  <entry>Extension device change</entry>
153  <entry><link linkend="Tracking_Changes_to_Extension_Devices">21.6</link></entry>
154</row>
155</tbody>
156</tgroup>
157</table>
158
159</sect1>
160<sect1 id='Xkb_Event_Data_Structures'>
161<title>Xkb Event Data Structures</title>
162
163<para id='XkbAnyEvent'>
164<indexterm significance="preferred" zone="Xkb_Event_Data_Structures">
165<primary>events</primary><secondary><structname>XkbAnyEvent</structname></secondary></indexterm>
166<indexterm significance="preferred" zone="Xkb_Event_Data_Structures">
167<primary><structname>XkbAnyEvent</structname></primary></indexterm>
168Xkb reports each event it generates in a unique structure holding the data
169values needed to describe the conditions the event is reporting. However, all
170Xkb events have certain things in common. These common features are contained
171in the same fields at the beginning of all Xkb event structures and are
172described in the
173<structname>XkbAnyEvent</structname>
174structure:
175
176<programlisting>
177typedef struct {
178    int             type;        /* Xkb extension base event code */
179    unsigned long   serial;      /* X server serial number for event */
180    Bool            send_event;  /* <symbol>True</symbol> &rArr; synthetically generated */
181    Display *       display;     /* server connection where event generated */
182    Time            time;        /* server time when event generated */
183    int             xkb_type;    /* Xkb minor event code */
184    unsigned int    device;      /* Xkb device ID, will not be <symbol>XkbUseCoreKbd</symbol> */
185} <structname>XkbAnyEvent</structname>;
186</programlisting></para>
187
188<para>
189For any Xkb event, the
190<structfield>type</structfield>
191field is set to the base event code for the Xkb extension, assigned by the
192server to all Xkb extension events. The
193<structfield>serial</structfield>,
194<structfield>send_event</structfield>,
195and
196<structfield>display</structfield>
197fields are as described for all X11 events. The
198<structfield>time</structfield>
199field is set to the time when the event was generated and is expressed in
200milliseconds. The
201<structfield>xkb_type</structfield>
202field contains the minor extension event code, which is the extension event
203type, and is one of the values listed in
204<link linkend="table4.1">Table 4.1</link>. The
205<structfield>device</structfield>
206field contains the keyboard device identifier associated with the event. This
207is never
208<symbol>XkbUseCoreKbd</symbol>,
209even if the request that generated the event specified a device of
210<symbol>XkbUseCoreKbd</symbol>.
211If the request that generated the event specified
212<symbol>XkbUseCoreKbd</symbol>,
213<structfield>device</structfield>
214contains a value assigned by the server to specify the core keyboard. If the
215request that generated the event specified an X input extension device,
216<structfield>device</structfield>
217contains that same identifier.
218</para>
219
220
221<para>
222Other data fields specific to individual Xkb events are described in subsequent
223chapters where the events are described.
224</para>
225
226
227</sect1>
228<sect1 id='Selecting_Xkb_Events'>
229<title>Selecting Xkb Events</title>
230<indexterm significance="preferred" zone="Selecting_Xkb_Events">
231<primary>events</primary><secondary>mask</secondary></indexterm>
232<indexterm significance="preferred" zone="Selecting_Xkb_Events">
233<primary>mask</primary><secondary>event</secondary></indexterm>
234
235<para>
236Xkb events are selected using an event mask, much the same as normal core X
237events are selected. However, unlike selecting core X events, where you must
238specify the selection status (on or off) for all possible event types whenever
239you wish to change the selection criteria for any one event, Xkb allows you to
240restrict the specification to only the event types you wish to change. This
241means that you do not need to remember the event selection values for all
242possible types each time you want to change one of them.
243</para>
244
245
246<para>
247Many Xkb event types are generated under several different circumstances. When
248selecting to receive an Xkb event, you may specify either that you want it
249delivered under all circumstances, or that you want it delivered only for a
250subset of the possible circumstances.
251</para>
252
253<para>
254You can also deselect an event type that was previously selected for, using the
255same granularity.
256</para>
257
258<para>
259Xkb provides two functions to select and deselect delivery of Xkb events.
260<function>XkbSelectEvents</function>
261allows you to select or deselect delivery of more than one Xkb event type at
262once. Events selected using
263<function>XkbSelectEvents</function>
264are delivered to your program under all circumstances that generate the
265events. To restrict delivery of an event to a subset of the conditions under
266which it occurs, use
267<function>XkbSelectEventDetails</function>.
268<function>XkbSelectEventDetails</function>
269only allows you to change the selection conditions for a single event at a
270time, but it provides a means of fine-tuning the conditions under which the
271event is delivered.
272</para>
273
274
275<para>
276To select and / or deselect for delivery of one or more Xkb events and have
277them delivered under all conditions, use
278<function>XkbSelectEvents</function>.
279</para>
280
281<indexterm significance="preferred" zone="XkbSelectEvents"><primary><function>XkbSelectEvents</function></primary></indexterm>
282<funcsynopsis id="XkbSelectEvents">
283  <funcprototype>
284    <funcdef>Bool <function>XkbSelectEvents</function></funcdef>
285<!-- (
286<parameter>display, device_spec, bits_to_change, values_for_bits</parameter>
287) -->
288
289    <paramdef>Display *<parameter>display</parameter></paramdef>
290    <paramdef>unsigned int <parameter>device_spec</parameter></paramdef>
291    <paramdef>unsigned long int <parameter>bits_to_change</parameter></paramdef>
292    <paramdef>unsigned long int <parameter>values_for_bits</parameter></paramdef>
293  </funcprototype>
294</funcsynopsis>
295<variablelist>
296  <varlistentry>
297    <term>
298      <parameter>display</parameter>
299    </term>
300    <listitem>
301      <para>
302        connection to the X server
303      </para>
304    </listitem>
305  </varlistentry>
306  <varlistentry>
307    <term>
308      <parameter>device_spec</parameter>
309    </term>
310    <listitem>
311      <para>
312        device ID, or <symbol>XkbUseCoreKbd</symbol>
313      </para>
314    </listitem>
315  </varlistentry>
316  <varlistentry>
317    <term>
318      <parameter>bits_to_change</parameter>
319    </term>
320    <listitem>
321      <para>
322        determines events to be selected / deselected
323      </para>
324    </listitem>
325  </varlistentry>
326  <varlistentry>
327    <term>
328      <parameter>values_for_bits</parameter>
329    </term>
330    <listitem>
331      <para>
332        1&rArr;select, 0&rarr;deselect; for events in <parameter>bits_to_change</parameter>
333      </para>
334    </listitem>
335  </varlistentry>
336</variablelist>
337
338<para>
339This request changes the Xkb event selection mask for the keyboard specified by
340<parameter>device_spec</parameter>.
341</para>
342
343
344<para>
345Each Xkb event that can be selected is represented by a bit in the
346<parameter>bits_to_change</parameter>
347and
348<parameter>values_for_bits</parameter>
349masks. Only the event selection bits specified by the
350<parameter>bits_to_change</parameter>
351parameter are affected; any unspecified bits are left unchanged. To turn on
352event selection for an event, set the bit for the event in the
353<parameter>bits_to_change</parameter>
354parameter and set the corresponding bit in the
355<parameter>values_for_bits</parameter>
356parameter. To turn off event selection for an event, set the bit for the event
357in the
358<parameter>bits_to_change</parameter>
359parameter and do not set the corresponding bit in the
360<parameter>values_for_bits</parameter>
361parameter. The valid values for both of these parameters are an inclusive
362bitwise OR of the masks shown in <link linkend="table4.2">Table 4.2</link>.
363There is no interface to return
364your client’s current event selection mask. Clients cannot set other
365clients’ event selection masks.
366</para>
367
368
369<para>
370If a bit is not set in the
371<parameter>bits_to_change</parameter>
372parameter, but the corresponding bit is set in the
373<parameter>values_for_bits</parameter>
374parameter, a
375<errorname>BadMatch</errorname>
376protocol error results. If an undefined bit is set in either the
377<parameter>bits_to_change</parameter>
378or the
379<parameter>values_for_bits</parameter>
380parameter, a
381<errorname>BadValue</errorname>
382protocol error results.
383</para>
384
385
386<para>
387All event selection bits are initially zero for clients using the Xkb
388extension. Once you set some bits, they remain set for your client until you
389clear them via another call to
390<function>XkbSelectEvents</function>.
391</para>
392
393
394<para>
395<function>XkbSelectEvents</function>
396returns
397<symbol>False</symbol>
398if the Xkb extension has not been initialized and
399<symbol>True</symbol>
400otherwise.
401</para>
402
403
404<para>
405To select or deselect for a specific Xkb event and optionally place conditions
406on when events of that type are reported to your client, use
407<function>XkbSelectEventDetails</function>.
408This allows you to exercise a finer granularity of control over delivery of
409Xkb events with
410<function>XkbSelectEvents</function>.
411</para>
412
413
414<indexterm significance="preferred" zone="XkbSelectEventDetails"><primary><function>XkbSelectEventDetails</function></primary></indexterm>
415<funcsynopsis id="XkbSelectEventDetails">
416  <funcprototype>
417    <funcdef>Bool <function>XkbSelectEventDetails</function></funcdef>
418<!-- (
419<parameter>display, device_spec, event_type, bits_to_change</parameter>,
420<parameter>values_for_bits</parameter>
421) -->
422
423    <paramdef>Display *<parameter>display</parameter></paramdef>
424    <paramdef>unsigned int <parameter>device_spec</parameter></paramdef>
425    <paramdef>unsigned int <parameter>event_type</parameter></paramdef>
426    <paramdef>unsigned long int <parameter>bits_to_change</parameter></paramdef>
427    <paramdef>unsigned long int <parameter>values_for_bits</parameter></paramdef>
428  </funcprototype>
429</funcsynopsis>
430<variablelist>
431  <varlistentry>
432    <term>
433      <parameter>display</parameter>
434    </term>
435    <listitem>
436      <para>
437        connection to the X server
438      </para>
439    </listitem>
440  </varlistentry>
441  <varlistentry>
442    <term>
443      <parameter>device_spec</parameter>
444    </term>
445    <listitem>
446      <para>
447        device ID, or <symbol>XkbUseCoreKbd</symbol>
448      </para>
449    </listitem>
450  </varlistentry>
451  <varlistentry>
452    <term>
453      <parameter>event_type</parameter>
454    </term>
455    <listitem>
456      <para>
457        Xkb event type of interest
458      </para>
459    </listitem>
460  </varlistentry>
461  <varlistentry>
462    <term>
463      <parameter>bits_to_change</parameter>
464    </term>
465    <listitem>
466      <para>
467        event selection details
468      </para>
469    </listitem>
470  </varlistentry>
471  <varlistentry>
472    <term>
473      <parameter>values_for_bits</parameter>
474    </term>
475    <listitem>
476      <para>
477        values for bits selected by <parameter>bits_to_change</parameter>
478      </para>
479    </listitem>
480  </varlistentry>
481</variablelist>
482
483<para>
484While
485<function>XkbSelectEvents</function>
486allows multiple events to be selected,
487<function>XkbSelectEventDetails</function>
488changes the selection criteria for a single type of Xkb event. The
489interpretation of the
490<parameter>bits_to_change</parameter>
491and
492<parameter>values_for_bits</parameter>
493masks depends on the event type in question.
494</para>
495
496
497<para>
498<function>XkbSelectEventDetails</function>
499changes the Xkb event selection mask for the keyboard specified by
500<parameter>device_spec</parameter>
501and the Xkb event specified by
502<parameter>event_type</parameter>.
503To turn on event selection for an event detail, set the bit for the detail in
504the
505<parameter>bits_to_change</parameter>
506parameter and set the corresponding bit in the
507<parameter>values_for_bits</parameter>
508parameter. To turn off event detail selection for a detail, set the bit for
509the detail in the
510<parameter>bits_to_change</parameter>
511parameter and do not set the corresponding bit in the
512<parameter>values_for_bits</parameter>
513parameter.
514</para>
515
516
517<para>
518If an invalid event type is specified, a
519<errorname>BadValue</errorname>
520protocol error results. If a bit is not set in the
521<parameter>bits_to_change</parameter>
522parameter, but the corresponding bit is set in the
523<parameter>values_for_bits</parameter>
524parameter, a
525<errorname>BadMatch</errorname>
526protocol error results. If an undefined bit is set in either the
527<parameter>bits_to_change</parameter>
528or the
529<parameter>values_for_bits</parameter>
530parameter, a
531<errorname>BadValue</errorname>
532protocol error results.
533</para>
534
535
536<para>
537For each type of Xkb event, the legal event details that you can specify in the
538<function>XkbSelectEventDetails</function>
539request are listed in the chapters that describe each event in detail.
540</para>
541
542
543<sect2 id='Event_Masks'>
544<title>Event Masks</title>
545
546<para>
547The X server reports the events defined by Xkb to your client application only
548if you have requested them via a call to
549<function>XkbSelectEvents</function>
550or
551<function>XkbSelectEventDetails</function>.
552Specify the event types in which you are interested in a mask, as described
553in <link linkend="Selecting_Xkb_Events">section 4.3</link>.
554</para>
555
556
557<para>
558<link linkend="table4.2">Table 4.2</link>
559lists the event mask constants that can be specified with the
560<function>XkbSelectEvents</function>
561request and the circumstances in which the mask should be specified.
562</para>
563
564<table id='table4.2' frame='topbot'>
565<title>XkbSelectEvents Mask Constants</title>
566<?dbfo keep-together="always" ?>
567<tgroup cols='3' align='left' colsep='0' rowsep='0'>
568<colspec colname='c1' colwidth='2.0*'/>
569<colspec colname='c2' colwidth='1.0*'/>
570<colspec colname='c3' colwidth='2.0*'/>
571<thead>
572<row rowsep='1'>
573  <entry>Event Mask</entry>
574  <entry>Value</entry>
575  <entry>Notification Wanted</entry>
576</row>
577</thead>
578<tbody>
579  <row>
580    <entry>
581<symbol>XkbNewKeyboardNotifyMask</symbol>
582    </entry>
583    <entry>(1L&lt;&lt;0)</entry>
584    <entry>Keyboard geometry change</entry>
585  </row>
586  <row>
587    <entry>
588      <symbol>XkbMapNotifyMask</symbol>
589    </entry>
590    <entry>(1L&lt;&lt;1)</entry>
591    <entry>Keyboard mapping change</entry>
592  </row>
593  <row>
594    <entry>
595<para><symbol>XkbStateNotifyMask</symbol></para>
596    </entry>
597    <entry>(1L&lt;&lt;2)</entry>
598    <entry><para>Keyboard state change</para></entry>
599  </row>
600  <row>
601    <entry>
602<para><symbol>XkbControlsNotifyMask</symbol></para>
603    </entry>
604    <entry>(1L&lt;&lt;3)</entry>
605    <entry>Keyboard control change</entry>
606  </row>
607  <row>
608    <entry>
609<symbol>XkbIndicatorStateNotifyMask</symbol>
610    </entry>
611    <entry>(1L&lt;&lt;4)</entry>
612    <entry>Keyboard indicator state change</entry>
613  </row>
614  <row>
615    <entry>
616<symbol>XkbIndicatorMapNotifyMask</symbol>
617    </entry>
618    <entry>(1L&lt;&lt;5)</entry>
619    <entry>Keyboard indicator map change</entry>
620  </row>
621  <row>
622    <entry>
623<symbol>XkbNamesNotifyMask</symbol>
624    </entry>
625    <entry>(1L&lt;&lt;6)</entry>
626    <entry>Keyboard name change</entry>
627  </row>
628  <row>
629    <entry>
630<symbol>XkbCompatMapNotifyMask</symbol>
631    </entry>
632    <entry>(1L&lt;&lt;7)</entry>
633    <entry>Keyboard compat map change</entry>
634  </row>
635  <row>
636    <entry>
637<symbol>XkbBellNotifyMask</symbol>
638    </entry>
639    <entry>(1L&lt;&lt;8)</entry>
640    <entry>Bell</entry>
641  </row>
642  <row>
643    <entry>
644<symbol>XkbActionMessageMask</symbol>
645    </entry>
646    <entry>(1L&lt;&lt;9)</entry>
647    <entry>Action message</entry>
648  </row>
649  <row>
650    <entry>
651<symbol>XkbAccessXNotifyMask</symbol>
652    </entry>
653    <entry>(1L&lt;&lt;10)</entry>
654    <entry>AccessX features</entry>
655  </row>
656  <row>
657    <entry>
658<symbol>XkbExtensionDeviceNotifyMask</symbol>
659    </entry>
660    <entry>(1L&lt;&lt;11)</entry>
661    <entry>Extension device</entry>
662  </row>
663  <row>
664    <entry>
665<symbol>XkbAllEventsMask</symbol>
666    </entry>
667    <entry>(0xFFF)</entry>
668    <entry>All Xkb events</entry>
669  </row>
670</tbody>
671</tgroup>
672</table>
673
674</sect2>
675</sect1>
676<sect1 id='Unified_Xkb_Event_Type'>
677<title>Unified Xkb Event Type</title>
678<indexterm significance="preferred" zone="Unified_Xkb_Event_Type">
679<primary>events</primary><secondary><structname>XkbEvent</structname></secondary></indexterm>
680<indexterm significance="preferred" zone="Unified_Xkb_Event_Type">
681<primary><structname>XkbEvent</structname></primary></indexterm>
682
683<para>
684The
685<structname>XkbEvent</structname>
686structure is a union of the individual structures declared for each Xkb event
687type and for the core protocol
688<structname>XEvent</structname>
689type. Given an
690<structname>XkbEvent</structname>
691structure, you may use the
692<structfield>type</structfield>
693field to determine if the event is an Xkb event
694(<structfield>type</structfield>
695equals the Xkb base event code; see <link linkend="Initializing_the_Keyboard_Extension">section 2.4</link>). If the event is an Xkb
696event, you may then use the
697<structfield>any.xkb_type</structfield>
698field to determine the type of Xkb event and thereafter access the
699event-dependent components using the union member corresponding to the
700particular Xkb event type.
701</para>
702
703<para><programlisting>
704typedef union _XkbEvent {
705      int                            type;
706      XkbAnyEvent                    any;
707      XkbStateNotifyEvent            state;
708      XkbMapNotifyEvent              map;
709      XkbControlsNotifyEvent         ctrls;
710      XkbIndicatorNotifyEvent        indicators;
711      XkbBellNotifyEvent             bell;
712      XkbAccessXNotifyEvent          accessx;
713      XkbNamesNotifyEvent            names;
714      XkbCompatMapNotifyEvent        compat;
715      XkbActionMessageEvent          message;
716      XkbExtensionDeviceNotifyEvent  device;
717      XkbNewKeyboardNotifyEvent      new_kbd;
718      XEvent                         core;
719} <structname>XkbEvent</structname>;
720</programlisting></para>
721
722<para>
723This unified Xkb event type includes a normal
724<structname>XEvent</structname>
725as used by the core protocol, so it is straightforward for applications that
726use Xkb events to call the X library event functions without having to cast
727every reference. For example, to get the next event, you can simply declare a
728variable of type
729<structname>XkbEvent</structname>
730and call:
731
732<programlisting>XNextEvent(dpy,&amp;xkbev.core);</programlisting>
733</para>
734</sect1>
735</chapter>
736