1<part id="sect1-9">
2<preface id="acknowledgements">
3<title>Acknowledgements</title>
4<para>
5The primary contributors to the X11 protocol are:
6</para>
7
8<itemizedlist>
9<listitem><para>Dave Carver (Digital HPW)</para></listitem>
10<listitem><para>Branko Gerovac (Digital HPW)</para></listitem>
11<listitem><para>Jim Gettys (MIT/Project Athena, Digital)</para></listitem>
12<listitem><para>Phil Karlton (Digital WSL)</para></listitem>
13<listitem><para>Scott McGregor (Digital SSG)</para></listitem>
14<listitem><para>Ram Rao (Digital UEG)</para></listitem>
15<listitem><para>David Rosenthal (Sun)</para></listitem>
16<listitem><para>Dave Winchell (Digital UEG)</para></listitem>
17</itemizedlist>
18
19<para>
20The implementors of initial server who provided useful
21input are:
22</para>
23
24<itemizedlist>
25<listitem><para>Susan Angebranndt (Digital)</para></listitem>
26<listitem><para>Raymond Drewry (Digital)</para></listitem>
27<listitem><para>Todd Newman (Digital)</para></listitem>
28</itemizedlist>
29
30<para>
31The invited reviewers who provided useful input are:
32</para>
33
34<itemizedlist>
35<listitem><para>Andrew Cherenson (Berkeley)</para></listitem>
36<listitem><para>Burns Fisher (Digital)</para></listitem>
37<listitem><para>Dan Garfinkel (HP)</para></listitem>
38<listitem><para>Leo Hourvitz (Next)</para></listitem>
39<listitem><para>Brock Krizan (HP)</para></listitem>
40<listitem><para>David Laidlaw (Stellar)</para></listitem>
41<listitem><para>Dave Mellinger (Interleaf)</para></listitem>
42<listitem><para>Ron Newman (MIT)</para></listitem>
43<listitem><para>John Ousterhout (Berkeley)</para></listitem>
44<listitem><para>Andrew Palay (ITC CMU)</para></listitem>
45<listitem><para>Ralph Swick (MIT)</para></listitem>
46<listitem><para>Craig Taylor (Sun)</para></listitem>
47<listitem><para>Jeffery Vroom (Stellar)</para></listitem>
48</itemizedlist>
49
50<para>
51Thanks go to Al Mento of Digital's UEG Documentation Group for
52formatting this document.
53</para>
54
55<para>
56This document does not attempt to provide the rationale or pragmatics required
57to fully understand the protocol or to place it in perspective within a
58complete system.
59</para>
60
61<para>
62The protocol contains many management mechanisms that are not intended for
63normal applications.
64Not all mechanisms are needed to build a particular user interface.
65It is important to keep in mind that the protocol is intended to
66provide mechanism, not policy.
67</para>
68
69<para>
70Robert W. Scheifler
71</para>
72<para>
73X Consortium, Inc.
74</para>
75</preface>
76
77<chapter id='Protocol_Formats'>
78  <title>Protocol Formats</title>
79
80  <section id="request_format">
81    <title>Request Format</title>
82    <indexterm zone="request_format" significance="preferred"><primary>Request</primary><secondary>format</secondary></indexterm>
83    <para>
84Every request contains an 8-bit <firstterm id="major_opcode">major opcode</firstterm>
85<indexterm zone="major_opcode" significance="preferred"><primary>Opcode</primary><secondary>major</secondary></indexterm>
86and a 16-bit <firstterm id="request_length">length field</firstterm>
87<indexterm zone="request_length" significance="preferred"><primary>Request</primary><secondary>length</secondary></indexterm>
88expressed in units of four bytes.
89Every request consists of four bytes of a header
90(containing the major opcode, the length field, and a data byte)
91followed by zero or more additional bytes of data.
92The length field defines the total length of the request, including the header.
93The length field in a request must equal the minimum length required to contain
94the request.
95If the specified length is smaller or larger than the required length,
96an error is generated.
97Unused bytes in a request are not required to be zero.
98Major opcodes 128 through 255 are reserved for 
99<firstterm id="extension">extensions</firstterm>.
100<indexterm zone="extension"><primary>Extension</primary></indexterm>
101Extensions are intended to contain multiple requests,
102so extension requests typically have an additional 
103<firstterm id="minor_opcode">minor opcode</firstterm> encoded
104in the second data byte in the request header.
105<indexterm zone="minor_opcode" significance="preferred"><primary>Opcode</primary><secondary>minor</secondary></indexterm>
106However, the placement and interpretation of this minor opcode and of all
107other fields in extension requests are not defined by the core protocol.
108Every request on a given connection is implicitly assigned a
109<firstterm id="sequence_number">sequence number</firstterm>,
110<indexterm zone="sequence_number" significance="preferred"><primary>Sequence number</primary></indexterm>
111starting with one, that is used in replies, errors, and events.
112    </para>
113  </section>
114
115  <section id="reply_format">
116    <title>Reply Format</title>
117    <indexterm zone="reply_format" significance="preferred"><primary>Reply</primary><secondary>format</secondary></indexterm>
118    <para>
119Every <firstterm>reply</firstterm> contains a 32-bit length field
120expressed in units of four bytes.
121Every reply consists of 32 bytes followed by zero or more additional bytes of
122data, as specified in the length field.
123Unused bytes within a reply are not guaranteed to be zero.
124Every reply also contains the least significant 16 bits of the sequence number
125of the corresponding request.
126    </para>
127  </section>
128
129  <section id="error_format">
130    <title>Error Format</title>
131    <indexterm zone="error_format" significance="preferred"><primary>Error report</primary><secondary>format</secondary></indexterm>
132    <para>
133Error reports are 32 bytes long.
134Every error includes an 8-bit error code.
135<phrase id="errors:extensions">
136Error codes 128 through 255 are reserved for extensions.
137</phrase>
138<indexterm zone="errors:extensions" significance="preferred"><primary>Error Codes</primary><secondary>extensions</secondary></indexterm>
139<indexterm zone="errors:extensions" significance="preferred"><primary>Extension</primary><secondary>error codes</secondary></indexterm>
140Every error also includes the major and minor opcodes of the failed request
141and the least significant 16 bits of the sequence number of the request.
142For the following errors (see <link linkend='Errors'>section 4</link>),
143the failing resource ID is also returned:
144<emphasis role='bold'>Colormap</emphasis>,
145<emphasis role='bold'>Cursor</emphasis>,
146<emphasis role='bold'>Drawable</emphasis>,
147<emphasis role='bold'>Font</emphasis>,
148<emphasis role='bold'>GContext</emphasis>,
149<emphasis role='bold'>IDChoice</emphasis>,
150<emphasis role='bold'>Pixmap</emphasis>
151and
152<emphasis role='bold'>Window</emphasis>.
153For
154<emphasis role='bold'>Atom</emphasis>
155errors, the failing atom is returned.
156For
157<emphasis role='bold'>Value</emphasis>
158errors, the failing value is returned.
159Other core errors return no additional data.
160Unused bytes within an error are not guaranteed to be zero.
161    </para>
162  </section>
163
164  <section id="event_format">
165    <title>Event Format</title>
166    <indexterm zone="event_format" significance="preferred"><primary>Event</primary><secondary>format</secondary></indexterm>
167    <para>
168<firstterm>Events</firstterm> are 32 bytes long.
169Unused bytes within an event are not guaranteed to be zero.
170Every event contains an 8-bit type code.
171The most significant bit in this code is set if the event was generated from a
172<link linkend="requests:SendEvent"><emphasis role='bold'>SendEvent</emphasis></link>
173request.
174<phrase id="events:extensions">
175Event codes 64 through 127 are reserved for extensions, although the core
176protocol does not define a mechanism for selecting interest in such events.
177</phrase>
178<indexterm zone="events:extensions" significance="preferred"><primary>Event</primary><secondary>extension</secondary></indexterm>
179<indexterm zone="events:extensions" significance="preferred"><primary>Extension</primary><secondary>event</secondary></indexterm>
180Every core event (with the exception of
181<link linkend="events:KeymapNotify"><emphasis role='bold'>KeymapNotify</emphasis></link>)
182also contains the least significant 16 bits of the sequence number of the last
183request issued by the client that was (or is currently being) processed by
184the server.
185    </para>
186  </section>
187</chapter>
188
189<chapter id='Syntactic_Conventions'>
190<title>Syntactic Conventions</title>
191<!-- .XS -->
192<!-- (SN Syntactic Conventions -->
193<!-- .XE -->
194<para>
195<!-- .LP -->
196The rest of this document uses the following syntactic conventions.
197</para>
198<itemizedlist>
199  <listitem>
200    <para>
201The syntax {...} encloses a set of alternatives.
202    </para>
203  </listitem>
204  <listitem>
205    <para>
206The syntax [...] encloses a set of structure components.
207    </para>
208  </listitem>
209  <listitem>
210    <para>
211In general, TYPEs are in uppercase and
212<emphasis role='bold'>AlternativeValues</emphasis>
213are capitalized.
214    </para>
215  </listitem>
216  <listitem>
217    <para>
218Requests in <link linkend='Requests'>section 9</link> are described
219in the following format:
220<literallayout class="monospaced">
221<emphasis role='bold'>RequestName</emphasis>
222     <emphasis remap='I'>arg1</emphasis>: type1
223     ...
224     <emphasis remap='I'>argN</emphasis>: typeN
225226     result1: type1
227     ...
228     resultM: typeM
229
230     Errors: kind1, ..., kindK
231
232     Description.
233</literallayout>
234    </para>
235    <para>
236If no ▶ is present in the description,
237then the request has no reply (it is asynchronous),
238although errors may still be reported.
239If ▶+ is used,
240then one or more replies can be generated for a single request.
241    </para>
242  </listitem>
243  <listitem>
244    <para>
245Events in <link linkend='Events'>section 11</link> are described
246in the following format:
247<literallayout class="monospaced">
248<emphasis role='bold'>EventName</emphasis>
249     <emphasis remap='I'>value1</emphasis>: type1
250     ...
251     <emphasis remap='I'>valueN</emphasis>: typeN
252
253     Description.
254</literallayout>
255    </para>
256  </listitem>
257</itemizedlist>
258</chapter>
259
260<chapter id='Common_Types'>
261<title>Common Types</title>
262<!-- .XS -->
263<!-- (SN Common Types -->
264<!-- .XE -->
265<informaltable frame="topbot">
266  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
267  <colspec colname='c1' colwidth='1.0*'/>
268  <colspec colname='c2' colwidth='2.0*'/>
269  <thead>
270    <row rowsep='1'>
271      <entry>Name</entry>
272      <entry>Value</entry>
273    </row>
274  </thead>
275  <tbody>
276    <row>
277      <entry id="types:LISTofFOO">LISTofFOO<indexterm zone="types:LISTofFOO" significance="preferred"><primary>Types</primary><secondary>LISTofFOO</secondary></indexterm></entry>
278      <entry>
279
280A type name of the form LISTofFOO means a counted list of elements of type
281FOO.
282The size of the length field may vary (it is not necessarily the same
283size as a FOO), and in some cases, it may be implicit.
284It is fully specified in Appendix B.
285Except where explicitly noted,
286zero-length lists are legal.
287      </entry>
288    </row>
289    <row>
290      <entry><para id="types:BITMASK">BITMASK<indexterm zone="types:BITMASK" significance="preferred"><primary>Types</primary><secondary>BITMASK</secondary></indexterm></para><para id="types:LISTofVALUE">LISTofVALUE<indexterm zone="types:LISTofVALUE" significance="preferred"><primary>Types</primary><secondary>LISTofVALUE</secondary></indexterm></para></entry>
291      <entry>
292<para>
293The types BITMASK and LISTofVALUE are somewhat special.
294Various requests contain arguments of the form:
295</para>
296<para>
297<emphasis remap='I'>value-mask</emphasis>: BITMASK
298</para>
299<para>
300<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
301</para>
302<para>
303These are used to allow the client to specify a subset of a heterogeneous
304collection of optional arguments.
305The value-mask specifies which arguments are to be provided;
306each such argument is assigned a unique bit position.
307The representation of the BITMASK will typically contain more bits than
308there are defined arguments.
309The unused bits in the value-mask must be zero (or the server generates a
310<emphasis role='bold'>Value</emphasis>
311error).
312The value-list contains one value for each bit set to 1 in the mask,
313from least significant to most significant bit in the mask.
314Each value is represented with four bytes,
315but the actual value occupies only the least significant bytes as required.
316The values of the unused bytes do not matter.
317</para>
318      </entry>
319    </row>
320    <row>
321      <entry id="types:OR">OR<indexterm zone="types:OR" significance="preferred"><primary>Types</primary><secondary>OR</secondary></indexterm></entry>
322      <entry>
323A type of the form "T1 or ... or Tn" means the union of the indicated types.
324A single-element type is given as the element without enclosing braces.
325      </entry>
326    </row>
327    <row>
328      <entry id="types:WINDOW">WINDOW<indexterm zone="types:WINDOW" significance="preferred"><primary>Types</primary><secondary>WINDOW</secondary></indexterm></entry>
329      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
330    </row>
331    <row>
332      <entry id="types:PIXMAP">PIXMAP<indexterm zone="types:PIXMAP" significance="preferred"><primary>Types</primary><secondary>PIXMAP</secondary></indexterm></entry>
333      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
334    </row>
335    <row>
336      <entry id="types:CURSOR">CURSOR<indexterm zone="types:CURSOR" significance="preferred"><primary>Types</primary><secondary>CURSOR</secondary></indexterm></entry>
337      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
338    </row>
339    <row>
340      <entry id="types:FONT">FONT<indexterm zone="types:FONT" significance="preferred"><primary>Types</primary><secondary>FONT</secondary></indexterm></entry>
341      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
342    </row>
343    <row>
344      <entry id="types:GCONTEXT">GCONTEXT<indexterm zone="types:GCONTEXT" significance="preferred"><primary>Types</primary><secondary>GCONTEXT</secondary></indexterm></entry>
345      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
346    </row>
347    <row>
348      <entry id="types:COLORMAP">COLORMAP<indexterm zone="types:COLORMAP" significance="preferred"><primary>Types</primary><secondary>COLORMAP</secondary></indexterm></entry>
349      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
350    </row>
351    <row>
352      <entry id="types:DRAWABLE">DRAWABLE<indexterm zone="types:DRAWABLE" significance="preferred"><primary>Types</primary><secondary>DRAWABLE</secondary></indexterm></entry>
353      <entry>WINDOW or PIXMAP</entry>
354    </row>
355    <row>
356      <entry id="types:FONTABLE">FONTABLE<indexterm zone="types:FONTABLE" significance="preferred"><primary>Types</primary><secondary>FONTABLE</secondary></indexterm></entry>
357      <entry>FONT or GCONTEXT</entry>
358    </row>
359    <row>
360      <entry id="types:ATOM">ATOM<indexterm zone="types:ATOM" significance="preferred"><primary>Types</primary><secondary>ATOM</secondary></indexterm></entry>
361      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
362    </row>
363    <row>
364      <entry id="types:VISUALID">VISUALID<indexterm zone="types:VISUALID" significance="preferred"><primary>Types</primary><secondary>VISUALID</secondary></indexterm></entry>
365      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
366    </row>
367    <row>
368      <entry id="types:VALUE">VALUE<indexterm zone="types:VALUE" significance="preferred"><primary>Types</primary><secondary>VALUE</secondary></indexterm></entry>
369      <entry>32-bit quantity (used only in LISTofVALUE)</entry>
370    </row>
371    <row>
372      <entry id="types:BYTE">BYTE<indexterm zone="types:BYTE" significance="preferred"><primary>Types</primary><secondary>BYTE</secondary></indexterm></entry>
373      <entry>8-bit value</entry>
374    </row>
375    <row>
376      <entry id="types:INT8">INT8<indexterm zone="types:INT8" significance="preferred"><primary>Types</primary><secondary>INT8</secondary></indexterm></entry>
377      <entry>8-bit signed integer</entry>
378    </row>
379    <row>
380      <entry id="types:INT16">INT16<indexterm zone="types:INT16" significance="preferred"><primary>Types</primary><secondary>INT16</secondary></indexterm></entry>
381      <entry>16-bit signed integer</entry>
382    </row>
383    <row>
384      <entry id="types:INT32">INT32<indexterm zone="types:INT32" significance="preferred"><primary>Types</primary><secondary>INT32</secondary></indexterm></entry>
385      <entry>32-bit signed integer</entry>
386    </row>
387    <row>
388      <entry id="types:CARD8">CARD8<indexterm zone="types:CARD8" significance="preferred"><primary>Types</primary><secondary>CARD8</secondary></indexterm></entry>
389      <entry>8-bit unsigned integer</entry>
390    </row>
391    <row>
392      <entry id="types:CARD16">CARD16<indexterm zone="types:CARD16" significance="preferred"><primary>Types</primary><secondary>CARD16</secondary></indexterm></entry>
393      <entry>16-bit unsigned integer</entry>
394    </row>
395    <row>
396      <entry id="types:CARD32">CARD32<indexterm zone="types:CARD32" significance="preferred"><primary>Types</primary><secondary>CARD32</secondary></indexterm></entry>
397      <entry>32-bit unsigned integer</entry>
398    </row>
399    <row>
400      <entry id="types:TIMESTAMP">TIMESTAMP<indexterm zone="types:TIMESTAMP" significance="preferred"><primary>Types</primary><secondary>TIMESTAMP</secondary></indexterm></entry>
401      <entry>CARD32</entry>
402    </row>
403    <row>
404      <entry id="types:BITGRAVITY">BITGRAVITY<indexterm zone="types:BITGRAVITY" significance="preferred"><primary>Types</primary><secondary>BITGRAVITY</secondary></indexterm></entry>
405      <entry>
406{ <emphasis role='bold'>Forget</emphasis>,
407<emphasis role='bold'>Static</emphasis>,
408<emphasis role='bold'>NorthWest</emphasis>,
409<emphasis role='bold'>North</emphasis>,
410<emphasis role='bold'>NorthEast</emphasis>,
411<emphasis role='bold'>West</emphasis>,
412<emphasis role='bold'>Center</emphasis>,
413<emphasis role='bold'>East</emphasis>,
414<emphasis role='bold'>SouthWest</emphasis>,
415<emphasis role='bold'>South</emphasis>,
416<emphasis role='bold'>SouthEast</emphasis> }
417      </entry>
418    </row>
419    <row>
420      <entry id="types:WINGRAVITY">WINGRAVITY<indexterm zone="types:WINGRAVITY" significance="preferred"><primary>Types</primary><secondary>WINGRAVITY</secondary></indexterm></entry>
421      <entry>
422{ <emphasis role='bold'>Unmap</emphasis>,
423<emphasis role='bold'>Static</emphasis>,
424<emphasis role='bold'>NorthWest</emphasis>,
425<emphasis role='bold'>North</emphasis>,
426<emphasis role='bold'>NorthEast</emphasis>,
427<emphasis role='bold'>West</emphasis>,
428<emphasis role='bold'>Center</emphasis>,
429<emphasis role='bold'>East</emphasis>,
430<emphasis role='bold'>SouthWest</emphasis>,
431<emphasis role='bold'>South</emphasis>,
432<emphasis role='bold'>SouthEast</emphasis> }
433      </entry>
434    </row>
435    <row>
436      <entry id="types:BOOL">BOOL<indexterm zone="types:BOOL" significance="preferred"><primary>Types</primary><secondary>BOOL</secondary></indexterm></entry>
437      <entry>
438{ <emphasis role='bold'>True</emphasis>,
439<emphasis role='bold'>False</emphasis> }
440      </entry>
441    </row>
442    <row>
443      <entry id="types:EVENT">EVENT<indexterm zone="types:EVENT" significance="preferred"><primary>Types</primary><secondary>EVENT</secondary></indexterm></entry>
444      <entry>
445{ <emphasis role='bold'>KeyPress</emphasis>,
446<emphasis role='bold'>KeyRelease</emphasis>,
447<emphasis role='bold'>OwnerGrabButton</emphasis>,
448<emphasis role='bold'>ButtonPress</emphasis>,
449<emphasis role='bold'>ButtonRelease</emphasis>,
450<emphasis role='bold'>EnterWindow</emphasis>,
451<emphasis role='bold'>LeaveWindow</emphasis>,
452<emphasis role='bold'>PointerMotion</emphasis>,
453<emphasis role='bold'>PointerMotionHint</emphasis>,
454<emphasis role='bold'>Button1Motion</emphasis>,
455<emphasis role='bold'>Button2Motion</emphasis>,
456<emphasis role='bold'>Button3Motion</emphasis>,
457<emphasis role='bold'>Button4Motion</emphasis>,
458<emphasis role='bold'>Button5Motion</emphasis>,
459<emphasis role='bold'>ButtonMotion</emphasis>,
460<emphasis role='bold'>Exposure</emphasis>,
461<emphasis role='bold'>VisibilityChange</emphasis>,
462<emphasis role='bold'>StructureNotify</emphasis>,
463<emphasis role='bold'>ResizeRedirect</emphasis>,
464<emphasis role='bold'>SubstructureNotify</emphasis>,
465<emphasis role='bold'>SubstructureRedirect</emphasis>,
466<emphasis role='bold'>FocusChange</emphasis>,
467<emphasis role='bold'>PropertyChange</emphasis>,
468<emphasis role='bold'>ColormapChange</emphasis>,
469<emphasis role='bold'>KeymapState</emphasis> }
470      </entry>
471    </row>
472    <row>
473      <entry id="types:POINTEREVENT">POINTEREVENT<indexterm zone="types:POINTEREVENT" significance="preferred"><primary>Types</primary><secondary>POINTEREVENT</secondary></indexterm></entry>
474      <entry>
475{ <emphasis role='bold'>ButtonPress</emphasis>,
476<emphasis role='bold'>ButtonRelease</emphasis>,
477<emphasis role='bold'>EnterWindow</emphasis>,
478<emphasis role='bold'>LeaveWindow</emphasis>,
479<emphasis role='bold'>PointerMotion</emphasis>,
480<emphasis role='bold'>PointerMotionHint</emphasis>,
481<emphasis role='bold'>Button1Motion</emphasis>,
482<emphasis role='bold'>Button2Motion</emphasis>,
483<emphasis role='bold'>Button3Motion</emphasis>,
484<emphasis role='bold'>Button4Motion</emphasis>,
485<emphasis role='bold'>Button5Motion</emphasis>,
486<emphasis role='bold'>ButtonMotion</emphasis>,
487<emphasis role='bold'>KeymapState</emphasis> }
488      </entry>
489    </row>
490    <row>
491      <entry id="types:DEVICEEVENT">DEVICEEVENT<indexterm zone="types:DEVICEEVENT" significance="preferred"><primary>Types</primary><secondary>DEVICEEVENT</secondary></indexterm></entry>
492      <entry>
493{ <emphasis role='bold'>KeyPress</emphasis>,
494<emphasis role='bold'>KeyRelease</emphasis>,
495<emphasis role='bold'>ButtonPress</emphasis>,
496<emphasis role='bold'>ButtonRelease</emphasis>,
497<emphasis role='bold'>PointerMotion</emphasis>,
498<emphasis role='bold'>Button1Motion</emphasis>,
499<emphasis role='bold'>Button2Motion</emphasis>,
500<emphasis role='bold'>Button3Motion</emphasis>,
501<emphasis role='bold'>Button4Motion</emphasis>,
502<emphasis role='bold'>Button5Motion</emphasis>,
503<emphasis role='bold'>ButtonMotion</emphasis> }
504      </entry>
505    </row>
506    <row>
507      <entry id="types:KEYSYM">KEYSYM<indexterm zone="types:KEYSYM" significance="preferred"><primary>Types</primary><secondary>KEYSYM</secondary></indexterm></entry>
508      <entry>32-bit value (top three bits guaranteed to be zero)</entry>
509    </row>
510    <row>
511      <entry id="types:KEYCODE">KEYCODE<indexterm zone="types:KEYCODE" significance="preferred"><primary>Types</primary><secondary>KEYCODE</secondary></indexterm></entry>
512      <entry>CARD8</entry>
513    </row>
514    <row>
515      <entry id="types:BUTTON">BUTTON<indexterm zone="types:BUTTON" significance="preferred"><primary>Types</primary><secondary>BUTTON</secondary></indexterm></entry>
516      <entry>CARD8</entry>
517    </row>
518    <row>
519      <entry id="types:KEYMASK">KEYMASK<indexterm zone="types:KEYMASK" significance="preferred"><primary>Types</primary><secondary>KEYMASK</secondary></indexterm></entry>
520      <entry>
521{ <emphasis role='bold'>Shift</emphasis>,
522<emphasis role='bold'>Lock</emphasis>,
523<emphasis role='bold'>Control</emphasis>,
524<emphasis role='bold'>Mod1</emphasis>,
525<emphasis role='bold'>Mod2</emphasis>,
526<emphasis role='bold'>Mod3</emphasis>,
527<emphasis role='bold'>Mod4</emphasis>,
528<emphasis role='bold'>Mod5</emphasis> }
529      </entry>
530    </row>
531    <row>
532      <entry id="types:BUTMASK">BUTMASK<indexterm zone="types:BUTMASK" significance="preferred"><primary>Types</primary><secondary>BUTMASK</secondary></indexterm></entry>
533      <entry>
534{ <emphasis role='bold'>Button1</emphasis>,
535<emphasis role='bold'>Button2</emphasis>,
536<emphasis role='bold'>Button3</emphasis>,
537<emphasis role='bold'>Button4</emphasis>,
538<emphasis role='bold'>Button5</emphasis> }
539      </entry>
540    </row>
541    <row>
542      <entry id="types:KEYBUTMASK">KEYBUTMASK<indexterm zone="types:KEYBUTMASK" significance="preferred"><primary>Types</primary><secondary>KEYBUTMASK</secondary></indexterm></entry>
543      <entry>KEYMASK or BUTMASK</entry>
544    </row>
545    <row>
546      <entry id="types:STRING8">STRING8<indexterm zone="types:STRING8" significance="preferred"><primary>Types</primary><secondary>STRING8</secondary></indexterm></entry>
547      <entry>LISTofCARD8</entry>
548    </row>
549    <row>
550      <entry id="types:STRING16">STRING16<indexterm zone="types:STRING16" significance="preferred"><primary>Types</primary><secondary>STRING16</secondary></indexterm></entry>
551      <entry>LISTofCHAR2B</entry>
552    </row>
553    <row>
554      <entry id="types:CHAR2B">CHAR2B<indexterm zone="types:CHAR2B" significance="preferred"><primary>Types</primary><secondary>CHAR2B</secondary></indexterm></entry>
555      <entry>[byte1, byte2: CARD8]</entry>
556    </row>
557    <row>
558      <entry id="types:POINT">POINT<indexterm zone="types:POINT" significance="preferred"><primary>Types</primary><secondary>POINT</secondary></indexterm></entry>
559      <entry>[x, y: INT16]</entry>
560    </row>
561    <row>
562      <entry id="types:RECTANGLE">RECTANGLE<indexterm zone="types:RECTANGLE" significance="preferred"><primary>Types</primary><secondary>RECTANGLE</secondary></indexterm></entry>
563      <entry>
564<para>[x, y: INT16,</para>
565<para>width, height: CARD16]</para>
566      </entry>
567    </row>
568    <row>
569      <entry id="types:ARC">ARC<indexterm zone="types:ARC" significance="preferred"><primary>Types</primary><secondary>ARC</secondary></indexterm></entry>
570      <entry>
571<para>[x, y: INT16,</para>
572<para>width, height: CARD16,</para>
573<para>angle1, angle2: INT16]</para>
574      </entry>
575    </row>
576    <row>
577      <entry id="types:HOST">HOST<indexterm zone="types:HOST" significance="preferred"><primary>Types</primary><secondary>HOST</secondary></indexterm></entry>
578      <entry>
579<para>
580[family:
581{ <emphasis role='bold'>Internet</emphasis>,
582<emphasis role='bold'>InternetV6</emphasis>,
583<emphasis role='bold'>ServerInterpreted</emphasis>,
584<emphasis role='bold'>DECnet</emphasis>,
585<emphasis role='bold'>Chaos</emphasis> }
586</para>
587<para>address: LISTofBYTE]</para>
588      </entry>
589    </row>
590  </tbody>
591  </tgroup>
592</informaltable>
593
594<para>
595The [x,y] coordinates of a RECTANGLE specify the upper-left corner.
596</para>
597
598<para>
599The primary interpretation of large characters in a STRING16 is that they
600are composed of two bytes used to index a two-dimensional matrix,
601hence, the use of CHAR2B rather than CARD16.
602This corresponds to the JIS/ISO method of indexing 2-byte characters.
603It is expected that most large fonts will be defined with 2-byte
604matrix indexing.
605For large fonts constructed with linear indexing,
606a CHAR2B can be interpreted as a 16-bit number by treating byte1 as
607the most significant byte.
608This means that clients should always transmit such
60916-bit character values most significant byte first, as the server will never
610byte-swap CHAR2B quantities.
611</para>
612
613<para>
614The length, format, and interpretation of a HOST address are specific to the
615family (see
616<link linkend="requests:ChangeHosts"><emphasis role='bold'>ChangeHosts</emphasis></link>
617request).
618</para>
619</chapter>
620
621<chapter id='Errors'>
622<title>Errors</title>
623<!-- .XS -->
624<!-- (SN Errors -->
625<!-- .XE -->
626<para>
627<!-- .LP -->
628In general, when a request terminates with an error,
629the request has no side effects (that is, there is no partial execution).
630The only requests for which this is not true are
631<link linkend="requests:ChangeWindowAttributes"><emphasis role='bold'>ChangeWindowAttributes</emphasis></link>,
632<link linkend="requests:ChangeGC"><emphasis role='bold'>ChangeGC</emphasis></link>,
633<link linkend="requests:PolyText8"><emphasis role='bold'>PolyText8</emphasis></link>,
634<link linkend="requests:PolyText16"><emphasis role='bold'>PolyText16</emphasis></link>,
635<link linkend="requests:FreeColors"><emphasis role='bold'>FreeColors</emphasis></link>,
636<link linkend="requests:StoreColors"><emphasis role='bold'>StoreColors</emphasis></link>
637and
638<link linkend="requests:ChangeKeyboardControl"><emphasis role='bold'>ChangeKeyboardControl</emphasis></link>.
639</para>
640
641<para>
642The following error codes result from various requests as follows:
643</para>
644
645<informaltable frame="topbot">
646  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
647  <colspec colname='c1' colwidth='1.0*'/>
648  <colspec colname='c2' colwidth='2.0*'/>
649  <thead>
650    <row rowsep='1'>
651      <entry>Error</entry>
652      <entry>Description</entry>
653    </row>
654  </thead>
655  <tbody>
656    <row>
657      <entry id="errors:Access"><emphasis role='bold'>Access</emphasis><indexterm zone="errors:Access" significance="preferred"><primary>Error Codes</primary><secondary>Access</secondary></indexterm></entry>
658      <entry>
659An attempt is made to grab a key/button combination already grabbed by another
660client.
661An attempt is made to free a colormap entry not allocated by the client
662or to free an entry in a colormap that was created with all entries writable.
663An attempt is made to store into a read-only or an unallocated colormap entry.
664An attempt is made to modify the access control list from other than the local
665host (or otherwise authorized client).
666An attempt is made to select an event type that only one client can
667select at a time when another client has already selected it.
668      </entry>
669    </row>
670    <row>
671      <entry id="errors:Alloc"><emphasis role='bold'>Alloc</emphasis><indexterm zone="errors:Alloc" significance="preferred"><primary>Error Codes</primary><secondary>Alloc</secondary></indexterm></entry>
672      <entry>
673The server failed to allocate the requested resource.
674Note that the explicit listing of
675<emphasis role='bold'>Alloc</emphasis>
676errors in request only covers allocation errors at a very coarse level
677and is not intended to cover all cases
678of a server running out of allocation space in the middle of service.
679The semantics when a server runs out of allocation space are left unspecified,
680but a server may generate an
681<emphasis role='bold'>Alloc</emphasis>
682error on any request for this reason,
683and clients should be prepared to receive such errors and handle
684or discard them.
685      </entry>
686    </row>
687    <row>
688      <entry id="errors:Atom"><emphasis role='bold'>Atom</emphasis><indexterm zone="errors:Atom" significance="preferred"><primary>Error Codes</primary><secondary>Atom</secondary></indexterm></entry>
689      <entry>
690A value for an ATOM argument does not name a defined ATOM.
691      </entry>
692    </row>
693    <row>
694      <entry id="errors:Colormap"><emphasis role='bold'>Colormap</emphasis><indexterm zone="errors:Colormap" significance="preferred"><primary>Error Codes</primary><secondary>Colormap</secondary></indexterm></entry>
695      <entry>
696A value for a COLORMAP argument does not name a defined COLORMAP.
697      </entry>
698    </row>
699    <row>
700      <entry id="errors:Cursor"><emphasis role='bold'>Cursor</emphasis><indexterm zone="errors:Cursor" significance="preferred"><primary>Error Codes</primary><secondary>Cursor</secondary></indexterm></entry>
701      <entry>
702A value for a CURSOR argument does not name a defined CURSOR.
703      </entry>
704    </row>
705    <row>
706      <entry id="errors:Drawable"><emphasis role='bold'>Drawable</emphasis><indexterm zone="errors:Drawable" significance="preferred"><primary>Error Codes</primary><secondary>Drawable</secondary></indexterm></entry>
707      <entry>
708A value for a DRAWABLE argument does not name a defined WINDOW
709or PIXMAP.
710      </entry>
711    </row>
712    <row>
713      <entry id="errors:Font"><emphasis role='bold'>Font</emphasis><indexterm zone="errors:Font" significance="preferred"><primary>Error Codes</primary><secondary>Font</secondary></indexterm></entry>
714      <entry>
715A value for a FONT argument does not name a defined FONT.
716A value for a FONTABLE argument does not name a defined FONT or a
717defined GCONTEXT.
718      </entry>
719    </row>
720    <row>
721      <entry id="errors:GContext"><emphasis role='bold'>GContext</emphasis><indexterm zone="errors:GContext" significance="preferred"><primary>Error Codes</primary><secondary>GContext</secondary></indexterm></entry>
722      <entry>
723A value for a GCONTEXT argument does not name a defined GCONTEXT.
724      </entry>
725    </row>
726    <row>
727      <entry id="errors:IDChoice"><emphasis role='bold'>IDChoice</emphasis><indexterm zone="errors:IDChoice" significance="preferred"><primary>Error Codes</primary><secondary>IDChoice</secondary></indexterm></entry>
728      <entry>
729The value chosen for a resource identifier either is not included
730in the range assigned to the client or is already in use.
731      </entry>
732    </row>
733    <row>
734      <entry id="errors:Implementation"><emphasis role='bold'>Implementation</emphasis><indexterm zone="errors:Implementation" significance="preferred"><primary>Error Codes</primary><secondary>Implementation</secondary></indexterm></entry>
735      <entry>
736The server does not implement some aspect of the request.
737A server that generates this error for a core request is deficient.
738As such, this error is not listed for any of the requests,
739but clients should be prepared to receive such errors
740and handle or discard them.
741      </entry>
742    </row>
743    <row>
744      <entry id="errors:Length"><emphasis role='bold'>Length</emphasis><indexterm zone="errors:Length" significance="preferred"><primary>Error Codes</primary><secondary>Length</secondary></indexterm></entry>
745      <entry>
746The length of a request is shorter or longer than that required
747to minimally contain the arguments.
748The length of a request exceeds the maximum length accepted by the
749server.
750      </entry>
751    </row>
752    <row>
753      <entry id="errors:Match"><emphasis role='bold'>Match</emphasis><indexterm zone="errors:Match" significance="preferred"><primary>Error Codes</primary><secondary>Match</secondary></indexterm></entry>
754      <entry>
755An
756<emphasis role='bold'>InputOnly</emphasis>
757window is used as a DRAWABLE.
758In a graphics request, the GCONTEXT argument does not have the same
759root and depth as the destination DRAWABLE argument.
760Some argument (or pair of arguments) has the correct type and range,
761but it fails to match in some other way required by the request.
762      </entry>
763    </row>
764    <row>
765      <entry id="errors:Name"><emphasis role='bold'>Name</emphasis><indexterm zone="errors:Name" significance="preferred"><primary>Error Codes</primary><secondary>Name</secondary></indexterm></entry>
766      <entry>
767A font or color of the specified name does not exist.
768      </entry>
769    </row>
770    <row>
771      <entry id="errors:Pixmap"><emphasis role='bold'>Pixmap</emphasis><indexterm zone="errors:Pixmap" significance="preferred"><primary>Error Codes</primary><secondary>Pixmap</secondary></indexterm></entry>
772      <entry>
773A value for a PIXMAP argument does not name a defined PIXMAP.
774      </entry>
775    </row>
776    <row>
777      <entry id="errors:Request"><emphasis role='bold'>Request</emphasis><indexterm zone="errors:Request" significance="preferred"><primary>Error Codes</primary><secondary>Request</secondary></indexterm></entry>
778      <entry>
779The major or minor opcode does not specify a valid request.
780      </entry>
781    </row>
782    <row>
783      <entry id="errors:Value"><emphasis role='bold'>Value</emphasis><indexterm zone="errors:Value" significance="preferred"><primary>Error Codes</primary><secondary>Value</secondary></indexterm></entry>
784      <entry>
785Some numeric value falls outside the range of values accepted by the request.
786Unless a specific range is specified for an argument,
787the full range defined by the argument's type is accepted.
788Any argument defined as a set of alternatives typically can generate
789this error (due to the encoding).
790      </entry>
791    </row>
792    <row>
793      <entry id="errors:Window"><emphasis role='bold'>Window</emphasis><indexterm zone="errors:Window" significance="preferred"><primary>Error Codes</primary><secondary>Window</secondary></indexterm></entry>
794      <entry>
795A value for a WINDOW argument does not name a defined WINDOW.
796      </entry>
797    </row>
798  </tbody>
799  </tgroup>
800</informaltable>
801
802<note><para>
803The
804<emphasis role='bold'>Atom</emphasis>,
805<emphasis role='bold'>Colormap</emphasis>,
806<emphasis role='bold'>Cursor</emphasis>,
807<emphasis role='bold'>Drawable</emphasis>,
808<emphasis role='bold'>Font</emphasis>,
809<emphasis role='bold'>GContext</emphasis>,
810<emphasis role='bold'>Pixmap</emphasis>
811and
812<emphasis role='bold'>Window</emphasis>
813errors are also used when the argument type is extended by union with a
814set of fixed alternatives, for example, &lt;WINDOW or
815<emphasis role='bold'>PointerRoot</emphasis>
816or
817<emphasis role='bold'>None</emphasis>&gt;.
818</para></note>
819</chapter>
820
821<chapter id='Keyboards'>
822<title>Keyboards</title>
823<indexterm zone="Keyboards"><primary>Keyboard</primary></indexterm>
824<!-- .XS -->
825<!-- (SN Keyboards -->
826<!-- .XE -->
827<para id="keycode">
828A KEYCODE represents a physical (or logical) key.
829<indexterm zone="keycode"><primary>Types</primary><secondary>KEYCODE</secondary></indexterm>
830<indexterm zone="keycode" significance="preferred"><primary>Keycode</primary></indexterm>
831Keycodes lie in the inclusive range [8,255].
832A keycode value carries no intrinsic information,
833although server implementors may attempt to encode geometry information
834(for example, matrix) to be interpreted in a server-dependent fashion.
835The mapping between keys and keycodes cannot be changed using the
836protocol.
837</para>
838<para id="keysym">
839A KEYSYM is an encoding of a symbol on the cap of a key.
840<indexterm zone="keysym"><primary>Types</primary><secondary>KEYSYM</secondary></indexterm>
841<indexterm zone="keysym"><primary>Keysym</primary></indexterm>
842The set of defined KEYSYMs include the character sets Latin-1, Latin-2,
843Latin-3, Latin-4, Kana, Arabic, Cyrillic, Greek, Tech, Special, Publish, APL,
844Hebrew, Thai, and Korean as well as a set of symbols common on keyboards
845(Return, Help, Tab,
846and so on).
847KEYSYMs with the most significant bit (of the 29 bits) set are reserved
848as vendor-specific.
849</para>
850<para>
851A list of KEYSYMs is associated with each KEYCODE.
852The list is intended to convey the set of symbols on the corresponding key.
853If the list (ignoring trailing
854<keysym>NoSymbol</keysym>
855entries) is a single KEYSYM "<emphasis remap='I'>K</emphasis>",
856then the list is treated as if it were
857the list "<emphasis remap='I'>K</emphasis> <keysym>NoSymbol</keysym>
858<emphasis remap='I'>K</emphasis> <keysym>NoSymbol</keysym>".
859If the list (ignoring trailing <keysym>NoSymbol</keysym> entries)
860is a pair of KEYSYMs
861"<emphasis remap='I'>K1 K2</emphasis>", then the list is treated as
862if it were the list
863"<emphasis remap='I'>K1 K2 K1 K2</emphasis>".
864If the list (ignoring trailing
865<keysym>NoSymbol</keysym>
866entries) is
867a triple of KEYSYMs "<emphasis remap='I'>K1 K2 K3</emphasis>",
868then the list is treated as if it were the list "
869<emphasis remap='I'>K1 K2 K3</emphasis> <keysym>NoSymbol</keysym>".
870When an explicit "void" element is desired in the list,
871the value
872<keysym>VoidSymbol</keysym>
873can be used.
874</para>
875<para>
876<!-- .LP -->
877The first four elements of the list are split into two groups of KEYSYMs.
878Group 1 contains the first and second KEYSYMs, Group 2 contains the third and
879fourth KEYSYMs.
880Within each group,
881if the second element of the group is
882<keysym>NoSymbol</keysym>,
883then the group should be treated as if the second element were the
884same as the first element, except when the first element is an alphabetic
885KEYSYM "<emphasis remap='I'>K</emphasis>" for which both lowercase
886and uppercase forms are defined.
887In that case, the group should be treated as if the first element were the
888lowercase form of "<emphasis remap='I'>K</emphasis>" and the second
889element were the uppercase form
890of "<emphasis remap='I'>K</emphasis>".
891</para>
892
893<para id="keysym_from_keypress">
894The standard rules for obtaining a KEYSYM from a
895<link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>
896<indexterm zone="keysym_from_keypress"><primary>KeyPress</primary></indexterm>
897event make use of only the Group 1 and Group 2 KEYSYMs; no interpretation of
898other KEYSYMs in the list is defined.  The modifier state determines which
899group to use.  Switching between groups is controlled by the KEYSYM named
900MODE SWITCH, by attaching that KEYSYM to some KEYCODE and attaching that
901KEYCODE to any one of the modifiers
902<emphasis role='bold'>Mod1</emphasis>
903through
904<emphasis role='bold'>Mod5</emphasis>.
905This modifier is
906<indexterm zone="group_modifier" significance="preferred"><primary>modifier</primary><secondary>group</secondary></indexterm>
907called the "<firstterm id="group_modifier">group modifier</firstterm>".  For any KEYCODE, Group 1 is used when the
908group modifier is off, and Group 2 is used when the group modifier is on.
909</para>
910
911<para id="modifier:lock">
912The
913<emphasis role='bold'>Lock</emphasis>
914<indexterm zone="modifier:lock" significance="preferred"><primary>modifier</primary><secondary>Lock</secondary></indexterm>
915modifier is interpreted as CapsLock when the KEYSYM named CAPS
916LOCK is attached to some KEYCODE and that KEYCODE is attached to the
917<emphasis role='bold'>Lock</emphasis>
918modifier.  The
919<emphasis role='bold'>Lock</emphasis>
920modifier is interpreted as ShiftLock when the KEYSYM
921named SHIFT LOCK is attached to some KEYCODE and that KEYCODE is attached
922to the
923<emphasis role='bold'>Lock</emphasis>
924modifier.  If the
925<emphasis role='bold'>Lock</emphasis>
926modifier could be interpreted as both
927CapsLock and ShiftLock, the CapsLock interpretation is used.
928</para>
929
930<para id="modifier:numlock">
931<!-- .LP -->
932The operation of "keypad" keys is controlled by the KEYSYM named NUM LOCK,
933by attaching that KEYSYM to some KEYCODE and attaching that KEYCODE to any
934one of the modifiers
935<emphasis role='bold'>Mod1</emphasis>
936through
937<emphasis role='bold'>Mod5</emphasis>.
938This modifier is called the
939<indexterm zone="modifier:lock" significance="preferred"><primary>modifier</primary><secondary>NumLock</secondary></indexterm>
940"numlock modifier".  The standard KEYSYMs with the prefix KEYPAD in their
941name are called "keypad" KEYSYMs; these are KEYSYMS with numeric value in
942the hexadecimal range #xFF80 to #xFFBD inclusive.  In addition,
943vendor-specific KEYSYMS in the hexadecimal range #x11000000 to #x1100FFFF
944are also keypad KEYSYMs.
945</para>
946<para>
947<!-- .LP -->
948Within a group, the choice of KEYSYM is determined by applying the first
949rule that is satisfied from the following list:
950</para>
951
952<itemizedlist>
953  <listitem>
954    <para>
955The numlock modifier is on and the second KEYSYM is a keypad KEYSYM.  In
956this case, if the
957<emphasis role='bold'>Shift</emphasis>
958modifier is on, or if the
959<emphasis role='bold'>Lock</emphasis>
960modifier is on and
961is interpreted as ShiftLock, then the first KEYSYM is used; otherwise, the
962second KEYSYM is used.
963    </para>
964  </listitem>
965  <listitem>
966    <para>
967The
968<emphasis role='bold'>Shift</emphasis>
969and
970<emphasis role='bold'>Lock</emphasis>
971modifiers are both off.  In this case, the first
972KEYSYM is used.
973    </para>
974  </listitem>
975  <listitem>
976    <para>
977The
978<emphasis role='bold'>Shift</emphasis>
979modifier is off, and the
980<emphasis role='bold'>Lock</emphasis>
981modifier is on and is
982interpreted as CapsLock.  In this case, the first KEYSYM is used, but if
983that KEYSYM is lowercase alphabetic, then the corresponding uppercase
984KEYSYM is used instead.
985    </para>
986  </listitem>
987  <listitem>
988    <para>
989The
990<emphasis role='bold'>Shift</emphasis>
991modifier is on, and the
992<emphasis role='bold'>Lock</emphasis>
993modifier is on and is interpreted
994as CapsLock.  In this case, the second KEYSYM is used, but if that KEYSYM
995is lowercase alphabetic, then the corresponding uppercase KEYSYM is used
996instead.
997    </para>
998  </listitem>
999  <listitem>
1000    <para>
1001The
1002<emphasis role='bold'>Shift</emphasis>
1003modifier is on, or the
1004<emphasis role='bold'>Lock</emphasis>
1005modifier is on and is interpreted
1006as ShiftLock, or both.  In this case, the second KEYSYM is used.
1007    </para>
1008  </listitem>
1009</itemizedlist>
1010
1011<para>
1012<!-- .LP -->
1013The mapping between KEYCODEs and KEYSYMs is not used directly by the server;
1014it is merely stored for reading and writing by clients.
1015</para>
1016</chapter>
1017
1018<chapter id='Pointers'>
1019<title>Pointers</title>
1020<!-- .XS -->
1021<!-- (SN Pointers -->
1022<!-- .XE -->
1023<para id="pointers:buttons">
1024Buttons are always numbered starting with one.
1025<indexterm zone="pointers:buttons"><primary>Button</primary><secondary>number</secondary></indexterm>
1026</para>
1027</chapter>
1028
1029<chapter id='Predefined_Atoms'>
1030<title>Predefined Atoms</title>
1031<!-- .XS -->
1032<!-- (SN Predefined Atoms -->
1033<!-- .XE -->
1034<para>
1035<!-- .LP -->
1036<indexterm zone="Predefined_Atoms"><primary>Atom</primary><secondary>predefined</secondary></indexterm>
1037Predefined atoms are not strictly necessary and may not be useful in all
1038environments, but they will eliminate many
1039<link linkend="requests:InternAtom"><emphasis role='bold'>InternAtom</emphasis></link>
1040requests in most applications.
1041Note that they are predefined only in the sense of having numeric values,
1042not in the sense of having required semantics.
1043The core protocol imposes no semantics on these names,
1044but semantics are specified in other X Window System standards,
1045such as the
1046<citetitle>Inter-Client Communication Conventions Manual</citetitle>
1047and the <citetitle>X Logical Font Description Conventions</citetitle>.
1048</para>
1049
1050<para>
1051The following names have predefined atom values.
1052Note that uppercase and lowercase matter.
1053</para>
1054
1055<simplelist type='vert' columns='3'>
1056  <member>ARC</member>
1057  <member>ATOM</member>
1058  <member>BITMAP</member>
1059  <member>CAP_HEIGHT</member>
1060  <member>CARDINAL</member>
1061  <member>COLORMAP</member>
1062  <member>COPYRIGHT</member>
1063  <member>CURSOR</member>
1064  <member>CUT_BUFFER0</member>
1065  <member>CUT_BUFFER1</member>
1066  <member>CUT_BUFFER2</member>
1067  <member>CUT_BUFFER3</member>
1068  <member>CUT_BUFFER4</member>
1069  <member>CUT_BUFFER5</member>
1070  <member>CUT_BUFFER6</member>
1071  <member>CUT_BUFFER7</member>
1072  <member>DRAWABLE</member>
1073  <member>END_SPACE</member>
1074  <member>FAMILY_NAME</member>
1075  <member>FONT</member>
1076  <member>FONT_NAME</member>
1077  <member>FULL_NAME</member>
1078  <member>INTEGER</member>
1079  <member>ITALIC_ANGLE</member>
1080  <member>MAX_SPACE</member>
1081  <member>MIN_SPACE</member>
1082  <member>NORM_SPACE</member>
1083  <member>NOTICE</member>
1084  <member>PIXMAP</member>
1085  <member>POINT</member>
1086  <member>POINT_SIZE</member>
1087  <member>PRIMARY</member>
1088  <member>QUAD_WIDTH</member>
1089  <member>RECTANGLE</member>
1090  <member>RESOLUTION</member>
1091  <member>RESOURCE_MANAGER</member>
1092  <member>RGB_BEST_MAP</member>
1093  <member>RGB_BLUE_MAP</member>
1094  <member>RGB_COLOR_MAP</member>
1095  <member>RGB_DEFAULT_MAP</member>
1096  <member>RGB_GRAY_MAP</member>
1097  <member>RGB_GREEN_MAP</member>
1098  <member>RGB_RED_MAP</member>
1099  <member>SECONDARY</member>
1100  <member>STRIKEOUT_ASCENT</member>
1101  <member>STRIKEOUT_DESCENT</member>
1102  <member>STRING</member>
1103  <member>SUBSCRIPT_X</member>
1104  <member>SUBSCRIPT_Y</member>
1105  <member>SUPERSCRIPT_X</member>
1106  <member>SUPERSCRIPT_Y</member>
1107  <member>UNDERLINE_POSITION</member>
1108  <member>UNDERLINE_THICKNESS</member>
1109  <member>VISUALID</member>
1110  <member>WEIGHT</member>
1111  <member>WINDOW</member>
1112  <member>WM_CLASS</member>
1113  <member>WM_CLIENT_MACHINE</member>
1114  <member>WM_COMMAND</member>
1115  <member>WM_HINTS</member>
1116  <member>WM_ICON_NAME</member>
1117  <member>WM_ICON_SIZE</member>
1118  <member>WM_NAME</member>
1119  <member>WM_NORMAL_HINTS</member>
1120  <member>WM_SIZE_HINTS</member>
1121  <member>WM_TRANSIENT_FOR</member>
1122  <member>WM_ZOOM_HINTS</member>
1123  <member>X_HEIGHT</member>
1124</simplelist>
1125
1126<para>
1127<!-- .LP -->
1128To avoid conflicts with possible future names for which semantics might be
1129imposed (either at the protocol level or in terms of higher level user
1130interface models),
1131names beginning with an underscore should be used for atoms
1132that are private to a particular vendor or organization.
1133To guarantee no conflicts between vendors and organizations,
1134additional prefixes need to be used.
1135However, the protocol does not define the mechanism for choosing such prefixes.
1136For names private to a single application or end user but stored in globally
1137accessible locations,
1138it is suggested that two leading underscores be used to avoid conflicts with
1139other names.
1140</para>
1141</chapter>
1142
1143<chapter id='Connection_Setup'>
1144  <title>Connection Setup</title>
1145  <indexterm zone="Connection_Setup"><primary>Connection</primary></indexterm>
1146
1147  <para>
1148For remote clients,
1149the X protocol can be built on top of any reliable byte stream.
1150  </para>
1151
1152  <section id="connection_initiation">
1153    <title>Connection Initiation</title>
1154    <indexterm zone="connection_initiation"><primary>Connection</primary><secondary>opening</secondary></indexterm>
1155
1156    <para id="byte-order">
1157The client must send an initial byte of data to identify the byte order to be
1158employed.
1159<indexterm zone="byte-order"><primary>Byte order</primary></indexterm>
1160The value of the byte must be octal 102 or 154.
1161The value 102 (ASCII uppercase B) means values are transmitted most significant
1162byte first, and value 154 (ASCII lowercase l) means values are transmitted
1163least significant byte first.
1164Except where explicitly noted in the protocol,
1165all 16-bit and 32-bit quantities sent by the client must be transmitted with
1166this byte order,
1167and all 16-bit and 32-bit quantities returned by the server will be transmitted
1168with this byte order.
1169    </para>
1170    <para>
1171Following the byte-order byte,
1172the client sends the following information at connection setup:
1173    </para>
1174    <blockquote>
1175    <para>
1176protocol-major-version: CARD16
1177    </para>
1178    <para>
1179protocol-minor-version: CARD16
1180    </para>
1181    <para>
1182authorization-protocol-name: STRING8
1183    </para>
1184    <para>
1185authorization-protocol-data: STRING8
1186    </para>
1187    </blockquote>
1188    <para>
1189The version numbers indicate what version of the protocol the client
1190expects the server to implement.
1191    </para>
1192    <para id="authorization">
1193The authorization name indicates what authorization (and authentication)
1194protocol the client
1195expects the server to use, and the data is specific to that protocol.
1196<indexterm zone="authorization" significance="preferred"><primary>Authorization</primary></indexterm>
1197Specification of valid authorization mechanisms is not part of the core
1198X protocol.
1199A server that does not implement the protocol the client expects
1200or that only implements the host-based mechanism may simply ignore this
1201information.
1202If both name and data strings are empty,
1203this is to be interpreted as "no explicit authorization."
1204    </para>
1205  </section>
1206
1207  <section id="server_response">
1208    <title>Server Response</title>
1209
1210    <para>
1211The client receives the following information at connection setup:
1212    </para>
1213
1214<itemizedlist>
1215  <listitem>
1216    <para>
1217success:
1218{ <emphasis role='bold'>Failed</emphasis>,
1219<emphasis role='bold'>Success</emphasis>,
1220<emphasis role='bold'>Authenticate</emphasis>}
1221    </para>
1222  </listitem>
1223</itemizedlist>
1224
1225    <para>
1226The client receives the following additional data if the returned success
1227value is
1228<emphasis role='bold'>Failed</emphasis>,
1229and the connection is not successfully established:
1230    </para>
1231
1232<blockquote>
1233    <para>
1234protocol-major-version: CARD16
1235    </para>
1236    <para>
1237protocol-minor-version: CARD16
1238    </para>
1239    <para>
1240reason: STRING8
1241    </para>
1242</blockquote>
1243
1244    <para>
1245The client receives the following additional data if the returned success
1246value is
1247<emphasis role='bold'>Authenticate</emphasis>,
1248and further authentication negotiation is required:
1249    </para>
1250
1251<blockquote>
1252    <para>
1253reason: STRING8
1254    </para>
1255</blockquote>
1256
1257    <para>
1258The contents of the reason string are specific to the authorization
1259protocol in use.  The semantics of this authentication negotiation are
1260not constrained, except that the negotiation must eventually terminate
1261with a reply from the server containing a success value of
1262<emphasis role='bold'>Failed</emphasis>
1263or
1264<emphasis role='bold'>Success</emphasis>.
1265    </para>
1266
1267    <para>
1268The client receives the following additional data if the returned success
1269value is
1270<emphasis role='bold'>Success</emphasis>,
1271and the connection is successfully established:
1272    </para>
1273
1274<blockquote>
1275    <para>
1276protocol-major-version: CARD16
1277    </para>
1278    <para>
1279<!-- .br -->
1280protocol-minor-version: CARD16
1281    </para>
1282    <para>
1283<!-- .br -->
1284vendor: STRING8
1285    </para>
1286    <para>
1287<!-- .br -->
1288release-number: CARD32
1289    </para>
1290    <para>
1291<!-- .br -->
1292resource-id-base, resource-id-mask: CARD32
1293    </para>
1294    <para>
1295<!-- .br -->
1296image-byte-order:
1297{ <emphasis role='bold'>LSBFirst</emphasis>,
1298<emphasis role='bold'>MSBFirst</emphasis> }
1299    </para>
1300    <para>
1301<!-- .br -->
1302bitmap-scanline-unit: {8, 16, 32}
1303    </para>
1304    <para>
1305<!-- .br -->
1306bitmap-scanline-pad: {8, 16, 32}
1307    </para>
1308    <para>
1309<!-- .br -->
1310bitmap-bit-order:
1311{ <emphasis role='bold'>LeastSignificant</emphasis>,
1312<emphasis role='bold'>MostSignificant</emphasis> }
1313    </para>
1314    <para>
1315<!-- .br -->
1316pixmap-formats: LISTofFORMAT
1317    </para>
1318    <para>
1319<!-- .br -->
1320roots: LISTofSCREEN
1321    </para>
1322    <para>
1323<!-- .br -->
1324motion-buffer-size: CARD32
1325    </para>
1326    <para>
1327<!-- .br -->
1328maximum-request-length: CARD16
1329    </para>
1330    <para>
1331<!-- .br -->
1332min-keycode, max-keycode: KEYCODE
1333    </para>
1334    <para>
1335where:
1336    </para>
1337    <blockquote>
1338<informaltable frame="none">
1339  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
1340  <colspec colname='c1' colwidth='1.0*'/>
1341  <colspec colname='c2' colwidth='2.0*'/>
1342  <tbody>
1343    <row>
1344      <entry>FORMAT:</entry>
1345      <entry>[depth: CARD8,</entry>
1346    </row>
1347    <row>
1348      <entry></entry>
1349      <entry>
1350bits-per-pixel: {1, 4, 8, 16, 24, 32}
1351      </entry>
1352    </row>
1353    <row>
1354      <entry></entry>
1355      <entry>
1356scanline-pad: {8, 16, 32}]
1357      </entry>
1358    </row>
1359    <row>
1360      <entry>SCREEN:</entry>
1361      <entry>[root: WINDOW</entry>
1362    </row>
1363    <row>
1364      <entry></entry>
1365      <entry>width-in-pixels, height-in-pixels: CARD16</entry>
1366    </row>
1367    <row>
1368      <entry></entry>
1369      <entry>width-in-millimeters, height-in-millimeters: CARD16</entry>
1370    </row>
1371    <row>
1372      <entry></entry>
1373      <entry>allowed-depths: LISTofDEPTH</entry>
1374    </row>
1375    <row>
1376      <entry></entry>
1377      <entry>root-depth: CARD8</entry>
1378    </row>
1379    <row>
1380      <entry></entry>
1381      <entry>root-visual: VISUALID</entry>
1382    </row>
1383    <row>
1384      <entry></entry>
1385      <entry>default-colormap: COLORMAP</entry>
1386    </row>
1387    <row>
1388      <entry></entry>
1389      <entry>white-pixel, black-pixel: CARD32</entry>
1390    </row>
1391    <row>
1392      <entry></entry>
1393      <entry>min-installed-maps, max-installed-maps: CARD16</entry>
1394    </row>
1395    <row>
1396      <entry></entry>
1397      <entry>backing-stores: {Never, WhenMapped, Always}</entry>
1398    </row>
1399    <row>
1400      <entry></entry>
1401      <entry>save-unders: BOOL</entry>
1402    </row>
1403    <row>
1404      <entry></entry>
1405      <entry>current-input-masks: SETofEVENT]</entry>
1406    </row>
1407    <row>
1408      <entry>DEPTH:</entry>
1409      <entry>[depth: CARD8</entry>
1410    </row>
1411    <row>
1412      <entry></entry>
1413      <entry>visuals: LISTofVISUALTYPE]</entry>
1414    </row>
1415    <row>
1416      <entry>VISUALTYPE:</entry>
1417      <entry>[visual-id: VISUALID</entry>
1418    </row>
1419    <row>
1420      <entry></entry>
1421      <entry>
1422class: {StaticGray, StaticColor, TrueColor, GrayScale,
1423PseudoColor, DirectColor}
1424      </entry>
1425    </row>
1426    <row>
1427      <entry></entry>
1428      <entry>red-mask, green-mask, blue-mask: CARD32</entry>
1429    </row>
1430    <row>
1431      <entry></entry>
1432      <entry>bits-per-rgb-value: CARD8</entry>
1433    </row>
1434    <row>
1435      <entry></entry>
1436      <entry>colormap-entries: CARD16]</entry>
1437    </row>
1438  </tbody>
1439  </tgroup>
1440</informaltable>
1441    </blockquote>
1442</blockquote>
1443  </section>
1444
1445  <section id="server_information">
1446    <title>Server Information</title>
1447
1448    <para>
1449The information that is global to the server is:
1450    </para>
1451
1452    <para>
1453The protocol version numbers are an escape hatch in case future revisions of
1454the protocol are necessary.
1455In general,
1456the major version would increment for incompatible changes,
1457and the minor version would increment for small upward compatible changes.
1458Barring changes,
1459the major version will be 11, and the minor version will be 0.
1460The protocol version numbers returned indicate the protocol the server
1461actually supports.
1462This might not equal the version sent by the client.
1463The server can (but need not) refuse connections from clients that offer a
1464different version than the server supports.
1465A server can (but need not) support more than one version simultaneously.
1466    </para>
1467    <para>
1468The vendor string gives some identification of the owner of the server
1469implementation.
1470The vendor controls the semantics of the release number.
1471    </para>
1472    <para id="resource-id-mask">
1473The resource-id-mask contains a single contiguous set of bits (at least 18).
1474The client allocates resource IDs for types WINDOW, PIXMAP,
1475CURSOR, FONT, GCONTEXT, and COLORMAP by choosing a value with only
1476some subset of these bits set and ORing it with resource-id-base.
1477<indexterm zone="resource-id-mask"><primary>Resource</primary><secondary>ID</secondary></indexterm>
1478Only values constructed in this way can be used to name newly created
1479resources over this connection.
1480Resource IDs never have the top three bits set.
1481The client is not restricted to linear or contiguous allocation
1482of resource IDs.
1483Once an ID has been freed,
1484it can be reused.
1485An ID must be unique with respect to the IDs of all other resources,
1486not just other resources of the same type.
1487However, note that the value spaces of resource identifiers,
1488atoms, visualids, and keysyms are distinguished by context, and
1489as such, are not required to be disjoint; for example, a given numeric value
1490might be both a valid window ID, a valid atom, and a valid keysym.
1491    </para>
1492    <para>
1493Although the server is in general responsible for byte-swapping data to
1494match the client,
1495images are always transmitted and received in formats (including byte order)
1496specified by the server.
1497The byte order for images is given by image-byte-order and applies to each
1498scanline unit in XY format (bitmap format) and to each pixel value in Z format.
1499    </para>
1500    <para id="bitmap-format">
1501A bitmap is represented in <glossterm linkend="glossary:Scanline_order">scanline order</glossterm>.
1502<indexterm zone="bitmap-format"><primary>Bitmap</primary><secondary>format</secondary></indexterm>
1503Each <glossterm linkend="glossary:Scanline">scanline</glossterm>
1504is padded to a multiple of bits as given by bitmap-scanline-pad.
1505The pad bits are of arbitrary value.
1506The scanline is quantized in multiples of bits as given by bitmap-scanline-unit.
1507The bitmap-scanline-unit is always less than or equal to the
1508bitmap-scanline-pad.
1509Within each unit,
1510the leftmost bit in the bitmap is either the least significant
1511or most significant bit in the unit, as given by bitmap-bit-order.
1512<indexterm zone="bitmap-format"><primary>XYFormat</primary></indexterm>
1513If a pixmap is represented in XY format,
1514each plane is represented as a bitmap, and the planes appear from
1515most significant to least significant in bit order with no padding
1516between planes.
1517    </para>
1518    <para id="pixmap-formats">
1519Pixmap-formats contains one entry for each
1520<glossterm linkend="glossary:Depth">depth</glossterm> value.
1521<indexterm zone="pixmap-formats"><primary>Pixmap</primary><secondary>format</secondary></indexterm>
1522<indexterm zone="pixmap-formats"><primary>ZFormat</primary></indexterm>
1523The entry describes the <glossterm linkend="glossary:ZFormat">Z format</glossterm>
1524used to represent images of that depth.
1525An entry for a depth is included if any screen supports that depth,
1526and all screens supporting that depth must support only that Z format for that
1527depth.
1528In Z format,
1529the pixels are in scanline order, left to right within a scanline.
1530The number of bits used to hold each pixel is given by bits-per-pixel.
1531Bits-per-pixel may be larger than strictly required by the depth,
1532in which case the least significant bits are used to hold
1533the pixmap data, and the values of the unused high-order bits are
1534undefined.
1535When the bits-per-pixel is 4,
1536the order of nibbles in the byte is the same as the image byte-order.
1537When the bits-per-pixel is 1,
1538the format is identical for bitmap format.
1539Each scanline is padded to a multiple of bits as given by scanline-pad.
1540When bits-per-pixel is 1,
1541this will be identical to bitmap-scanline-pad.
1542    </para>
1543    <para>
1544How a pointing device roams the screens is up to the server
1545implementation and is transparent to the protocol.
1546No geometry is defined among screens.
1547    </para>
1548    <para>
1549The server may retain the recent history of pointer motion and do so to a
1550finer granularity than is reported by
1551<link linkend="events:MotionNotify"><emphasis role='bold'>MotionNotify</emphasis></link>
1552events.
1553The
1554<link linkend="requests:GetMotionEvents"><emphasis role='bold'>GetMotionEvents</emphasis></link>
1555request makes such history available.
1556The motion-buffer-size gives the approximate maximum number
1557of elements in the history buffer.
1558    </para>
1559    <para id="Maximum-request-length">
1560Maximum-request-length specifies the maximum length of a request
1561accepted by the server, in 4-byte units.
1562<indexterm zone="Maximum-request-length"><primary>Request</primary><secondary>length</secondary></indexterm>
1563That is, length is the maximum value that can appear in the length field of a
1564request.
1565Requests larger than this maximum generate a
1566<emphasis role='bold'>Length</emphasis>
1567error,
1568and the server will read and simply discard the entire request.
1569Maximum-request-length will always be at least 4096
1570(that is, requests of length up to and including 16384 bytes
1571will be accepted by all servers).
1572    </para>
1573    <para id="keycode_range">
1574<indexterm zone="keycode_range"><primary>Types</primary><secondary>KEYCODE</secondary></indexterm>
1575<indexterm zone="keycode_range"><primary>Keycode</primary></indexterm>
1576Min-keycode and max-keycode specify the smallest and largest keycode
1577values transmitted by the server.
1578Min-keycode is never less than 8,
1579and max-keycode is never greater than 255.
1580Not all keycodes in this range are required to have corresponding keys.
1581    </para>
1582  </section>
1583
1584  <section id="screen_information">
1585    <title>Screen Information</title>
1586    <indexterm zone="screen_information"><primary>Screen</primary></indexterm>
1587
1588    <para>
1589The information that applies per screen is:
1590    </para>
1591
1592    <para>
1593The allowed-depths specifies what pixmap and window depths are supported.
1594Pixmaps are supported for each depth listed,
1595and windows of that depth are supported if at least one visual type is listed
1596for the depth.
1597A pixmap depth of one is always supported and listed,
1598but windows of depth one might not be supported.
1599A depth of zero is never listed,
1600but zero-depth
1601<emphasis role='bold'>InputOnly</emphasis>
1602windows are always supported.
1603    </para>
1604    <para>
1605Root-depth and root-visual specify the depth and visual type of the
1606root window.
1607Width-in-pixels and height-in-pixels specify the size of
1608the root window (which cannot be changed).
1609The class of the root window is always
1610<emphasis role='bold'>InputOutput</emphasis>.
1611Width-in-millimeters and height-in-millimeters can be used to determine the
1612physical size and the aspect ratio.
1613    </para>
1614    <para>
1615The default-colormap is the one initially associated with the root window.
1616Clients with minimal color requirements creating windows of
1617the same depth as the root may want to allocate from this map by
1618default.
1619    </para>
1620    <para>
1621Black-pixel and white-pixel can be used in implementing a monochrome
1622application.
1623These pixel values are for permanently allocated entries in the
1624default-colormap.
1625The actual RGB values may be settable on some screens
1626and, in any case, may not actually be black and white.
1627The names are intended to convey the expected relative intensity of the colors.
1628    </para>
1629    <para>
1630The border of the root window is initially a pixmap filled with the black-pixel.
1631The initial background of the root window is a pixmap filled with some
1632unspecified two-color pattern using black-pixel and white-pixel.
1633    </para>
1634    <para>
1635Min-installed-maps specifies the number of maps that can be guaranteed
1636to be installed simultaneously (with
1637<link linkend="requests:InstallColormap"><emphasis role='bold'>InstallColormap</emphasis></link>),
1638regardless of the number of entries allocated in each map.
1639Max-installed-maps specifies the maximum number of maps that might possibly be
1640installed simultaneously, depending on their allocations.
1641Multiple static-visual colormaps with identical contents but differing in
1642resource ID should be considered as a single map for the purposes of this
1643number.
1644For the typical case of a single hardware colormap, both values will be 1.
1645    </para>
1646    <para id="Backing-stores">
1647<indexterm zone="Backing-stores"><primary>Backing store</primary></indexterm>
1648Backing-stores indicates when the server supports backing stores for
1649this screen, although it may be storage limited in the number of
1650windows it can support at once.
1651If save-unders is
1652<emphasis role='bold'>True</emphasis>,
1653the server can support the save-under mode in
1654<link linkend="requests:CreateWindow"><emphasis role='bold'>CreateWindow</emphasis></link>
1655and
1656<link linkend="requests:ChangeWindowAttributes"><emphasis role='bold'>ChangeWindowAttributes</emphasis></link>,
1657although again it may be storage limited.
1658    </para>
1659    <para>
1660The current-input-events is what
1661<link linkend="requests:GetWindowAttributes"><emphasis role='bold'>GetWindowAttributes</emphasis></link>
1662would return for the all-event-masks for the root window.
1663    </para>
1664  </section>
1665
1666  <section id="visual_information">
1667    <title>Visual Information</title>
1668    <indexterm zone="visual_information" significance="preferred"><primary>Visual</primary><secondary>information</secondary></indexterm>
1669
1670    <para>
1671The information that applies per visual-type is:
1672    </para>
1673
1674    <para>
1675A given visual type might be listed for more than one depth or for
1676more than one screen.
1677    </para>
1678
1679    <para id="colormap_types">
1680<indexterm zone="colormap_types" significance="preferred"><primary>Colormap</primary><secondary>types</secondary></indexterm>
1681<indexterm zone="colormap_types"><primary>Pixel value</primary></indexterm>
1682For
1683<emphasis role='bold'>PseudoColor</emphasis>,
1684a pixel value indexes a colormap to produce independent RGB values;
1685the RGB values can be changed dynamically.
1686<emphasis role='bold'>GrayScale</emphasis>
1687is treated in the same way as
1688<emphasis role='bold'>PseudoColor</emphasis>
1689except which primary drives the screen is undefined;
1690thus, the client should always store the
1691same value for red, green, and blue in colormaps.
1692For
1693<emphasis role='bold'>DirectColor</emphasis>,
1694a pixel value is decomposed into separate RGB subfields,
1695and each subfield separately indexes the colormap for the corresponding value.
1696The RGB values can be changed dynamically.
1697<emphasis role='bold'>TrueColor</emphasis>
1698is treated in the same way as
1699<emphasis role='bold'>DirectColor</emphasis>
1700except the colormap has predefined read-only RGB values.
1701These values are server-dependent but provide linear or near-linear
1702increasing ramps in each primary.
1703<emphasis role='bold'>StaticColor</emphasis>
1704is treated in the same way as
1705<emphasis role='bold'>PseudoColor</emphasis>
1706except the colormap has predefined read-only RGB values,
1707which are server-dependent.
1708<emphasis role='bold'>StaticGray</emphasis>
1709is treated in the same way as
1710<emphasis role='bold'>StaticColor</emphasis>
1711except the red, green, and blue values are equal for any
1712single pixel value, resulting in shades of gray.
1713<emphasis role='bold'>StaticGray</emphasis>
1714with a two-entry colormap can be thought of as monochrome.
1715    </para>
1716
1717    <para>
1718The red-mask, green-mask, and blue-mask are only defined for
1719<emphasis role='bold'>DirectColor</emphasis>
1720and
1721<emphasis role='bold'>TrueColor</emphasis>.
1722Each has one contiguous set of bits set to 1 with no intersections.
1723Usually each mask has the same number of bits set to 1.
1724    </para>
1725
1726    <para>
1727The bits-per-rgb-value specifies the log base 2 of the number of
1728distinct color intensity values (individually) of red, green, and blue.
1729This number need not bear any relation to the number of colormap entries.
1730Actual RGB values are always passed in the protocol within a
173116-bit spectrum, with 0 being minimum intensity and 65535 being the
1732maximum intensity.
1733On hardware that provides a linear zero-based intensity ramp,
1734the following relationship exists:
1735    </para>
1736
1737    <para>
1738<literallayout class="monospaced">
1739       hw-intensity = protocol-intensity / (65536 / total-hw-intensities)
1740</literallayout>
1741    </para>
1742
1743    <para>
1744Colormap entries are indexed from 0.
1745The colormap-entries defines the number of available colormap entries in a
1746newly created colormap.
1747For
1748<emphasis role='bold'>DirectColor</emphasis>
1749and
1750<emphasis role='bold'>TrueColor</emphasis>,
1751this will usually be 2 to the power of the maximum number of bits set to 1 in
1752red-mask, green-mask, and blue-mask.
1753    </para>
1754  </section>
1755</chapter>
1756
1757<chapter id='Requests'>
1758  <title>Requests</title>
1759  <section id="requests:CreateWindow">
1760    <title>CreateWindow</title>
1761    <indexterm zone="requests:CreateWindow" significance="preferred"><primary>CreateWindow</primary></indexterm>
1762<informaltable frame='none'>
1763  <?dbfo keep-together="always" ?>
1764  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
1765  <colspec colname='c1' colwidth='1.0*'/>
1766  <tbody>
1767    <row>
1768      <entry>
1769<!-- .in +.2i -->
1770<emphasis remap='I'>wid</emphasis>, <emphasis remap='I'>parent</emphasis>: WINDOW
1771      </entry>
1772    </row>
1773    <row>
1774      <entry>
1775<emphasis remap='I'>class</emphasis>:
1776{ <emphasis role='bold'>InputOutput</emphasis>,
1777<emphasis role='bold'>InputOnly</emphasis>,
1778<emphasis role='bold'>CopyFromParent</emphasis>}
1779      </entry>
1780    </row>
1781    <row>
1782      <entry>
1783<emphasis remap='I'>depth</emphasis>: CARD8
1784      </entry>
1785    </row>
1786    <row>
1787      <entry>
1788<emphasis remap='I'>visual</emphasis>: VISUALID or
1789<emphasis role='bold'>CopyFromParent</emphasis>
1790      </entry>
1791    </row>
1792    <row>
1793      <entry>
1794<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
1795      </entry>
1796    </row>
1797    <row>
1798      <entry>
1799<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>, <emphasis remap='I'>border-width</emphasis>: CARD16
1800      </entry>
1801    </row>
1802    <row>
1803      <entry>
1804<emphasis remap='I'>value-mask</emphasis>: BITMASK
1805      </entry>
1806    </row>
1807    <row>
1808      <entry>
1809<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
1810<!-- .in -.2i -->
1811      </entry>
1812    </row>
1813    <row>
1814      <entry>
1815<!-- .in +.2i -->
1816Errors:
1817<emphasis role='bold'>Alloc</emphasis>,
1818<emphasis role='bold'>Colormap</emphasis>,
1819<emphasis role='bold'>Cursor</emphasis>,
1820<emphasis role='bold'>IDChoice</emphasis>,
1821<emphasis role='bold'>Match</emphasis>,
1822<emphasis role='bold'>Pixmap</emphasis>,
1823<emphasis role='bold'>Value</emphasis>,
1824<emphasis role='bold'>Window</emphasis>
1825<!-- .in -.2i -->
1826<!-- .eM -->
1827      </entry>
1828    </row>
1829  </tbody>
1830  </tgroup>
1831</informaltable>
1832<!-- .eM -->
1833<para>
1834This request creates an unmapped window and assigns the identifier wid to it.
1835</para>
1836<para>
1837A class of
1838<emphasis role='bold'>CopyFromParent</emphasis>
1839means the class is taken from the parent.
1840A depth of zero for class
1841<emphasis role='bold'>InputOutput</emphasis>
1842or
1843<emphasis role='bold'>CopyFromParent</emphasis>
1844means the depth is taken from the parent.
1845A visual of
1846<emphasis role='bold'>CopyFromParent</emphasis>
1847means the visual type is taken from the parent.
1848For class
1849<emphasis role='bold'>InputOutput</emphasis>,
1850the visual type and depth must be a combination supported for the screen
1851(or a
1852<emphasis role='bold'>Match</emphasis>
1853error results).
1854The depth need not be the same as the parent,
1855but the parent must not be of class
1856<emphasis role='bold'>InputOnly</emphasis>
1857(or a
1858<emphasis role='bold'>Match</emphasis>
1859error results).
1860For class
1861<emphasis role='bold'>InputOnly</emphasis>,
1862the depth must be zero (or a
1863<emphasis role='bold'>Match</emphasis>
1864error results), and the visual must be one supported for the screen (or a
1865<emphasis role='bold'>Match</emphasis>
1866error results).
1867However, the parent can have any depth and class.
1868</para>
1869<para>
1870The server essentially acts as if
1871<emphasis role='bold'>InputOnly</emphasis>
1872windows do not exist for the purposes of graphics requests,
1873exposure processing, and
1874<link linkend="events:VisibilityNotify"><emphasis role='bold'>VisibilityNotify</emphasis></link>
1875events.
1876An
1877<emphasis role='bold'>InputOnly</emphasis>
1878window cannot be used as a drawable (as a source or destination for graphics
1879requests).
1880<emphasis role='bold'>InputOnly</emphasis>
1881and
1882<emphasis role='bold'>InputOutput</emphasis>
1883windows act identically in other respects-properties,
1884grabs, input control, and so on.
1885</para>
1886<para>
1887The coordinate system has the X axis horizontal and the Y axis vertical
1888with the origin [0, 0] at the upper-left corner.
1889Coordinates are integral,
1890in terms of pixels,
1891and coincide with pixel centers.
1892Each window and pixmap has its own coordinate system.
1893For a window,
1894the origin is inside the border at the inside, upper-left corner.
1895</para>
1896<para>
1897The x and y coordinates
1898for the window are relative to the parent's origin
1899and specify the position of the upper-left outer corner of the window
1900(not the origin).
1901The width and height specify the inside size (not including the border)
1902and must be nonzero (or a
1903<emphasis role='bold'>Value</emphasis>
1904error results).
1905The border-width for an
1906<emphasis role='bold'>InputOnly</emphasis>
1907window must be zero (or a
1908<emphasis role='bold'>Match</emphasis>
1909error results).
1910</para>
1911<para>
1912The window is placed on top in the stacking order with respect to siblings.
1913</para>
1914<para>
1915The value-mask and value-list specify attributes of the window that are
1916to be explicitly initialized.
1917The possible values are:
1918</para>
1919<informaltable frame='topbot'>
1920  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
1921  <colspec colname='c1' colwidth='1.0*'/>
1922  <colspec colname='c2' colwidth='2.0*'/>
1923  <thead>
1924    <row rowsep='1'>
1925      <entry>Attribute</entry>
1926      <entry>Type</entry>
1927    </row>
1928  </thead>
1929  <tbody>
1930    <row>
1931      <entry>background-pixmap</entry>
1932      <entry>
1933PIXMAP or
1934<emphasis role='bold'>None</emphasis>
1935or
1936<emphasis role='bold'>ParentRelative</emphasis>
1937      </entry>
1938    </row>
1939    <row>
1940      <entry>background-pixel</entry>
1941      <entry>CARD32</entry>
1942    </row>
1943    <row>
1944      <entry>border-pixmap</entry>
1945      <entry>
1946PIXMAP or
1947<emphasis role='bold'>CopyFromParent</emphasis>
1948      </entry>
1949    </row>
1950    <row>
1951      <entry>border-pixel</entry>
1952      <entry>CARD32</entry>
1953    </row>
1954    <row>
1955      <entry>bit-gravity</entry>
1956      <entry>BITGRAVITY</entry>
1957    </row>
1958    <row>
1959      <entry>win-gravity</entry>
1960      <entry>WINGRAVITY</entry>
1961    </row>
1962    <row>
1963      <entry>backing-store</entry>
1964      <entry>
1965{ <emphasis role='bold'>NotUseful</emphasis>,
1966<emphasis role='bold'>WhenMapped</emphasis>,
1967<emphasis role='bold'>Always</emphasis> }
1968      </entry>
1969    </row>
1970    <row>
1971      <entry>backing-planes</entry>
1972      <entry>CARD32</entry>
1973    </row>
1974    <row>
1975      <entry>backing-pixel</entry>
1976      <entry>CARD32</entry>
1977    </row>
1978    <row>
1979      <entry>save-under</entry>
1980      <entry>BOOL</entry>
1981    </row>
1982    <row>
1983      <entry>event-mask</entry>
1984      <entry>SETofEVENT</entry>
1985    </row>
1986    <row>
1987      <entry>do-not-propagate-mask</entry>
1988      <entry>SETofDEVICEEVENT</entry>
1989    </row>
1990    <row>
1991      <entry>override-redirect</entry>
1992      <entry>BOOL</entry>
1993    </row>
1994    <row>
1995      <entry>colormap</entry>
1996      <entry>
1997COLORMAP or
1998<emphasis role='bold'>CopyFromParent</emphasis>
1999      </entry>
2000    </row>
2001    <row>
2002      <entry>cursor</entry>
2003      <entry>
2004CURSOR or
2005<emphasis role='bold'>None</emphasis>
2006      </entry>
2007    </row>
2008  </tbody>
2009  </tgroup>
2010</informaltable>
2011
2012<para>
2013The default values when attributes are not explicitly initialized
2014are:
2015</para>
2016
2017<informaltable frame='topbot'>
2018  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
2019  <colspec colname='c1' colwidth='1.0*'/>
2020  <colspec colname='c2' colwidth='2.0*'/>
2021  <thead>
2022    <row rowsep='1'>
2023      <entry>Attribute</entry>
2024      <entry>Default</entry>
2025    </row>
2026  </thead>
2027  <tbody>
2028    <row>
2029      <entry>background-pixmap</entry>
2030      <entry>
2031<emphasis role='bold'>None</emphasis>
2032      </entry>
2033    </row>
2034    <row>
2035      <entry>border-pixmap</entry>
2036      <entry>
2037<emphasis role='bold'>CopyFromParent</emphasis>
2038      </entry>
2039    </row>
2040    <row>
2041      <entry>bit-gravity</entry>
2042      <entry>
2043<emphasis role='bold'>Forget</emphasis>
2044      </entry>
2045    </row>
2046    <row>
2047      <entry>win-gravity</entry>
2048      <entry>
2049<emphasis role='bold'>NorthWest</emphasis>
2050      </entry>
2051    </row>
2052    <row>
2053      <entry>backing-store</entry>
2054      <entry>
2055<emphasis role='bold'>NotUseful</emphasis>
2056      </entry>
2057    </row>
2058    <row>
2059      <entry>backing-planes</entry>
2060      <entry>all ones</entry>
2061    </row>
2062    <row>
2063      <entry>backing-pixel</entry>
2064      <entry>zero</entry>
2065    </row>
2066    <row>
2067      <entry>save-under</entry>
2068      <entry>
2069<emphasis role='bold'>False</emphasis>
2070      </entry>
2071    </row>
2072    <row>
2073      <entry>event-mask</entry>
2074      <entry>{} (empty set)</entry>
2075    </row>
2076    <row>
2077      <entry>do-not-propagate-mask</entry>
2078      <entry>{} (empty set)</entry>
2079    </row>
2080    <row>
2081      <entry>override-redirect</entry>
2082      <entry>
2083<emphasis role='bold'>False</emphasis>
2084      </entry>
2085    </row>
2086    <row>
2087      <entry>colormap</entry>
2088      <entry>
2089<emphasis role='bold'>CopyFromParent</emphasis>
2090      </entry>
2091    </row>
2092    <row rowsep='1'>
2093      <entry>cursor</entry>
2094      <entry>
2095<emphasis role='bold'>None</emphasis>
2096      </entry>
2097    </row>
2098  </tbody>
2099  </tgroup>
2100</informaltable>
2101
2102<para>
2103Only the following attributes are defined for
2104<emphasis role='bold'>InputOnly</emphasis>
2105windows:
2106</para>
2107
2108<itemizedlist>
2109  <listitem>
2110    <para>
2111win-gravity
2112    </para>
2113  </listitem>
2114  <listitem>
2115    <para>
2116event-mask
2117    </para>
2118  </listitem>
2119  <listitem>
2120    <para>
2121do-not-propagate-mask
2122    </para>
2123  </listitem>
2124  <listitem>
2125    <para>
2126override-redirect
2127    </para>
2128  </listitem>
2129  <listitem>
2130    <para>
2131cursor
2132    </para>
2133  </listitem>
2134</itemizedlist>
2135
2136<para>
2137It is a
2138<emphasis role='bold'>Match</emphasis>
2139error to specify any other attributes for
2140<emphasis role='bold'>InputOnly</emphasis>
2141windows.
2142</para>
2143<para id="requests:CreateWindow:background">
2144<indexterm zone="requests:CreateWindow:background"><primary>Background</primary></indexterm>
2145If background-pixmap is given,
2146it overrides the default background-pixmap.
2147The background pixmap and the window must have the
2148same root and the same depth (or a
2149<emphasis role='bold'>Match</emphasis>
2150error results).
2151Any size pixmap can be used, although some sizes may be faster than others.
2152If background
2153<emphasis role='bold'>None</emphasis>
2154is specified, the window has no defined background.
2155If background
2156<emphasis role='bold'>ParentRelative</emphasis>
2157is specified, the parent's background is used,
2158but the window must have the same depth as the parent (or a
2159<emphasis role='bold'>Match</emphasis>
2160error results).
2161If the parent has background
2162<emphasis role='bold'>None</emphasis>,
2163then the window will also have background
2164<emphasis role='bold'>None</emphasis>.
2165A copy of the parent's background is not made.
2166The parent's background is reexamined each time the window background is
2167required.
2168If background-pixel is given, it overrides the default
2169background-pixmap and any background-pixmap given explicitly,
2170and a pixmap of undefined size filled with background-pixel is used for the
2171background.
2172Range checking is not performed on the background-pixel value;
2173it is simply truncated to the appropriate number of bits.
2174For a
2175<emphasis role='bold'>ParentRelative</emphasis>
2176background,
2177the background tile origin always aligns with the parent's background tile
2178origin.
2179Otherwise, the background tile origin is always the window origin.
2180</para>
2181<para>
2182When no valid contents are available for regions of a window
2183and the regions are either visible or the server is maintaining backing store,
2184the server automatically tiles the regions with the window's background
2185unless the window has a background of
2186<emphasis role='bold'>None</emphasis>.
2187If the background is
2188<emphasis role='bold'>None</emphasis>,
2189the previous screen contents from other windows of the same depth as the window
2190are simply left in place if the contents come from the parent of the window
2191or an inferior of the parent;
2192otherwise, the initial contents of the exposed regions are undefined.
2193Exposure events are then generated for the regions, even if the background is
2194<emphasis role='bold'>None</emphasis>.
2195</para>
2196<para>
2197The border tile origin is always the same as the background tile origin.
2198If border-pixmap is given,
2199it overrides the default border-pixmap.
2200The border pixmap and the window must have the same root
2201and the same depth (or a
2202<emphasis role='bold'>Match</emphasis>
2203error results).
2204Any size pixmap can be used,
2205although some sizes may be faster than others.
2206If
2207<emphasis role='bold'>CopyFromParent</emphasis>
2208is given, the parent's border pixmap is copied (subsequent changes to
2209the parent's border attribute do not affect the child),
2210but the window must have the same depth as the parent (or a
2211<emphasis role='bold'>Match</emphasis>
2212error results).
2213The pixmap might be copied by sharing the same pixmap object between the
2214child and parent or by making a complete copy of the pixmap contents.
2215If border-pixel is given,
2216it overrides the default border-pixmap and any border-pixmap given explicitly,
2217and a pixmap of undefined size filled with border-pixel is used for the border.
2218Range checking is not performed on the border-pixel value;
2219it is simply truncated to the appropriate number of bits.
2220</para>
2221<para>
2222Output to a window is always clipped to the inside of the window,
2223so that the border is never affected.
2224</para>
2225<para>
2226The bit-gravity defines which region of the window should be retained
2227if the window is resized, and win-gravity defines how the window should
2228be repositioned if the parent is resized (see
2229<link linkend="requests:ConfigureWindow"><emphasis role='bold'>ConfigureWindow</emphasis></link>
2230request).
2231</para>
2232<para>
2233A backing-store of
2234<emphasis role='bold'>WhenMapped</emphasis>
2235advises the server that maintaining contents of obscured regions
2236when the window is mapped would be beneficial.
2237A backing-store of
2238<emphasis role='bold'>Always</emphasis>
2239advises the server that maintaining contents even when the window is
2240unmapped would be beneficial.
2241In this case,
2242the server may generate an exposure event when the window is created.
2243A value of
2244<emphasis role='bold'>NotUseful</emphasis>
2245advises the server that maintaining contents is unnecessary,
2246although a server may still choose to maintain contents while the window
2247is mapped.
2248Note that if the server maintains contents,
2249then the server should maintain complete contents
2250not just the region within the parent boundaries,
2251even if the window is larger than its parent.
2252While the server maintains contents,
2253exposure events will not normally be generated,
2254but the server may stop maintaining contents at any time.
2255</para>
2256<para>
2257If save-under is
2258<emphasis role='bold'>True</emphasis>,
2259the server is advised that when this window is
2260mapped, saving the contents of windows it obscures would be beneficial.
2261</para>
2262<para>
2263When the contents of obscured regions of a window are being maintained,
2264regions obscured by noninferior windows are included in the
2265destination (and source, when the window is the source) of graphics
2266requests, but regions obscured by inferior windows are not included.
2267</para>
2268<para>
2269The backing-planes indicates (with bits set to 1) which bit planes
2270of the window hold dynamic data that must be preserved in backing-stores
2271and during save-unders.
2272The backing-pixel specifies what value to use in planes not
2273covered by backing-planes.
2274The server is free to save only the specified bit planes in the backing-store
2275or save-under and regenerate the remaining planes with the specified pixel
2276value.
2277Any bits beyond the specified depth of the window in these
2278values are simply ignored.
2279</para>
2280<para id="requests:CreateWindow:event-mask">
2281<indexterm zone="requests:CreateWindow:event-mask"><primary>Event</primary><secondary>mask</secondary></indexterm>
2282<indexterm zone="requests:CreateWindow:event-mask"><primary>Event</primary><secondary>propagation</secondary></indexterm>
2283The event-mask defines which events the client is interested in for
2284this window (or for some event types, inferiors of the window).
2285The do-not-propagate-mask defines which events should not be propagated to
2286ancestor windows when no client has the event type selected in this
2287window.
2288</para>
2289<para>
2290The override-redirect specifies whether map and configure requests on this
2291window should override a
2292<emphasis role='bold'>SubstructureRedirect</emphasis>
2293on the parent, typically to inform a window manager not to tamper with
2294the window.
2295</para>
2296<para>
2297The colormap specifies the colormap that best reflects the true
2298colors of the window.
2299Servers capable of supporting multiple hardware colormaps may use this
2300information, and window managers may use it for
2301<link linkend="requests:InstallColormap"><emphasis role='bold'>InstallColormap</emphasis></link>
2302requests.
2303The colormap must have the same visual type and root as the window (or a
2304<emphasis role='bold'>Match</emphasis>
2305error results).
2306If
2307<emphasis role='bold'>CopyFromParent</emphasis>
2308is specified,
2309the parent's colormap is copied (subsequent changes to the parent's
2310colormap attribute do not affect the child).
2311However, the window must have the same visual type as the parent (or a
2312<emphasis role='bold'>Match</emphasis>
2313error results), and the parent must not have a colormap of
2314<emphasis role='bold'>None</emphasis>
2315(or a
2316<emphasis role='bold'>Match</emphasis>
2317error results).
2318For an explanation of
2319<emphasis role='bold'>None</emphasis>,
2320see <link linkend="requests:FreeColormap"><emphasis role='bold'>FreeColormap</emphasis></link>
2321request.
2322The colormap is copied by sharing the colormap object between the child
2323and the parent,
2324not by making a complete copy of the colormap contents.
2325</para>
2326<para>
2327If a cursor is specified,
2328it will be used whenever the pointer is in the window.
2329If
2330<emphasis role='bold'>None</emphasis>
2331is specified,
2332the parent's cursor will be used when the pointer is in the window,
2333and any change in the parent's cursor will cause an immediate change
2334in the displayed cursor.
2335</para>
2336<para>
2337This request generates a
2338<link linkend="events:CreateNotify"><emphasis role='bold'>CreateNotify</emphasis></link>
2339event.
2340</para>
2341<para>
2342The background and border pixmaps and the cursor may be freed
2343immediately if no further explicit references to them are to be made.
2344</para>
2345<para>
2346Subsequent drawing into the background or border pixmap has an
2347undefined effect on the window state.
2348The server might or might not make a copy of the pixmap.
2349<!-- .sp -->
2350</para>
2351  </section>
2352  <section id="requests:ChangeWindowAttributes">
2353    <title>ChangeWindowAttributes</title>
2354    <indexterm zone="requests:ChangeWindowAttributes" significance="preferred"><primary>ChangeWindowAttributes</primary></indexterm>
2355<informaltable frame='none'>
2356  <?dbfo keep-together="always" ?>
2357  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2358  <colspec colname='c1' colwidth='1.0*'/>
2359  <tbody>
2360    <row>
2361      <entry>
2362<!-- .in +.2i -->
2363<emphasis remap='I'>window</emphasis>: WINDOW
2364      </entry>
2365    </row>
2366    <row>
2367      <entry>
2368<emphasis remap='I'>value-mask</emphasis>: BITMASK
2369      </entry>
2370    </row>
2371    <row>
2372      <entry>
2373<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
2374<!-- .in -.2i -->
2375      </entry>
2376    </row>
2377    <row>
2378      <entry>
2379<!-- .in +.2i -->
2380Errors:
2381<emphasis role='bold'>Access</emphasis>,
2382<emphasis role='bold'>Colormap</emphasis>,
2383<emphasis role='bold'>Cursor</emphasis>,
2384<emphasis role='bold'>Match</emphasis>,
2385<emphasis role='bold'>Pixmap</emphasis>,
2386<emphasis role='bold'>Value</emphasis>,
2387<emphasis role='bold'>Window</emphasis>
2388<!-- .in -.2i -->
2389<!-- .eM -->
2390      </entry>
2391    </row>
2392  </tbody>
2393  </tgroup>
2394</informaltable>
2395<!-- .eM -->
2396<para>
2397The value-mask and value-list specify which attributes are to be changed.
2398The values and restrictions are the same as for
2399<link linkend="requests:CreateWindow"><emphasis role='bold'>CreateWindow</emphasis></link>.
2400</para>
2401<para>
2402Setting a new background, whether by background-pixmap or
2403background-pixel, overrides any previous background.
2404Setting a new border, whether by border-pixel or border-pixmap,
2405overrides any previous border.
2406</para>
2407<para>
2408Changing the background does not cause the window contents to be changed.
2409Setting the border or changing the background such that the
2410border tile origin changes causes the border to be repainted.
2411Changing the background of a root window to
2412<emphasis role='bold'>None</emphasis>
2413or
2414<emphasis role='bold'>ParentRelative</emphasis>
2415restores the default background pixmap.
2416Changing the border of a root window to
2417<emphasis role='bold'>CopyFromParent</emphasis>
2418restores the default border pixmap.
2419</para>
2420<para>
2421Changing the win-gravity does not affect the current position of the
2422window.
2423</para>
2424<para>
2425Changing the backing-store of an obscured window to
2426<emphasis role='bold'>WhenMapped</emphasis>
2427or
2428<emphasis role='bold'>Always</emphasis>
2429or changing the backing-planes, backing-pixel, or save-under of
2430a mapped window may have no immediate effect.
2431</para>
2432<para>
2433Multiple clients can select input on the same window;
2434their event-masks are disjoint.
2435When an event is generated,
2436it will be reported to all interested clients.
2437However, only one client at a time can select for
2438<emphasis role='bold'>SubstructureRedirect</emphasis>,
2439only one client at a time can select for
2440<emphasis role='bold'>ResizeRedirect</emphasis>,
2441and only one client at a time can select for
2442<link linkend="events:ButtonPress"><emphasis role='bold'>ButtonPress</emphasis></link>.
2443An attempt to violate these restrictions results in an
2444<emphasis role='bold'>Access</emphasis>
2445error.
2446</para>
2447<para>
2448There is only one do-not-propagate-mask for a window, not one per
2449client.
2450</para>
2451<para>
2452Changing the colormap of a window (by defining a new map, not by
2453changing the contents of the existing map) generates a
2454<link linkend="events:ColormapNotify"><emphasis role='bold'>ColormapNotify</emphasis></link>
2455event.
2456Changing the colormap of a visible window might have no immediate effect
2457on the screen (see
2458<link linkend="requests:InstallColormap"><emphasis role='bold'>InstallColormap</emphasis></link>
2459request).
2460</para>
2461<para>
2462Changing the cursor of a root window to
2463<emphasis role='bold'>None</emphasis>
2464restores the default cursor.
2465</para>
2466<para>
2467The order in which attributes are verified and altered is server-dependent.
2468If an error is generated,
2469a subset of the attributes may have been altered.
2470<!-- .sp -->
2471</para>
2472  </section>
2473  <section id="requests:GetWindowAttributes">
2474    <title>GetWindowAttributes</title>
2475    <indexterm zone="requests:GetWindowAttributes" significance="preferred"><primary>GetWindowAttributes</primary></indexterm>
2476<informaltable frame='none'>
2477  <?dbfo keep-together="always" ?>
2478  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2479  <colspec colname='c1' colwidth='1.0*'/>
2480  <tbody>
2481    <row>
2482      <entry>
2483<!-- .in +.2i -->
2484<emphasis remap='I'>window</emphasis>: WINDOW
2485<!-- .in -.2i -->
2486      </entry>
2487    </row>
2488    <row>
2489      <entry>
24902491      </entry>
2492    </row>
2493    <row>
2494      <entry>
2495<!-- .in +.2i -->
2496visual: VISUALID
2497      </entry>
2498    </row>
2499    <row>
2500      <entry>
2501class:
2502{ <emphasis role='bold'>InputOutput</emphasis>,
2503<emphasis role='bold'>InputOnly</emphasis>}
2504      </entry>
2505    </row>
2506    <row>
2507      <entry>
2508bit-gravity: BITGRAVITY
2509      </entry>
2510    </row>
2511    <row>
2512      <entry>
2513win-gravity: WINGRAVITY
2514      </entry>
2515    </row>
2516    <row>
2517      <entry>
2518backing-store:
2519{ <emphasis role='bold'>NotUseful</emphasis>,
2520<emphasis role='bold'>WhenMapped</emphasis>,
2521<emphasis role='bold'>Always</emphasis>}
2522      </entry>
2523    </row>
2524    <row>
2525      <entry>
2526backing-planes: CARD32
2527      </entry>
2528    </row>
2529    <row>
2530      <entry>
2531backing-pixel: CARD32
2532      </entry>
2533    </row>
2534    <row>
2535      <entry>
2536save-under: BOOL
2537      </entry>
2538    </row>
2539    <row>
2540      <entry>
2541colormap: COLORMAP or
2542<emphasis role='bold'>None</emphasis>
2543      </entry>
2544    </row>
2545    <row>
2546      <entry>
2547map-is-installed: BOOL
2548      </entry>
2549    </row>
2550    <row>
2551      <entry>
2552map-state:
2553{ <emphasis role='bold'>Unmapped</emphasis>,
2554<emphasis role='bold'>Unviewable</emphasis>,
2555<emphasis role='bold'>Viewable</emphasis>}
2556      </entry>
2557    </row>
2558    <row>
2559      <entry>
2560all-event-masks, your-event-mask: SETofEVENT
2561      </entry>
2562    </row>
2563    <row>
2564      <entry>
2565do-not-propagate-mask: SETofDEVICEEVENT
2566      </entry>
2567    </row>
2568    <row>
2569      <entry>
2570override-redirect: BOOL
2571<!-- .in -.2i -->
2572      </entry>
2573    </row>
2574    <row>
2575      <entry>
2576<!-- .in +.2i -->
2577Errors:
2578<emphasis role='bold'>Window</emphasis>
2579<!-- .in -.2i -->
2580<!-- .eM -->
2581      </entry>
2582    </row>
2583  </tbody>
2584  </tgroup>
2585</informaltable>
2586<!-- .eM -->
2587<para>
2588This request returns the current attributes of the window.
2589A window is
2590<emphasis role='bold'>Unviewable</emphasis>
2591if it is mapped but some ancestor is unmapped.
2592All-event-masks is the inclusive-OR of all event masks selected on the window
2593by clients.
2594Your-event-mask is the event mask selected by the querying client.
2595<!-- .sp -->
2596</para>
2597  </section>
2598  <section id="requests:DestroyWindow">
2599    <title>DestroyWindow</title>
2600    <indexterm zone="requests:DestroyWindow" significance="preferred"><primary>DestroyWindow</primary></indexterm>
2601<informaltable frame='none'>
2602  <?dbfo keep-together="always" ?>
2603  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2604  <colspec colname='c1' colwidth='1.0*'/>
2605  <tbody>
2606    <row>
2607      <entry>
2608<!-- .in +.2i -->
2609<emphasis remap='I'>window</emphasis>: WINDOW
2610<!-- .in -.2i -->
2611      </entry>
2612    </row>
2613    <row>
2614      <entry>
2615<!-- .in +.2i -->
2616Errors:
2617<emphasis role='bold'>Window</emphasis>
2618<!-- .in -.2i -->
2619<!-- .eM -->
2620      </entry>
2621    </row>
2622  </tbody>
2623  </tgroup>
2624</informaltable>
2625<!-- .eM -->
2626<para>
2627If the argument window is mapped,
2628an
2629<link linkend="requests:UnmapWindow"><emphasis role='bold'>UnmapWindow</emphasis></link>
2630request is performed automatically.
2631The window and all inferiors are then destroyed, and a
2632<link linkend="events:DestroyNotify"><emphasis role='bold'>DestroyNotify</emphasis></link>
2633event is generated for each window.
2634The ordering of the
2635<emphasis role='bold'>DestroyNotify</emphasis>
2636events is such that for any given window,
2637<emphasis role='bold'>DestroyNotify</emphasis>
2638is generated on all inferiors of the window before being generated on
2639the window itself.
2640The ordering among siblings and across subhierarchies is not otherwise
2641constrained.
2642</para>
2643<para>
2644Normal exposure processing on formerly obscured windows is performed.
2645</para>
2646<para>
2647If the window is a root window,
2648this request has no effect.
2649<!-- .sp -->
2650</para>
2651  </section>
2652  <section id="requests:DestroySubwindows">
2653    <title>DestroySubwindows</title>
2654    <indexterm zone="requests:DestroySubwindows" significance="preferred"><primary>DestroySubwindows</primary></indexterm>
2655<informaltable frame='none'>
2656  <?dbfo keep-together="always" ?>
2657  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2658  <colspec colname='c1' colwidth='1.0*'/>
2659  <tbody>
2660    <row>
2661      <entry>
2662<!-- .in +.2i -->
2663<emphasis remap='I'>window</emphasis>: WINDOW
2664<!-- .in -.2i -->
2665      </entry>
2666    </row>
2667    <row>
2668      <entry>
2669<!-- .in +.2i -->
2670Errors:
2671<emphasis role='bold'>Window</emphasis>
2672<!-- .in -.2i -->
2673<!-- .eM -->
2674      </entry>
2675    </row>
2676  </tbody>
2677  </tgroup>
2678</informaltable>
2679<!-- .eM -->
2680<para>
2681This request performs a
2682<link linkend="requests:DestroyWindow"><emphasis role='bold'>DestroyWindow</emphasis></link>
2683request on all children of the window, in bottom-to-top stacking order.
2684<!-- .sp -->
2685</para>
2686  </section>
2687  <section id="requests:ChangeSaveSet">
2688    <title>ChangeSaveSet</title>
2689    <indexterm zone="requests:ChangeSaveSet" significance="preferred"><primary>ChangeSaveSet</primary></indexterm>
2690<informaltable frame='none'>
2691  <?dbfo keep-together="always" ?>
2692  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2693  <colspec colname='c1' colwidth='1.0*'/>
2694  <tbody>
2695    <row>
2696      <entry>
2697<!-- .in +.2i -->
2698<emphasis remap='I'>window</emphasis>: WINDOW
2699      </entry>
2700    </row>
2701    <row>
2702      <entry>
2703<emphasis remap='I'>mode</emphasis>:
2704{ <emphasis role='bold'>Insert</emphasis>,
2705<emphasis role='bold'>Delete</emphasis>}
2706<!-- .in -.2i -->
2707      </entry>
2708    </row>
2709    <row>
2710      <entry>
2711Errors:
2712<!-- .in +.2i -->
2713<emphasis role='bold'>Match</emphasis>,
2714<emphasis role='bold'>Value</emphasis>,
2715<emphasis role='bold'>Window</emphasis>
2716<!-- .in -.2i -->
2717<!-- .eM -->
2718      </entry>
2719    </row>
2720  </tbody>
2721  </tgroup>
2722</informaltable>
2723<!-- .eM -->
2724<para>
2725This request adds or removes the specified window from the client's
2726save-set.
2727The window must have been created by some other client (or a
2728<emphasis role='bold'>Match</emphasis>
2729error results).
2730For further information about the use of the save-set,
2731see <link linkend='Connection_Close'>section 10</link>.
2732</para>
2733<para>
2734When windows are destroyed,
2735the server automatically removes them from the save-set.
2736<!-- .sp -->
2737</para>
2738  </section>
2739  <section id="requests:ReparentWindow">
2740    <title>ReparentWindow</title>
2741    <indexterm zone="requests:ReparentWindow" significance="preferred"><primary>ReparentWindow</primary></indexterm>
2742<informaltable frame='none'>
2743  <?dbfo keep-together="always" ?>
2744  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2745  <colspec colname='c1' colwidth='1.0*'/>
2746  <tbody>
2747    <row>
2748      <entry>
2749<!-- .in +.2i -->
2750<emphasis remap='I'>window</emphasis>, <emphasis remap='I'>parent</emphasis>: WINDOW
2751      </entry>
2752    </row>
2753    <row>
2754      <entry>
2755<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
2756<!-- .in -.2i -->
2757      </entry>
2758    </row>
2759    <row>
2760      <entry>
2761<!-- .in +.2i -->
2762Errors:
2763<emphasis role='bold'>Match</emphasis>,
2764<emphasis role='bold'>Window</emphasis>
2765<!-- .in -.2i -->
2766<!-- .eM -->
2767      </entry>
2768    </row>
2769  </tbody>
2770  </tgroup>
2771</informaltable>
2772<!-- .eM -->
2773<para>
2774If the window is mapped,
2775an
2776<link linkend="requests:UnmapWindow"><emphasis role='bold'>UnmapWindow</emphasis></link>
2777request is performed automatically first.
2778The window is then removed from its current position in the hierarchy
2779and is inserted as a child of the specified parent.
2780The x and y coordinates are relative to the parent's origin
2781and specify the new position of the upper-left outer corner of the
2782window.
2783The window is placed on top in the stacking order with respect
2784to siblings.
2785A
2786<link linkend="events:ReparentNotify"><emphasis role='bold'>ReparentNotify</emphasis></link>
2787event is then generated.
2788The override-redirect attribute of the window is passed on in this event;
2789a value of
2790<emphasis role='bold'>True</emphasis>
2791indicates that a window manager should not tamper with this window.
2792Finally, if the window was originally mapped, a
2793<link linkend="requests:MapWindow"><emphasis role='bold'>MapWindow</emphasis></link>
2794request is performed automatically.
2795</para>
2796<para>
2797Normal exposure processing on formerly obscured windows is performed.
2798The server might not generate exposure events for regions from the
2799initial unmap that are immediately obscured by the final map.
2800</para>
2801<para>
2802A
2803<emphasis role='bold'>Match</emphasis>
2804error is generated if:
2805<!-- .IP bu 5 -->
2806The new parent is not on the same screen as the old parent.
2807<!-- .IP bu 5 -->
2808The new parent is the window itself or an inferior of the window.
2809<!-- .IP bu 5 -->
2810The new parent is
2811<emphasis role='bold'>InputOnly</emphasis>,
2812and the window is not.
2813<!-- .IP bu 5 -->
2814The window has a
2815<emphasis role='bold'>ParentRelative</emphasis>
2816background, and the new parent is not the same depth as the window.
2817<!-- .sp -->
2818</para>
2819  </section>
2820  <section id="requests:MapWindow">
2821    <title>MapWindow</title>
2822    <indexterm zone="requests:MapWindow" significance="preferred"><primary>MapWindow</primary></indexterm>
2823    <indexterm zone="requests:MapWindow"><primary>Mapped window</primary></indexterm>
2824<informaltable frame='none'>
2825  <?dbfo keep-together="always" ?>
2826  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2827  <colspec colname='c1' colwidth='1.0*'/>
2828  <tbody>
2829    <row>
2830      <entry>
2831<!-- .in +.2i -->
2832<emphasis remap='I'>window</emphasis>: WINDOW
2833<!-- .in -.2i -->
2834      </entry>
2835    </row>
2836    <row>
2837      <entry>
2838<!-- .in +.2i -->
2839Errors:
2840<emphasis role='bold'>Window</emphasis>
2841<!-- .in -.2i -->
2842<!-- .eM -->
2843      </entry>
2844    </row>
2845  </tbody>
2846  </tgroup>
2847</informaltable>
2848<!-- .eM -->
2849<para>
2850If the window is already mapped, this request has no effect.
2851</para>
2852<para>
2853If the override-redirect attribute of the window is
2854<emphasis role='bold'>False</emphasis>
2855and some other client has selected
2856<emphasis role='bold'>SubstructureRedirect</emphasis>
2857on the parent, then a
2858<link linkend="events:MapRequest"><emphasis role='bold'>MapRequest</emphasis></link>
2859event is generated, but the window remains unmapped.
2860Otherwise, the window is mapped,
2861and a
2862<link linkend="events:MapNotify"><emphasis role='bold'>MapNotify</emphasis></link>
2863event is generated.
2864</para>
2865<para>
2866If the window is now viewable and its contents have been discarded,
2867the window is tiled with its background (if no background is defined,
2868the existing screen contents are not altered), and zero or more exposure
2869events are generated.
2870If a backing-store has been maintained while the window was unmapped,
2871no exposure events are generated.
2872If a backing-store will now be maintained,
2873a full-window exposure is always generated.
2874Otherwise, only visible regions may be reported.
2875Similar tiling and exposure take place for any newly viewable inferiors.
2876<!-- .sp -->
2877</para>
2878  </section>
2879  <section id="requests:MapSubwindows">
2880    <title>MapSubwindows</title>
2881    <indexterm zone="requests:MapSubwindows" significance="preferred"><primary>MapSubwindows</primary></indexterm>
2882<informaltable frame='none'>
2883  <?dbfo keep-together="always" ?>
2884  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2885  <colspec colname='c1' colwidth='1.0*'/>
2886  <tbody>
2887    <row>
2888      <entry>
2889<!-- .in +.2i -->
2890<emphasis remap='I'>window</emphasis>: WINDOW
2891<!-- .in -.2i -->
2892      </entry>
2893    </row>
2894    <row>
2895      <entry>
2896<!-- .in +.2i -->
2897Errors:
2898<emphasis role='bold'>Window</emphasis>
2899<!-- .in -.2i -->
2900<!-- .eM -->
2901      </entry>
2902    </row>
2903  </tbody>
2904  </tgroup>
2905</informaltable>
2906<!-- .eM -->
2907<para>
2908This request performs a
2909<link linkend="requests:MapWindow"><emphasis role='bold'>MapWindow</emphasis></link>
2910request on all unmapped children of the window,
2911in top-to-bottom stacking order.
2912<!-- .sp -->
2913</para>
2914  </section>
2915  <section id="requests:UnmapWindow">
2916    <title>UnmapWindow</title>
2917    <indexterm zone="requests:UnmapWindow" significance="preferred"><primary>UnmapWindow</primary></indexterm>
2918<informaltable frame='none'>
2919  <?dbfo keep-together="always" ?>
2920  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2921  <colspec colname='c1' colwidth='1.0*'/>
2922  <tbody>
2923    <row>
2924      <entry>
2925<!-- .in +.2i -->
2926<emphasis remap='I'>window</emphasis>: WINDOW
2927<!-- .in -.2i -->
2928      </entry>
2929    </row>
2930    <row>
2931      <entry>
2932<!-- .in +.2i -->
2933Errors:
2934<emphasis role='bold'>Window</emphasis>
2935<!-- .in -.2i -->
2936<!-- .eM -->
2937      </entry>
2938    </row>
2939  </tbody>
2940  </tgroup>
2941</informaltable>
2942<!-- .eM -->
2943<para>
2944If the window is already unmapped, this request has no effect.
2945Otherwise, the window is unmapped, and an
2946<link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>
2947event is generated.
2948Normal exposure processing on formerly obscured windows is performed.
2949<!-- .sp -->
2950</para>
2951  </section>
2952  <section id="requests:UnmapSubwindows">
2953    <title>UnmapSubwindows</title>
2954    <indexterm zone="requests:UnmapSubwindows" significance="preferred"><primary>UnmapSubwindows</primary></indexterm>
2955<informaltable frame='none'>
2956  <?dbfo keep-together="always" ?>
2957  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2958  <colspec colname='c1' colwidth='1.0*'/>
2959  <tbody>
2960    <row>
2961      <entry>
2962<!-- .in +.2i -->
2963<emphasis remap='I'>window</emphasis>: WINDOW
2964<!-- .in -.2i -->
2965      </entry>
2966    </row>
2967    <row>
2968      <entry>
2969<!-- .in +.2i -->
2970Errors:
2971<emphasis role='bold'>Window</emphasis>
2972<!-- .in -.2i -->
2973<!-- .eM -->
2974      </entry>
2975    </row>
2976  </tbody>
2977  </tgroup>
2978</informaltable>
2979<!-- .eM -->
2980<para>
2981This request performs an
2982<link linkend="requests:UnmapWindow"><emphasis role='bold'>UnmapWindow</emphasis></link>
2983request on all mapped children of the window,
2984in bottom-to-top stacking order.
2985<!-- .sp -->
2986</para>
2987  </section>
2988  <section id="requests:ConfigureWindow">
2989    <title>ConfigureWindow</title>
2990    <indexterm zone="requests:ConfigureWindow" significance="preferred"><primary>ConfigureWindow</primary></indexterm>
2991<informaltable frame='none'>
2992  <?dbfo keep-together="always" ?>
2993  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
2994  <colspec colname='c1' colwidth='1.0*'/>
2995  <tbody>
2996    <row>
2997      <entry>
2998<!-- .in +.2i -->
2999<emphasis remap='I'>window</emphasis>: WINDOW
3000      </entry>
3001    </row>
3002    <row>
3003      <entry>
3004<emphasis remap='I'>value-mask</emphasis>: BITMASK
3005      </entry>
3006    </row>
3007    <row>
3008      <entry>
3009<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
3010<!-- .in -.2i -->
3011      </entry>
3012    </row>
3013    <row>
3014      <entry>
3015<!-- .in +.2i -->
3016Errors:
3017<emphasis role='bold'>Match</emphasis>,
3018<emphasis role='bold'>Value</emphasis>,
3019<emphasis role='bold'>Window</emphasis>
3020<!-- .in -.2i -->
3021<!-- .eM -->
3022      </entry>
3023    </row>
3024  </tbody>
3025  </tgroup>
3026</informaltable>
3027<!-- .eM -->
3028<para>
3029This request changes the configuration of the window.
3030The value-mask and value-list specify which values are to be given.
3031The possible values are:
3032</para>
3033
3034<informaltable frame='topbot'>
3035  <?dbfo keep-together="always" ?>
3036  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
3037  <colspec colname='c1' colwidth='1.0*'/>
3038  <colspec colname='c2' colwidth='2.0*'/>
3039  <thead>
3040    <row rowsep='1'>
3041      <entry>Attribute</entry>
3042      <entry>Type</entry>
3043    </row>
3044  </thead>
3045  <tbody>
3046    <row>
3047      <entry>x</entry>
3048      <entry>INT16</entry>
3049    </row>
3050    <row>
3051      <entry>y</entry>
3052      <entry>INT16</entry>
3053    </row>
3054    <row>
3055      <entry>width</entry>
3056      <entry>CARD16</entry>
3057    </row>
3058    <row>
3059      <entry>height</entry>
3060      <entry>CARD16</entry>
3061    </row>
3062    <row>
3063      <entry>border-width</entry>
3064      <entry>CARD16</entry>
3065    </row>
3066    <row>
3067      <entry>sibling</entry>
3068      <entry>WINDOW</entry>
3069    </row>
3070    <row>
3071      <entry>stack-mode</entry>
3072      <entry>
3073{ <emphasis role='bold'>Above</emphasis>,
3074<emphasis role='bold'>Below</emphasis>,
3075<emphasis role='bold'>TopIf</emphasis>,
3076<emphasis role='bold'>BottomIf</emphasis>,
3077<emphasis role='bold'>Opposite</emphasis> }
3078      </entry>
3079    </row>
3080  </tbody>
3081  </tgroup>
3082</informaltable>
3083
3084<para>
3085The x and y coordinates are relative to the parent's origin
3086and specify the position of the upper-left outer corner of the window.
3087The width and height specify the inside size, not including the border, and
3088must be nonzero (or a
3089<emphasis role='bold'>Value</emphasis>
3090error results).
3091Those values not specified are taken from the existing geometry of the window.
3092Note that changing just the border-width leaves the outer-left corner
3093of the window in a fixed position but moves the absolute position of the
3094window's origin.
3095It is a
3096<emphasis role='bold'>Match</emphasis>
3097error to attempt to make the border-width of an
3098<emphasis role='bold'>InputOnly</emphasis>
3099window nonzero.
3100</para>
3101<para>
3102If the override-redirect attribute of the window is
3103<emphasis role='bold'>False</emphasis>
3104and some other client has selected
3105<emphasis role='bold'>SubstructureRedirect</emphasis>
3106on the parent, a
3107<link linkend="events:ConfigureRequest"><emphasis role='bold'>ConfigureRequest</emphasis></link>
3108event is generated, and no further processing is performed.
3109Otherwise, the following is performed:
3110</para>
3111<para>
3112If some other client has selected
3113<emphasis role='bold'>ResizeRedirect</emphasis>
3114on the window and the inside width or height of the window is being changed,
3115a
3116<link linkend="events:ResizeRequest"><emphasis role='bold'>ResizeRequest</emphasis></link>
3117event is generated,
3118and the current inside width and height are used instead.
3119Note that the override-redirect attribute of the window has no effect on
3120<emphasis role='bold'>ResizeRedirect</emphasis>
3121and that
3122<emphasis role='bold'>SubstructureRedirect</emphasis>
3123on the parent has precedence over
3124<emphasis role='bold'>ResizeRedirect</emphasis>
3125on the window.
3126</para>
3127<para id="requests:ConfigureWindow:gravity">
3128<indexterm zone="requests:ConfigureWindow:gravity"><primary>Gravity</primary></indexterm>
3129<indexterm zone="requests:ConfigureWindow:gravity"><primary>Bit</primary><secondary>gravity</secondary></indexterm>
3130<indexterm zone="requests:ConfigureWindow:gravity"><primary>Window</primary><secondary>gravity</secondary></indexterm>
3131The geometry of the window is changed as specified,
3132the window is restacked among siblings, and a
3133<link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>
3134event is generated if the state of the window actually changes.
3135If the inside width or height of the window has actually changed,
3136then children of the window are affected,
3137according to their win-gravity.
3138Exposure processing is performed on formerly obscured windows
3139(including the window itself and its inferiors if regions of them were
3140obscured but now are not).
3141Exposure processing is also performed on any new regions of the window
3142(as a result of increasing the width or height)
3143and on any regions where window contents are lost.
3144</para>
3145<para>
3146If the inside width or height of a window is not changed
3147but the window is moved or its border is changed,
3148then the contents of the window are not lost but move with the window.
3149Changing the inside width or height of the window causes its contents to be
3150moved or lost, depending on the bit-gravity of the window.
3151It also causes children to be reconfigured, depending on their win-gravity.
3152For a change of width and height of W and H,
3153we define the [x, y] pairs as:
3154</para>
3155
3156<informaltable frame='topbot'>
3157  <?dbfo keep-together="always" ?>
3158  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
3159  <colspec colname='c1' colwidth='1.0*'/>
3160  <colspec colname='c2' colwidth='2.0*'/>
3161  <thead>
3162    <row rowsep='1'>
3163      <entry>Direction</entry>
3164      <entry>Deltas</entry>
3165    </row>
3166  </thead>
3167  <tbody>
3168    <row>
3169      <entry>
3170<emphasis role='bold'>NorthWest</emphasis>
3171      </entry>
3172      <entry>[0, 0]</entry>
3173    </row>
3174    <row>
3175      <entry>
3176<emphasis role='bold'>North</emphasis>
3177      </entry>
3178      <entry>[W/2, 0]</entry>
3179    </row>
3180    <row>
3181      <entry>
3182<emphasis role='bold'>NorthEast</emphasis>
3183      </entry>
3184      <entry>[W, 0]</entry>
3185    </row>
3186    <row>
3187      <entry>
3188<emphasis role='bold'>West</emphasis>
3189      </entry>
3190      <entry>[0, H/2]</entry>
3191    </row>
3192    <row>
3193      <entry>
3194<emphasis role='bold'>Center</emphasis>
3195      </entry>
3196      <entry>[W/2, H/2]</entry>
3197    </row>
3198    <row>
3199      <entry>
3200<emphasis role='bold'>East</emphasis>
3201      </entry>
3202      <entry>[W, H/2]</entry>
3203    </row>
3204    <row>
3205      <entry>
3206<emphasis role='bold'>SouthWest</emphasis>
3207      </entry>
3208      <entry>[0, H]</entry>
3209    </row>
3210    <row>
3211      <entry>
3212<emphasis role='bold'>South</emphasis>
3213      </entry>
3214      <entry>[W/2, H]</entry>
3215    </row>
3216    <row>
3217      <entry>
3218<emphasis role='bold'>SouthEast</emphasis>
3219      </entry>
3220      <entry>[W, H]</entry>
3221    </row>
3222  </tbody>
3223  </tgroup>
3224</informaltable>
3225
3226<para>
3227When a window with one of these bit-gravities is resized,
3228the corresponding pair defines the change in position of each pixel in the
3229window.
3230When a window with one of these win-gravities has its parent window resized,
3231the corresponding pair defines the change in position
3232of the window within the parent.
3233This repositioning generates a
3234<link linkend="events:GravityNotify"><emphasis role='bold'>GravityNotify</emphasis></link>
3235event.
3236<emphasis role='bold'>GravityNotify</emphasis>
3237events are generated after the
3238<link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>
3239event is generated.
3240</para>
3241<para>
3242A gravity of
3243<emphasis role='bold'>Static</emphasis>
3244indicates that the contents or origin should not move relative to the origin
3245of the root window.
3246If the change in size of the window is coupled with a change
3247in position of [X, Y],
3248then for bit-gravity the change in position of each pixel is [-X, -Y] and for
3249win-gravity the change in position of a child when its parent is so
3250resized is [-X, -Y].
3251Note that
3252<emphasis role='bold'>Static</emphasis>
3253gravity still only takes effect when the width or height of the
3254window is changed, not when the window is simply moved.
3255</para>
3256<para>
3257A bit-gravity of
3258<emphasis role='bold'>Forget</emphasis>
3259indicates that the window contents are always discarded after a size change,
3260even if backing-store or save-under has been requested.
3261The window is tiled with its background (except, if no background is defined,
3262the existing screen contents are not altered)
3263and zero or more exposure events are generated.
3264</para>
3265<para>
3266The contents and borders of inferiors are not affected by their parent's
3267bit-gravity.
3268A server is permitted to ignore the specified bit-gravity and use
3269<emphasis role='bold'>Forget</emphasis>
3270instead.
3271</para>
3272<para>
3273A win-gravity of
3274<emphasis role='bold'>Unmap</emphasis>
3275is like
3276<emphasis role='bold'>NorthWest</emphasis>,
3277but the child is also unmapped when the parent is resized,
3278and an
3279<link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>
3280event is generated.
3281<emphasis role='bold'>UnmapNotify</emphasis>
3282events are generated after the
3283<link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>
3284event is generated.
3285</para>
3286<para>
3287If a sibling and a stack-mode are specified,
3288the window is restacked as follows:
3289</para>
3290
3291<informaltable frame='none'>
3292  <?dbfo keep-together="always" ?>
3293  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
3294  <colspec colname='c1' colwidth='1.0*'/>
3295  <colspec colname='c2' colwidth='3.0*'/>
3296  <tbody>
3297    <row>
3298      <entry>
3299<emphasis role='bold'>Above</emphasis>
3300      </entry>
3301      <entry>
3302The window is placed just above the sibling.
3303      </entry>
3304    </row>
3305    <row>
3306      <entry>
3307<emphasis role='bold'>Below</emphasis>
3308      </entry>
3309      <entry>
3310The window is placed just below the sibling.
3311      </entry>
3312    </row>
3313    <row>
3314      <entry>
3315<emphasis role='bold'>TopIf</emphasis>
3316      </entry>
3317      <entry>
3318If the sibling occludes the window,
3319then the window is placed at the top of the stack.
3320      </entry>
3321    </row>
3322    <row>
3323      <entry>
3324<emphasis role='bold'>BottomIf</emphasis>
3325      </entry>
3326      <entry>
3327If the window occludes the sibling,
3328then the window is placed at the bottom of the stack.
3329      </entry>
3330    </row>
3331    <row>
3332      <entry>
3333<emphasis role='bold'>Opposite</emphasis>
3334      </entry>
3335      <entry>
3336If the sibling occludes the window,
3337then the window is placed at the top of the stack.
3338Otherwise, if the window occludes the sibling,
3339then the window is placed at the bottom of the stack.
3340      </entry>
3341    </row>
3342  </tbody>
3343  </tgroup>
3344</informaltable>
3345
3346<para>
3347If a stack-mode is specified but no sibling is specified,
3348the window is restacked as follows:
3349</para>
3350
3351<informaltable frame='none'>
3352  <?dbfo keep-together="always" ?>
3353  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
3354  <colspec colname='c1' colwidth='1.0*'/>
3355  <colspec colname='c2' colwidth='3.0*'/>
3356  <tbody>
3357    <row>
3358      <entry>
3359<emphasis role='bold'>Above</emphasis>
3360      </entry>
3361      <entry>
3362The window is placed at the top of the stack.
3363      </entry>
3364    </row>
3365    <row>
3366      <entry>
3367<emphasis role='bold'>Below</emphasis>
3368      </entry>
3369      <entry>
3370The window is placed at the bottom of the stack.
3371      </entry>
3372    </row>
3373    <row>
3374      <entry>
3375<emphasis role='bold'>TopIf</emphasis>
3376      </entry>
3377      <entry>
3378If any sibling occludes the window,
3379then the window is placed at the top of the stack.
3380      </entry>
3381    </row>
3382    <row>
3383      <entry>
3384<emphasis role='bold'>BottomIf</emphasis>
3385      </entry>
3386      <entry>
3387If the window occludes any sibling,
3388then the window is placed at the bottom of the stack.
3389      </entry>
3390    </row>
3391    <row>
3392      <entry>
3393<emphasis role='bold'>Opposite</emphasis>
3394      </entry>
3395      <entry>
3396If any sibling occludes the window,
3397then the window is placed at the top of the stack.
3398Otherwise, if the window occludes any sibling,
3399then the window is placed at the bottom of the stack.
3400      </entry>
3401    </row>
3402  </tbody>
3403  </tgroup>
3404</informaltable>
3405
3406<para>
3407It is a
3408<emphasis role='bold'>Match</emphasis>
3409error if a sibling is specified without a stack-mode
3410or if the window is not actually a sibling.
3411</para>
3412<para>
3413Note that the computations for
3414<emphasis role='bold'>BottomIf</emphasis>,
3415<emphasis role='bold'>TopIf</emphasis>,
3416and
3417<emphasis role='bold'>Opposite</emphasis>
3418are performed with respect to the window's final geometry (as controlled by
3419the other arguments to the request), not to its initial geometry.
3420</para>
3421<para>
3422Attempts to configure a root window have no effect.
3423</para>
3424
3425  </section>
3426  <section id="requests:CirculateWindow">
3427    <title>CirculateWindow</title>
3428    <indexterm zone="requests:CirculateWindow" significance="preferred"><primary>CirculateWindow</primary></indexterm>
3429<informaltable frame='none'>
3430  <?dbfo keep-together="always" ?>
3431  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3432  <colspec colname='c1' colwidth='1.0*'/>
3433  <tbody>
3434    <row>
3435      <entry>
3436<!-- .in +.2i -->
3437<emphasis remap='I'>window</emphasis>: WINDOW
3438      </entry>
3439    </row>
3440    <row>
3441      <entry>
3442<emphasis remap='I'>direction</emphasis>:
3443{ <emphasis role='bold'>RaiseLowest</emphasis>,
3444<emphasis role='bold'>LowerHighest</emphasis>}
3445<!-- .in -.2i -->
3446      </entry>
3447    </row>
3448    <row>
3449      <entry>
3450<!-- .in +.2i -->
3451Errors:
3452<emphasis role='bold'>Value</emphasis>,
3453<emphasis role='bold'>Window</emphasis>
3454<!-- .in -.2i -->
3455<!-- .eM -->
3456      </entry>
3457    </row>
3458  </tbody>
3459  </tgroup>
3460</informaltable>
3461<!-- .eM -->
3462<para>
3463If some other client has selected
3464<emphasis role='bold'>SubstructureRedirect</emphasis>
3465on the window, then a
3466<link linkend="events:CirculateRequest"><emphasis role='bold'>CirculateRequest</emphasis></link>
3467event is generated, and no further processing is performed.
3468Otherwise, the following is performed, and then a
3469<link linkend="events:CirculateNotify"><emphasis role='bold'>CirculateNotify</emphasis></link>
3470event is generated if the window is actually restacked.
3471</para>
3472<para>
3473For
3474<emphasis role='bold'>RaiseLowest</emphasis>,
3475<emphasis role='bold'>CirculateWindow</emphasis>
3476raises the lowest mapped child (if any) that is
3477occluded by another child to the top of the stack.
3478For
3479<emphasis role='bold'>LowerHighest</emphasis>,
3480<emphasis role='bold'>CirculateWindow</emphasis>
3481lowers the highest mapped child (if any) that occludes another child to
3482the bottom of the stack.
3483Exposure processing is performed on formerly obscured windows.
3484<!-- .sp -->
3485</para>
3486  </section>
3487  <section id="requests:GetGeometry">
3488    <title>GetGeometry</title>
3489    <indexterm zone="requests:GetGeometry" significance="preferred"><primary>GetGeometry</primary></indexterm>
3490<informaltable frame='none'>
3491  <?dbfo keep-together="always" ?>
3492  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3493  <colspec colname='c1' colwidth='1.0*'/>
3494  <tbody>
3495    <row>
3496      <entry>
3497<!-- .in +.2i -->
3498<emphasis remap='I'>drawable</emphasis>: DRAWABLE
3499<!-- .in -.2i -->
3500      </entry>
3501    </row>
3502    <row>
3503      <entry>
35043505      </entry>
3506    </row>
3507    <row>
3508      <entry>
3509<!-- .in +.2i -->
3510root: WINDOW
3511      </entry>
3512    </row>
3513    <row>
3514      <entry>
3515depth: CARD8
3516      </entry>
3517    </row>
3518    <row>
3519      <entry>
3520x, y: INT16
3521      </entry>
3522    </row>
3523    <row>
3524      <entry>
3525width, height, border-width: CARD16
3526<!-- .in -.2i -->
3527      </entry>
3528    </row>
3529    <row>
3530      <entry>
3531<!-- .in +.2i -->
3532Errors:
3533<emphasis role='bold'>Drawable</emphasis>
3534<!-- .in -.2i -->
3535<!-- .eM -->
3536      </entry>
3537    </row>
3538  </tbody>
3539  </tgroup>
3540</informaltable>
3541<!-- .eM -->
3542<para>
3543This request returns the root and current geometry of the drawable.
3544The depth is the number of bits per pixel for the object.
3545The x, y, and border-width will always be zero for pixmaps.
3546For a window,
3547the x and y coordinates specify the upper-left outer corner of the window
3548relative to its parent's origin,
3549and the width and height specify the inside size, not including the border.
3550</para>
3551<para>
3552It is legal to pass an
3553<emphasis role='bold'>InputOnly</emphasis>
3554window as a drawable to this request.
3555<!-- .sp -->
3556</para>
3557  </section>
3558  <section id="requests:QueryTree">
3559    <title>QueryTree</title>
3560    <indexterm zone="requests:QueryTree" significance="preferred"><primary>QueryTree</primary></indexterm>
3561    <indexterm zone="requests:QueryTree"><primary>Children</primary></indexterm>
3562<informaltable frame='none'>
3563  <?dbfo keep-together="always" ?>
3564  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3565  <colspec colname='c1' colwidth='1.0*'/>
3566  <tbody>
3567    <row>
3568      <entry>
3569<!-- .in +.2i -->
3570<emphasis remap='I'>window</emphasis>: WINDOW
3571<!-- .in -.2i -->
3572      </entry>
3573    </row>
3574    <row>
3575      <entry>
35763577      </entry>
3578    </row>
3579    <row>
3580      <entry>
3581<!-- .in +.2i -->
3582root: WINDOW
3583      </entry>
3584    </row>
3585    <row>
3586      <entry>
3587parent: WINDOW or
3588<emphasis role='bold'>None</emphasis>
3589      </entry>
3590    </row>
3591    <row>
3592      <entry>
3593children: LISTofWINDOW
3594<!-- .in -.2i -->
3595      </entry>
3596    </row>
3597    <row>
3598      <entry>
3599<!-- .in +.2i -->
3600Errors:
3601<emphasis role='bold'>Window</emphasis>
3602<!-- .in -.2i -->
3603<!-- .eM -->
3604      </entry>
3605    </row>
3606  </tbody>
3607  </tgroup>
3608</informaltable>
3609<!-- .eM -->
3610<para>
3611This request returns the root, the parent, and the children of the window.
3612The children are listed in bottom-to-top stacking order.
3613<!-- .sp -->
3614</para>
3615  </section>
3616  <section id="requests:InternAtom">
3617    <title>InternAtom</title>
3618    <indexterm zone="requests:InternAtom" significance="preferred"><primary>InternAtom</primary></indexterm>
3619    <indexterm zone="requests:InternAtom"><primary>Atom</primary></indexterm>
3620<informaltable frame='none'>
3621  <?dbfo keep-together="always" ?>
3622  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3623  <colspec colname='c1' colwidth='1.0*'/>
3624  <tbody>
3625    <row>
3626      <entry>
3627<!-- .in +.2i -->
3628<emphasis remap='I'>name</emphasis>: STRING8
3629      </entry>
3630    </row>
3631    <row>
3632      <entry>
3633<emphasis remap='I'>only-if-exists</emphasis>: BOOL
3634<!-- .in -.2i -->
3635      </entry>
3636    </row>
3637    <row>
3638      <entry>
36393640      </entry>
3641    </row>
3642    <row>
3643      <entry>
3644<!-- .in +.2i -->
3645atom: ATOM or
3646<emphasis role='bold'>None</emphasis>
3647<!-- .in -.2i -->
3648      </entry>
3649    </row>
3650    <row>
3651      <entry>
3652<!-- .in +.2i -->
3653Errors:
3654<emphasis role='bold'>Alloc</emphasis>,
3655<emphasis role='bold'>Value</emphasis>
3656<!-- .in -.2i -->
3657<!-- .eM -->
3658      </entry>
3659    </row>
3660  </tbody>
3661  </tgroup>
3662</informaltable>
3663<!-- .eM -->
3664<para>
3665This request returns the atom for the given name.
3666If only-if-exists is
3667<emphasis role='bold'>False</emphasis>,
3668then the atom is created if it does not exist.
3669The string should use the ISO Latin-1 encoding.
3670Uppercase and lowercase matter.
3671</para>
3672<para>
3673The lifetime of an atom is not tied to the interning client.
3674Atoms remain defined until server reset (see <link linkend='Connection_Close'>section 10</link>).
3675<!-- .sp -->
3676</para>
3677  </section>
3678  <section id="requests:GetAtomName">
3679    <title>GetAtomName</title>
3680    <indexterm zone="requests:GetAtomName" significance="preferred"><primary>GetAtomName</primary></indexterm>
3681<informaltable frame='none'>
3682  <?dbfo keep-together="always" ?>
3683  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3684  <colspec colname='c1' colwidth='1.0*'/>
3685  <tbody>
3686    <row>
3687      <entry>
3688<!-- .in +.2i -->
3689<emphasis remap='I'>atom</emphasis>: ATOM
3690<!-- .in -.2i -->
3691      </entry>
3692    </row>
3693    <row>
3694      <entry>
36953696      </entry>
3697    </row>
3698    <row>
3699      <entry>
3700<!-- .in +.2i -->
3701name: STRING8
3702<!-- .in -.2i -->
3703      </entry>
3704    </row>
3705    <row>
3706      <entry>
3707<!-- .in +.2i -->
3708Errors:
3709<emphasis role='bold'>Atom</emphasis>
3710<!-- .in -.2i -->
3711<!-- .eM -->
3712      </entry>
3713    </row>
3714  </tbody>
3715  </tgroup>
3716</informaltable>
3717<!-- .eM -->
3718<para>
3719This request returns the name for the given atom.
3720<!-- .sp -->
3721</para>
3722  </section>
3723  <section id="requests:ChangeProperty">
3724    <title>ChangeProperty</title>
3725    <indexterm zone="requests:ChangeProperty" significance="preferred"><primary>ChangeProperty</primary></indexterm>
3726    <indexterm zone="requests:ChangeProperty"><primary>Property</primary></indexterm>
3727<informaltable frame='none'>
3728  <?dbfo keep-together="always" ?>
3729  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3730  <colspec colname='c1' colwidth='1.0*'/>
3731  <tbody>
3732    <row>
3733      <entry>
3734<!-- .in +.2i -->
3735<emphasis remap='I'>window</emphasis>: WINDOW
3736      </entry>
3737    </row>
3738    <row>
3739      <entry>
3740<emphasis remap='I'>property</emphasis>, <emphasis remap='I'>type</emphasis>: ATOM
3741      </entry>
3742    </row>
3743    <row>
3744      <entry>
3745<emphasis remap='I'>format</emphasis>: {8, 16, 32}
3746      </entry>
3747    </row>
3748    <row>
3749      <entry>
3750<emphasis remap='I'>mode</emphasis>:
3751{ <emphasis role='bold'>Replace</emphasis>,
3752<emphasis role='bold'>Prepend</emphasis>,
3753<emphasis role='bold'>Append</emphasis>}
3754      </entry>
3755    </row>
3756    <row>
3757      <entry>
3758<emphasis remap='I'>data</emphasis>: LISTofINT8 or LISTofINT16 or LISTofINT32
3759<!-- .in -.2i -->
3760      </entry>
3761    </row>
3762    <row>
3763      <entry>
3764<!-- .in +.2i -->
3765Errors:
3766<emphasis role='bold'>Alloc</emphasis>,
3767<emphasis role='bold'>Atom</emphasis>,
3768<emphasis role='bold'>Match</emphasis>,
3769<emphasis role='bold'>Value</emphasis>,
3770<emphasis role='bold'>Window</emphasis>
3771<!-- .in -.2i -->
3772<!-- .eM -->
3773      </entry>
3774    </row>
3775  </tbody>
3776  </tgroup>
3777</informaltable>
3778<!-- .eM -->
3779<para>
3780This request alters the property for the specified window.
3781The type is uninterpreted by the server.
3782The format specifies whether the data should be viewed as a list of 8-bit,
378316-bit, or 32-bit quantities so that the server can correctly byte-swap
3784as necessary.
3785</para>
3786<para>
3787If the mode is
3788<emphasis role='bold'>Replace</emphasis>,
3789the previous property value is discarded.
3790If the mode is
3791<emphasis role='bold'>Prepend</emphasis>
3792or
3793<emphasis role='bold'>Append</emphasis>,
3794then the type and format must match the existing property value (or a
3795<emphasis role='bold'>Match</emphasis>
3796error results).
3797If the property is undefined,
3798it is treated as defined with the correct type
3799and format with zero-length data.
3800For
3801<emphasis role='bold'>Prepend</emphasis>,
3802the data is tacked on to the beginning of the existing data, and for
3803<emphasis role='bold'>Append</emphasis>,
3804it is tacked on to the end of the existing data.
3805</para>
3806<para>
3807This request generates a
3808<link linkend="events:PropertyNotify"><emphasis role='bold'>PropertyNotify</emphasis></link>
3809event on the window.
3810</para>
3811<para>
3812The lifetime of a property is not tied to the storing client.
3813Properties remain until explicitly deleted, until the window is destroyed,
3814or until server reset (see <link linkend='Connection_Close'>section 10</link>).
3815</para>
3816<para>
3817The maximum size of a property is server-dependent and may vary dynamically.
3818<!-- .sp -->
3819</para>
3820  </section>
3821  <section id="requests:DeleteProperty">
3822    <title>DeleteProperty</title>
3823    <indexterm zone="requests:DeleteProperty" significance="preferred"><primary>DeleteProperty</primary></indexterm>
3824<informaltable frame='none'>
3825  <?dbfo keep-together="always" ?>
3826  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3827  <colspec colname='c1' colwidth='1.0*'/>
3828  <tbody>
3829    <row>
3830      <entry>
3831<!-- .in +.2i -->
3832<emphasis remap='I'>window</emphasis>: WINDOW
3833      </entry>
3834    </row>
3835    <row>
3836      <entry>
3837<emphasis remap='I'>property</emphasis>: ATOM
3838<!-- .in -.2i -->
3839      </entry>
3840    </row>
3841    <row>
3842      <entry>
3843<!-- .in +.2i -->
3844Errors:
3845<emphasis role='bold'>Atom</emphasis>,
3846<emphasis role='bold'>Window</emphasis>
3847<!-- .in -.2i -->
3848<!-- .eM -->
3849      </entry>
3850    </row>
3851  </tbody>
3852  </tgroup>
3853</informaltable>
3854<!-- .eM -->
3855<para>
3856This request deletes the property from the specified window
3857if the property exists and generates a
3858<link linkend="events:PropertyNotify"><emphasis role='bold'>PropertyNotify</emphasis></link>
3859event on the window unless the property does not exist.
3860<!-- .sp -->
3861</para>
3862  </section>
3863  <section id="requests:GetProperty">
3864    <title>GetProperty</title>
3865    <indexterm zone="requests:GetProperty" significance="preferred"><primary>GetProperty</primary></indexterm>
3866<informaltable frame='none'>
3867  <?dbfo keep-together="always" ?>
3868  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3869  <colspec colname='c1' colwidth='1.0*'/>
3870  <tbody>
3871    <row>
3872      <entry>
3873<!-- .in +.2i -->
3874<emphasis remap='I'>window</emphasis>: WINDOW
3875      </entry>
3876    </row>
3877    <row>
3878      <entry>
3879<emphasis remap='I'>property</emphasis>: ATOM
3880      </entry>
3881    </row>
3882    <row>
3883      <entry>
3884<emphasis remap='I'>type</emphasis>: ATOM or
3885<emphasis role='bold'>AnyPropertyType</emphasis>
3886      </entry>
3887    </row>
3888    <row>
3889      <entry>
3890<emphasis remap='I'>long-offset</emphasis>, <emphasis remap='I'>long-length</emphasis>: CARD32
3891      </entry>
3892    </row>
3893    <row>
3894      <entry>
3895<emphasis remap='I'>delete</emphasis>: BOOL
3896<!-- .in -.2i -->
3897      </entry>
3898    </row>
3899    <row>
3900      <entry>
39013902      </entry>
3903    </row>
3904    <row>
3905      <entry>
3906<!-- .in +.2i -->
3907type: ATOM or
3908<emphasis role='bold'>None</emphasis>
3909      </entry>
3910    </row>
3911    <row>
3912      <entry>
3913format: {0, 8, 16, 32}
3914      </entry>
3915    </row>
3916    <row>
3917      <entry>
3918bytes-after: CARD32
3919      </entry>
3920    </row>
3921    <row>
3922      <entry>
3923value: LISTofINT8 or LISTofINT16 or LISTofINT32
3924<!-- .in -.2i -->
3925      </entry>
3926    </row>
3927    <row>
3928      <entry>
3929<!-- .in +.2i -->
3930Errors:
3931<emphasis role='bold'>Atom</emphasis>,
3932<emphasis role='bold'>Value</emphasis>,
3933<emphasis role='bold'>Window</emphasis>
3934<!-- .in -.2i -->
3935<!-- .eM -->
3936      </entry>
3937    </row>
3938  </tbody>
3939  </tgroup>
3940</informaltable>
3941<!-- .eM -->
3942<para>
3943If the specified property does not exist for the specified window,
3944then the return type is
3945<emphasis role='bold'>None</emphasis>,
3946the format and bytes-after are zero,
3947and the value is empty.
3948The delete argument is ignored in this case.
3949If the specified property exists but its type does not match the specified type,
3950then the return type is the actual type of the property,
3951the format is the actual format of the property (never zero),
3952the bytes-after is the length of the property in bytes
3953(even if the format is 16 or 32),
3954and the value is empty.
3955The delete argument is ignored in this case.
3956If the specified property exists and either
3957<emphasis role='bold'>AnyPropertyType</emphasis>
3958is specified or the specified type matches the actual type of the property,
3959then the return type is the actual type of the property,
3960the format is the actual format of the property (never zero),
3961and the bytes-after and value are as follows, given:
3962<literallayout class="monospaced">
3963	N = actual length of the stored property in bytes
3964	    (even if the format is 16 or 32)
3965	I = 4 * long-offset
3966	T = N - I
3967	L = MINIMUM(T, 4 * long-length)
3968	A = N - (I + L)
3969</literallayout>
3970</para>
3971<para>
3972The returned value starts at byte index I in the property (indexing from 0),
3973and its length in bytes is L.
3974However, it is a
3975<emphasis role='bold'>Value</emphasis>
3976error if long-offset is given such that L is negative.
3977The value of bytes-after is A,
3978giving the number of trailing unread bytes in the stored
3979property.
3980If delete is
3981<emphasis role='bold'>True</emphasis>
3982and the bytes-after is zero,
3983the property is also deleted from the window,
3984and a
3985<link linkend="events:PropertyNotify"><emphasis role='bold'>PropertyNotify</emphasis></link>
3986event is generated on the window.
3987<!-- .sp -->
3988</para>
3989  </section>
3990  <section id="requests:RotateProperties">
3991    <title>RotateProperties</title>
3992    <indexterm zone="requests:RotateProperties" significance="preferred"><primary>RotateProperties</primary></indexterm>
3993<informaltable frame='none'>
3994  <?dbfo keep-together="always" ?>
3995  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
3996  <colspec colname='c1' colwidth='1.0*'/>
3997  <tbody>
3998    <row>
3999      <entry>
4000<!-- .in +.2i -->
4001<emphasis remap='I'>window</emphasis>: WINDOW
4002      </entry>
4003    </row>
4004    <row>
4005      <entry>
4006<emphasis remap='I'>delta</emphasis>: INT16
4007      </entry>
4008    </row>
4009    <row>
4010      <entry>
4011<emphasis remap='I'>properties</emphasis>: LISTofATOM
4012<!-- .in -.2i -->
4013      </entry>
4014    </row>
4015    <row>
4016      <entry>
4017<!-- .in +.2i -->
4018Errors:
4019<emphasis role='bold'>Atom</emphasis>,
4020<emphasis role='bold'>Match</emphasis>,
4021<emphasis role='bold'>Window</emphasis>
4022<!-- .in -.2i -->
4023<!-- .eM -->
4024      </entry>
4025    </row>
4026  </tbody>
4027  </tgroup>
4028</informaltable>
4029<!-- .eM -->
4030<para>
4031If the property names in the list are viewed as being numbered starting
4032from zero, and there are N property names in the list,
4033then the value associated with property name I becomes the value
4034associated with property name (I + delta) mod N, for all I from zero to N - 1.
4035The effect is to rotate the states by delta places around the virtual ring
4036of property names (right for positive delta, left for negative delta).
4037</para>
4038<para>
4039If delta mod N is nonzero,
4040a
4041<link linkend="events:PropertyNotify"><emphasis role='bold'>PropertyNotify</emphasis></link>
4042event is generated for each property in the order listed.
4043</para>
4044<para>
4045If an atom occurs more than once in the list or no property with that
4046name is defined for the window,
4047a
4048<emphasis role='bold'>Match</emphasis>
4049error is generated.
4050If an
4051<emphasis role='bold'>Atom</emphasis>
4052or
4053<emphasis role='bold'>Match</emphasis>
4054error is generated, no properties are changed.
4055<!-- .sp -->
4056</para>
4057  </section>
4058  <section id="requests:ListProperties">
4059    <title>ListProperties</title>
4060    <indexterm zone="requests:ListProperties" significance="preferred"><primary>ListProperties</primary></indexterm>
4061<informaltable frame='none'>
4062  <?dbfo keep-together="always" ?>
4063  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4064  <colspec colname='c1' colwidth='1.0*'/>
4065  <tbody>
4066    <row>
4067      <entry>
4068<!-- .in +.2i -->
4069<emphasis remap='I'>window</emphasis>: WINDOW
4070<!-- .in -.2i -->
4071      </entry>
4072    </row>
4073    <row>
4074      <entry>
40754076      </entry>
4077    </row>
4078    <row>
4079      <entry>
4080<!-- .in +.2i -->
4081atoms: LISTofATOM
4082<!-- .in -.2i -->
4083      </entry>
4084    </row>
4085    <row>
4086      <entry>
4087<!-- .in +.2i -->
4088Errors:
4089<emphasis role='bold'>Window</emphasis>
4090<!-- .in -.2i -->
4091<!-- .eM -->
4092      </entry>
4093    </row>
4094  </tbody>
4095  </tgroup>
4096</informaltable>
4097<!-- .eM -->
4098<para>
4099This request returns the atoms of properties currently defined on the window.
4100<!-- .sp -->
4101</para>
4102  </section>
4103  <section id="requests:SetSelectionOwner">
4104    <title>SetSelectionOwner</title>
4105    <indexterm zone="requests:SetSelectionOwner" significance="preferred"><primary>SetSelectionOwner</primary></indexterm>
4106    <indexterm zone="requests:SetSelectionOwner"><primary>Selection</primary></indexterm>
4107<informaltable frame='none'>
4108  <?dbfo keep-together="always" ?>
4109  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4110  <colspec colname='c1' colwidth='1.0*'/>
4111  <tbody>
4112    <row>
4113      <entry>
4114<!-- .in +.2i -->
4115<emphasis remap='I'>selection</emphasis>: ATOM
4116      </entry>
4117    </row>
4118    <row>
4119      <entry>
4120<emphasis remap='I'>owner</emphasis>: WINDOW or
4121<emphasis role='bold'>None</emphasis>
4122      </entry>
4123    </row>
4124    <row>
4125      <entry>
4126<emphasis remap='I'>time</emphasis>: TIMESTAMP or
4127<emphasis role='bold'>CurrentTime</emphasis>
4128<!-- .in -.2i -->
4129      </entry>
4130    </row>
4131    <row>
4132      <entry>
4133<!-- .in +.2i -->
4134Errors:
4135<emphasis role='bold'>Atom</emphasis>,
4136<emphasis role='bold'>Window</emphasis>
4137<!-- .in -.2i -->
4138<!-- .eM -->
4139      </entry>
4140    </row>
4141  </tbody>
4142  </tgroup>
4143</informaltable>
4144<!-- .eM -->
4145<para>
4146This request changes the owner, owner window,
4147and last-change time of the specified selection.
4148This request has no effect if the specified time is earlier
4149than the current last-change time of the specified selection or is
4150later than the current server time.
4151Otherwise, the last-change time is set to the specified time
4152with
4153<emphasis role='bold'>CurrentTime</emphasis>
4154replaced by the current server time.
4155If the owner window is specified as
4156<emphasis role='bold'>None</emphasis>,
4157then the owner of the selection becomes
4158<emphasis role='bold'>None</emphasis>
4159(that is, no owner).
4160Otherwise, the owner of the selection becomes the client executing the request.
4161If the new owner (whether a client or
4162<emphasis role='bold'>None</emphasis>)
4163is not the same as the current owner
4164and the current owner is not
4165<emphasis role='bold'>None</emphasis>,
4166then the current owner is sent a
4167<link linkend="events:SelectionClear"><emphasis role='bold'>SelectionClear</emphasis></link>
4168event.
4169</para>
4170<para>
4171If the client that is the owner of a selection is later terminated
4172(that is, its connection is closed) or if the owner window it has
4173specified in the request is later destroyed,
4174then the owner of the selection automatically reverts to
4175<emphasis role='bold'>None</emphasis>,
4176but the last-change time is not affected.
4177</para>
4178<para>
4179The selection atom is uninterpreted by the server.
4180The owner window is returned by the
4181<link linkend="requests:GetSelectionOwner"><emphasis role='bold'>GetSelectionOwner</emphasis></link>
4182request and is reported in
4183<link linkend="events:SelectionRequest"><emphasis role='bold'>SelectionRequest</emphasis></link>
4184and
4185<link linkend="events:SelectionClear"><emphasis role='bold'>SelectionClear</emphasis></link>
4186events.
4187</para>
4188<para>
4189Selections are global to the server.
4190<!-- .sp -->
4191</para>
4192  </section>
4193  <section id="requests:GetSelectionOwner">
4194    <title>GetSelectionOwner</title>
4195    <indexterm zone="requests:GetSelectionOwner" significance="preferred"><primary>GetSelectionOwner</primary></indexterm>
4196<informaltable frame='none'>
4197  <?dbfo keep-together="always" ?>
4198  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4199  <colspec colname='c1' colwidth='1.0*'/>
4200  <tbody>
4201    <row>
4202      <entry>
4203<!-- .in +.2i -->
4204<emphasis remap='I'>selection</emphasis>: ATOM
4205<!-- .in -.2i -->
4206      </entry>
4207    </row>
4208    <row>
4209      <entry>
42104211      </entry>
4212    </row>
4213    <row>
4214      <entry>
4215<!-- .in +.2i -->
4216owner: WINDOW or
4217<emphasis role='bold'>None</emphasis>
4218<!-- .in -.2i -->
4219      </entry>
4220    </row>
4221    <row>
4222      <entry>
4223<!-- .in +.2i -->
4224Errors:
4225<emphasis role='bold'>Atom</emphasis>
4226<!-- .in -.2i -->
4227<!-- .eM -->
4228      </entry>
4229    </row>
4230  </tbody>
4231  </tgroup>
4232</informaltable>
4233<!-- .eM -->
4234<para>
4235This request returns the current owner window of the specified selection,
4236if any.
4237If
4238<emphasis role='bold'>None</emphasis>
4239is returned, then there is no owner for the selection.
4240<!-- .sp -->
4241</para>
4242  </section>
4243  <section id="requests:ConvertSelection">
4244    <title>ConvertSelection</title>
4245    <indexterm zone="requests:ConvertSelection" significance="preferred"><primary>ConvertSelection</primary></indexterm>
4246<informaltable frame='none'>
4247  <?dbfo keep-together="always" ?>
4248  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4249  <colspec colname='c1' colwidth='1.0*'/>
4250  <tbody>
4251    <row>
4252      <entry>
4253<!-- .in +.2i -->
4254<emphasis remap='I'>selection</emphasis>, <emphasis remap='I'>target</emphasis>: ATOM
4255      </entry>
4256    </row>
4257    <row>
4258      <entry>
4259<emphasis remap='I'>property</emphasis>: ATOM or
4260<emphasis role='bold'>None</emphasis>
4261      </entry>
4262    </row>
4263    <row>
4264      <entry>
4265<emphasis remap='I'>requestor</emphasis>: WINDOW
4266      </entry>
4267    </row>
4268    <row>
4269      <entry>
4270<emphasis remap='I'>time</emphasis>: TIMESTAMP or
4271<emphasis role='bold'>CurrentTime</emphasis>
4272<!-- .in -.2i -->
4273      </entry>
4274    </row>
4275    <row>
4276      <entry>
4277<!-- .in +.2i -->
4278Errors:
4279<emphasis role='bold'>Atom</emphasis>,
4280<emphasis role='bold'>Window</emphasis>
4281<!-- .in -.2i -->
4282<!-- .eM -->
4283      </entry>
4284    </row>
4285  </tbody>
4286  </tgroup>
4287</informaltable>
4288<!-- .eM -->
4289<para>
4290If the specified selection has an owner,
4291the server sends a
4292<link linkend="events:SelectionRequest"><emphasis role='bold'>SelectionRequest</emphasis></link>
4293event to that owner.
4294If no owner for the specified selection exists,
4295the server generates a
4296<link linkend="events:SelectionNotify"><emphasis role='bold'>SelectionNotify</emphasis></link>
4297event to the requestor with property
4298<emphasis role='bold'>None</emphasis>.
4299The arguments are passed on unchanged in either of the events.
4300<!-- .sp -->
4301</para>
4302  </section>
4303  <section id="requests:SendEvent">
4304    <title>SendEvent</title>
4305    <indexterm zone="requests:SendEvent" significance="preferred"><primary>SendEvent</primary></indexterm>
4306    <indexterm zone="requests:SendEvent" significance="preferred"><primary>Event</primary><secondary>sending</secondary></indexterm>
4307<informaltable frame='none'>
4308  <?dbfo keep-together="always" ?>
4309  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4310  <colspec colname='c1' colwidth='1.0*'/>
4311  <tbody>
4312    <row>
4313      <entry>
4314<!-- .in +.2i -->
4315<emphasis remap='I'>destination</emphasis>: WINDOW or
4316<emphasis role='bold'>PointerWindow</emphasis>
4317or
4318<emphasis role='bold'>InputFocus</emphasis>
4319      </entry>
4320    </row>
4321    <row>
4322      <entry>
4323<emphasis remap='I'>propagate</emphasis>: BOOL
4324      </entry>
4325    </row>
4326    <row>
4327      <entry>
4328<emphasis remap='I'>event-mask</emphasis>: SETofEVENT
4329      </entry>
4330    </row>
4331    <row>
4332      <entry>
4333<emphasis remap='I'>event</emphasis>: &lt;normal-event-format&gt;
4334<!-- .in -.2i -->
4335      </entry>
4336    </row>
4337    <row>
4338      <entry>
4339<!-- .in +.2i -->
4340Errors:
4341<emphasis role='bold'>Value</emphasis>,
4342<emphasis role='bold'>Window</emphasis>
4343<!-- .in -.2i -->
4344<!-- .eM -->
4345      </entry>
4346    </row>
4347  </tbody>
4348  </tgroup>
4349</informaltable>
4350<!-- .eM -->
4351<para>
4352If
4353<emphasis role='bold'>PointerWindow</emphasis>
4354is specified,
4355destination is replaced with the window that the pointer is in.
4356If
4357<emphasis role='bold'>InputFocus</emphasis>
4358is specified and the focus window contains the pointer,
4359destination is replaced with the window that the pointer is in.
4360Otherwise, destination is replaced with the focus window.
4361</para>
4362<para>
4363If the event-mask is the empty set,
4364then the event is sent to the client that created the destination window.
4365If that client no longer exists, no event is sent.
4366</para>
4367<para>
4368If propagate is
4369<emphasis role='bold'>False</emphasis>,
4370then the event is sent to every client selecting
4371on destination any of the event types in event-mask.
4372</para>
4373<para>
4374If propagate is
4375<emphasis role='bold'>True</emphasis>
4376and no clients have selected on destination any
4377of the event types in event-mask,
4378then destination is replaced with the
4379closest ancestor of destination for which some client has selected a
4380type in event-mask and no intervening window has that type in its
4381do-not-propagate-mask.
4382If no such window exists or if the window is an ancestor of the focus window
4383and
4384<emphasis role='bold'>InputFocus</emphasis>
4385was originally specified as the destination,
4386then the event is not sent to any clients.
4387Otherwise, the event is reported to every client selecting on the final
4388destination any of the types specified in event-mask.
4389</para>
4390<para>
4391The event code must be one of the core events or one of the events
4392defined by an extension (or a
4393<emphasis role='bold'>Value</emphasis>
4394error results) so that the server can correctly byte-swap the
4395contents as necessary.
4396The contents of the event are otherwise unaltered and unchecked
4397by the server except to force on the most significant bit of the event code
4398and to set the sequence number in the event correctly.
4399</para>
4400<para>
4401Active grabs are ignored for this request.
4402<!-- .sp -->
4403</para>
4404  </section>
4405  <section id="requests:GrabPointer">
4406    <title>GrabPointer</title>
4407    <indexterm zone="requests:GrabPointer" significance="preferred"><primary>GrabPointer</primary></indexterm>
4408    <indexterm zone="requests:GrabPointer"><primary>Active grab</primary><secondary>pointer</secondary></indexterm>
4409    <indexterm zone="requests:GrabPointer"><primary>Pointer</primary><secondary>grabbing</secondary></indexterm>
4410<informaltable frame='none'>
4411  <?dbfo keep-together="always" ?>
4412  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4413  <colspec colname='c1' colwidth='1.0*'/>
4414  <tbody>
4415    <row>
4416      <entry>
4417<!-- .in +.2i -->
4418<emphasis remap='I'>grab-window</emphasis>: WINDOW
4419      </entry>
4420    </row>
4421    <row>
4422      <entry>
4423<emphasis remap='I'>owner-events</emphasis>: BOOL
4424      </entry>
4425    </row>
4426    <row>
4427      <entry>
4428<emphasis remap='I'>event-mask</emphasis>: SETofPOINTEREVENT
4429      </entry>
4430    </row>
4431    <row>
4432      <entry>
4433<emphasis remap='I'>pointer-mode</emphasis>, <emphasis remap='I'>keyboard-mode</emphasis>:
4434{ <emphasis role='bold'>Synchronous</emphasis>,
4435<emphasis role='bold'>Asynchronous</emphasis>}
4436      </entry>
4437    </row>
4438    <row>
4439      <entry>
4440<emphasis remap='I'>confine-to</emphasis>: WINDOW or
4441<emphasis role='bold'>None</emphasis>
4442      </entry>
4443    </row>
4444    <row>
4445      <entry>
4446<emphasis remap='I'>cursor</emphasis>: CURSOR or
4447<emphasis role='bold'>None</emphasis>
4448      </entry>
4449    </row>
4450    <row>
4451      <entry>
4452<emphasis remap='I'>time</emphasis>: TIMESTAMP or
4453<emphasis role='bold'>CurrentTime</emphasis>
4454<!-- .in -.2i -->
4455      </entry>
4456    </row>
4457    <row>
4458      <entry>
44594460      </entry>
4461    </row>
4462    <row>
4463      <entry>
4464<!-- .in +.2i -->
4465status:
4466{ <emphasis role='bold'>Success</emphasis>,
4467<emphasis role='bold'>AlreadyGrabbed</emphasis>,
4468<emphasis role='bold'>Frozen</emphasis>,
4469<emphasis role='bold'>InvalidTime</emphasis>,
4470<emphasis role='bold'>NotViewable</emphasis>}
4471<!-- .in -.2i -->
4472      </entry>
4473    </row>
4474    <row>
4475      <entry>
4476<!-- .in +.2i -->
4477Errors:
4478<emphasis role='bold'>Cursor</emphasis>,
4479<emphasis role='bold'>Value</emphasis>,
4480<emphasis role='bold'>Window</emphasis>
4481<!-- .in -.2i -->
4482<!-- .eM -->
4483      </entry>
4484    </row>
4485  </tbody>
4486  </tgroup>
4487</informaltable>
4488<!-- .eM -->
4489<para>
4490This request actively grabs control of the pointer.
4491Further pointer events are only reported to the grabbing client.
4492The request overrides any active pointer grab by this client.
4493</para>
4494<para>
4495If owner-events is
4496<emphasis role='bold'>False</emphasis>,
4497all generated pointer events are reported with respect to grab-window
4498and are only reported if selected by event-mask.
4499If owner-events is
4500<emphasis role='bold'>True</emphasis>
4501and a generated pointer event would normally be reported to this client,
4502it is reported normally.
4503Otherwise, the event is reported with respect to the grab-window and is
4504only reported if selected by event-mask.
4505For either value of owner-events,
4506unreported events are simply discarded.
4507</para>
4508<para>
4509If pointer-mode is
4510<emphasis role='bold'>Asynchronous</emphasis>,
4511pointer event processing continues normally.
4512If the pointer is currently frozen by this client,
4513then processing of pointer events is resumed.
4514If pointer-mode is
4515<emphasis role='bold'>Synchronous</emphasis>,
4516the state of the pointer (as seen by means of the protocol) appears to freeze,
4517and no further pointer events are generated by the server until the
4518grabbing client issues a releasing
4519<link linkend="requests:AllowEvents"><emphasis role='bold'>AllowEvents</emphasis></link>
4520request or until the pointer grab is released.
4521Actual pointer changes are not lost while the pointer is frozen.
4522They are simply queued for later processing.
4523</para>
4524<para>
4525If keyboard-mode is
4526<emphasis role='bold'>Asynchronous</emphasis>,
4527keyboard event processing is unaffected by activation of the grab.
4528If keyboard-mode is
4529<emphasis role='bold'>Synchronous</emphasis>,
4530the state of the keyboard (as seen by means of the protocol) appears to freeze,
4531and no further keyboard events are generated by the server until the grabbing
4532client issues a releasing
4533<emphasis role='bold'>AllowEvents</emphasis>
4534request or until the pointer grab is released.
4535Actual keyboard changes are not lost while the keyboard is frozen.
4536They are simply queued for later processing.
4537</para>
4538<para>
4539If a cursor is specified,
4540then it is displayed regardless of what window the pointer is in.
4541If no cursor is specified,
4542then when the pointer is in grab-window or one of its subwindows,
4543the normal cursor for that window is displayed.
4544Otherwise, the cursor for grab-window is displayed.
4545</para>
4546<para>
4547If a confine-to window is specified,
4548then the pointer will be restricted to stay contained in that window.
4549The confine-to window need have no relationship to the grab-window.
4550If the pointer is not initially in the confine-to window,
4551then it is warped automatically to the closest edge
4552(and enter/leave events are generated normally) just before the grab activates.
4553If the confine-to window is subsequently reconfigured,
4554the pointer will be warped automatically as necessary to
4555keep it contained in the window.
4556</para>
4557<para>
4558This request generates
4559<link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>
4560and
4561<link linkend="events:LeaveNotify"><emphasis role='bold'>LeaveNotify</emphasis></link>
4562events.
4563</para>
4564<para>
4565The request fails with status
4566<emphasis role='bold'>AlreadyGrabbed</emphasis>
4567if the pointer is actively grabbed by some other client.
4568The request fails with status
4569<emphasis role='bold'>Frozen</emphasis>
4570if the pointer is frozen by an active grab of another client.
4571The request fails with status
4572<emphasis role='bold'>NotViewable</emphasis>
4573if grab-window or confine-to window is not viewable
4574or if the confine-to window lies completely outside the boundaries
4575of the root window.
4576The request fails with status
4577<emphasis role='bold'>InvalidTime</emphasis>
4578if the specified time is earlier than the last-pointer-grab time or later than
4579the current server time.
4580Otherwise, the last-pointer-grab time is set to the specified time, with
4581<emphasis role='bold'>CurrentTime</emphasis>
4582replaced by the current server time.
4583<!-- .sp -->
4584</para>
4585  </section>
4586  <section id="requests:UngrabPointer">
4587    <title>UngrabPointer</title>
4588    <indexterm zone="requests:UngrabPointer" significance="preferred"><primary>UngrabPointer</primary></indexterm>
4589<informaltable frame='none'>
4590  <?dbfo keep-together="always" ?>
4591  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4592  <colspec colname='c1' colwidth='1.0*'/>
4593  <tbody>
4594    <row>
4595      <entry>
4596<!-- .in +.2i -->
4597<emphasis remap='I'>time</emphasis>: TIMESTAMP or
4598<emphasis role='bold'>CurrentTime</emphasis>
4599<!-- .in -.2i -->
4600<!-- .eM -->
4601      </entry>
4602    </row>
4603  </tbody>
4604  </tgroup>
4605</informaltable>
4606<!-- .eM -->
4607<para>
4608This request releases the pointer if this client has it actively grabbed (from
4609either
4610<link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>
4611or
4612<link linkend="requests:GrabButton"><emphasis role='bold'>GrabButton</emphasis></link>
4613or from a normal button press) and releases any queued events.
4614The request has no effect if the specified time is earlier than
4615the last-pointer-grab time or is later than the current server time.
4616</para>
4617<para>
4618This request generates
4619<link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>
4620and
4621<link linkend="events:LeaveNotify"><emphasis role='bold'>LeaveNotify</emphasis></link>
4622events.
4623</para>
4624<para>
4625An
4626<link linkend="requests:UngrabPointer"><emphasis role='bold'>UngrabPointer</emphasis></link>
4627request is performed automatically if the event window or
4628confine-to window for an active pointer grab becomes not viewable
4629or if window reconfiguration causes the confine-to window to lie
4630completely outside the boundaries of the root window.
4631<!-- .sp -->
4632</para>
4633  </section>
4634  <section id="requests:GrabButton">
4635    <title>GrabButton</title>
4636    <indexterm zone="requests:GrabButton" significance="preferred"><primary>GrabButton</primary></indexterm>
4637    <indexterm zone="requests:GrabButton"><primary>Button</primary><secondary>grabbing</secondary></indexterm>
4638<informaltable frame='none'>
4639  <?dbfo keep-together="always" ?>
4640  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4641  <colspec colname='c1' colwidth='1.0*'/>
4642  <tbody>
4643    <row>
4644      <entry>
4645<!-- .in +.2i -->
4646<emphasis remap='I'>modifiers</emphasis>: SETofKEYMASK or
4647<emphasis role='bold'>AnyModifier</emphasis>
4648      </entry>
4649    </row>
4650    <row>
4651      <entry>
4652<emphasis remap='I'>button</emphasis>: BUTTON or
4653<emphasis role='bold'>AnyButton</emphasis>
4654      </entry>
4655    </row>
4656    <row>
4657      <entry>
4658<emphasis remap='I'>grab-window</emphasis>: WINDOW
4659      </entry>
4660    </row>
4661    <row>
4662      <entry>
4663<emphasis remap='I'>owner-events</emphasis>: BOOL
4664      </entry>
4665    </row>
4666    <row>
4667      <entry>
4668<emphasis remap='I'>event-mask</emphasis>: SETofPOINTEREVENT
4669      </entry>
4670    </row>
4671    <row>
4672      <entry>
4673<emphasis remap='I'>pointer-mode</emphasis>, <emphasis remap='I'>keyboard-mode</emphasis>:
4674{ <emphasis role='bold'>Synchronous</emphasis>,
4675<emphasis role='bold'>Asynchronous</emphasis>}
4676      </entry>
4677    </row>
4678    <row>
4679      <entry>
4680<emphasis remap='I'>confine-to</emphasis>: WINDOW or
4681<emphasis role='bold'>None</emphasis>
4682      </entry>
4683    </row>
4684    <row>
4685      <entry>
4686<emphasis remap='I'>cursor</emphasis>: CURSOR or
4687<emphasis role='bold'>None</emphasis>
4688<!-- .in -.2i -->
4689      </entry>
4690    </row>
4691    <row>
4692      <entry>
4693<!-- .in +.2i -->
4694Errors:
4695<emphasis role='bold'>Access</emphasis>,
4696<emphasis role='bold'>Cursor</emphasis>,
4697<emphasis role='bold'>Value</emphasis>,
4698<emphasis role='bold'>Window</emphasis>
4699<!-- .in -.2i -->
4700<!-- .eM -->
4701      </entry>
4702    </row>
4703  </tbody>
4704  </tgroup>
4705</informaltable>
4706<!-- .eM -->
4707<para>
4708This request establishes a passive grab.
4709<indexterm zone="requests:GrabButton"><primary>Passive grab</primary><secondary>pointer</secondary></indexterm>
4710In the future,
4711the pointer is actively grabbed as described in
4712<link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>,
4713the last-pointer-grab time is set to the time at which the button was
4714pressed (as transmitted in the
4715<link linkend="events:ButtonPress"><emphasis role='bold'>ButtonPress</emphasis></link>
4716event), and the
4717<emphasis role='bold'>ButtonPress</emphasis>
4718event is reported if all of the following conditions are true:
4719<!-- .IP bu 5 -->
4720The pointer is not grabbed and the specified button is logically pressed
4721when the specified modifier keys are logically down,
4722and no other buttons or modifier keys are logically down.
4723<!-- .IP bu 5 -->
4724The grab-window contains the pointer.
4725<!-- .IP bu 5 -->
4726The confine-to window (if any) is viewable.
4727<!-- .IP bu 5 -->
4728A passive grab on the same button/key combination does not exist
4729on any ancestor of grab-window.
4730</para>
4731<para>
4732The interpretation of the remaining arguments is the same as for
4733<link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>.
4734The active grab is terminated automatically when
4735the logical state of the pointer has all buttons released,
4736independent of the logical state of modifier keys.
4737Note that the logical state of a device (as seen by means of the protocol)
4738may lag the physical state if device event processing is frozen.
4739</para>
4740<para>
4741This request overrides all previous passive grabs by the same client on
4742the same button/key combinations on the same window.
4743A modifier of
4744<emphasis role='bold'>AnyModifier</emphasis>
4745is equivalent to issuing the request for all possible modifier combinations
4746(including the combination of no modifiers).
4747It is not required that all specified modifiers have currently assigned
4748keycodes.
4749A button of
4750<emphasis role='bold'>AnyButton</emphasis>
4751is equivalent to issuing the request for all possible buttons.
4752Otherwise, it is not required that the button specified currently be assigned
4753to a physical button.
4754</para>
4755<para>
4756An
4757<emphasis role='bold'>Access</emphasis>
4758error is generated if some other client has already issued a
4759<emphasis role='bold'>GrabButton</emphasis>
4760request with the same button/key combination on the same window.
4761When using
4762<emphasis role='bold'>AnyModifier</emphasis>
4763or
4764<emphasis role='bold'>AnyButton</emphasis>,
4765the request fails completely (no grabs are established), and an
4766<emphasis role='bold'>Access</emphasis>
4767error is generated if there is a conflicting grab for any combination.
4768The request has no effect on an active grab.
4769<!-- .sp -->
4770</para>
4771  </section>
4772  <section id="requests:UngrabButton">
4773    <title>UngrabButton</title>
4774    <indexterm zone="requests:UngrabButton" significance="preferred"><primary>UngrabButton</primary></indexterm>
4775<informaltable frame='none'>
4776  <?dbfo keep-together="always" ?>
4777  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4778  <colspec colname='c1' colwidth='1.0*'/>
4779  <tbody>
4780    <row>
4781      <entry>
4782<!-- .in +.2i -->
4783<emphasis remap='I'>modifiers</emphasis>: SETofKEYMASK or
4784<emphasis role='bold'>AnyModifier</emphasis>
4785      </entry>
4786    </row>
4787    <row>
4788      <entry>
4789<emphasis remap='I'>button</emphasis>: BUTTON or
4790<emphasis role='bold'>AnyButton</emphasis>
4791      </entry>
4792    </row>
4793    <row>
4794      <entry>
4795<emphasis remap='I'>grab-window</emphasis>: WINDOW
4796<!-- .in -.2i -->
4797      </entry>
4798    </row>
4799    <row>
4800      <entry>
4801<!-- .in +.2i -->
4802Errors:
4803<emphasis role='bold'>Value</emphasis>,
4804<emphasis role='bold'>Window</emphasis>
4805<!-- .in -.2i -->
4806<!-- .eM -->
4807      </entry>
4808    </row>
4809  </tbody>
4810  </tgroup>
4811</informaltable>
4812<!-- .eM -->
4813<para>
4814This request releases the passive button/key combination
4815on the specified window if it was grabbed by this client.
4816A modifiers argument of
4817<emphasis role='bold'>AnyModifier</emphasis>
4818is equivalent to issuing the request for all possible modifier
4819combinations (including the combination of no modifiers).
4820A button of
4821<emphasis role='bold'>AnyButton</emphasis>
4822is equivalent to issuing the request for all possible buttons.
4823The request has no effect on an active grab.
4824<!-- .sp -->
4825</para>
4826  </section>
4827  <section id="requests:ChangeActivePointerGrab">
4828    <title>ChangeActivePointerGrab</title>
4829    <indexterm zone="requests:ChangeActivePointerGrab" significance="preferred"><primary>ChangeActivePointerGrab</primary></indexterm>
4830    <indexterm zone="requests:ChangeActivePointerGrab"><primary>Active grab</primary><secondary>pointer</secondary></indexterm>
4831<informaltable frame='none'>
4832  <?dbfo keep-together="always" ?>
4833  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4834  <colspec colname='c1' colwidth='1.0*'/>
4835  <tbody>
4836    <row>
4837      <entry>
4838<!-- .in +.2i -->
4839<emphasis remap='I'>event-mask</emphasis>: SETofPOINTEREVENT
4840      </entry>
4841    </row>
4842    <row>
4843      <entry>
4844<emphasis remap='I'>cursor</emphasis>: CURSOR or
4845<emphasis role='bold'>None</emphasis>
4846      </entry>
4847    </row>
4848    <row>
4849      <entry>
4850<emphasis remap='I'>time</emphasis>: TIMESTAMP or
4851<emphasis role='bold'>CurrentTime</emphasis>
4852<!-- .in -.2i -->
4853      </entry>
4854    </row>
4855    <row>
4856      <entry>
4857<!-- .in +.2i -->
4858Errors:
4859<emphasis role='bold'>Cursor</emphasis>,
4860<emphasis role='bold'>Value</emphasis>
4861<!-- .in -.2i -->
4862<!-- .eM -->
4863      </entry>
4864    </row>
4865  </tbody>
4866  </tgroup>
4867</informaltable>
4868<!-- .eM -->
4869<para>
4870This request changes the specified dynamic parameters if the pointer is
4871actively grabbed by the client and the specified time is no earlier than the
4872last-pointer-grab time and no later than the current server time.
4873The interpretation of event-mask and cursor are the same as in
4874<link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>.
4875This request has no effect on the parameters of any passive grabs established
4876with
4877<link linkend="requests:GrabButton"><emphasis role='bold'>GrabButton</emphasis></link>.
4878<!-- .sp -->
4879</para>
4880  </section>
4881  <section id="requests:GrabKeyboard">
4882    <title>GrabKeyboard</title>
4883    <indexterm zone="requests:GrabKeyboard" significance="preferred"><primary>GrabKeyboard</primary></indexterm>
4884    <indexterm zone="requests:GrabKeyboard"><primary>Active grab</primary><secondary>keyboard</secondary></indexterm>
4885    <indexterm zone="requests:GrabKeyboard"><primary>Keyboard</primary><secondary>grabbing</secondary></indexterm>
4886<informaltable frame='none'>
4887  <?dbfo keep-together="always" ?>
4888  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
4889  <colspec colname='c1' colwidth='1.0*'/>
4890  <tbody>
4891    <row>
4892      <entry>
4893<!-- .in +.2i -->
4894<emphasis remap='I'>grab-window</emphasis>: WINDOW
4895      </entry>
4896    </row>
4897    <row>
4898      <entry>
4899<emphasis remap='I'>owner-events</emphasis>: BOOL
4900      </entry>
4901    </row>
4902    <row>
4903      <entry>
4904<emphasis remap='I'>pointer-mode</emphasis>, <emphasis remap='I'>keyboard-mode</emphasis>:
4905{ <emphasis role='bold'>Synchronous</emphasis>,
4906<emphasis role='bold'>Asynchronous</emphasis>}
4907      </entry>
4908    </row>
4909    <row>
4910      <entry>
4911<emphasis remap='I'>time</emphasis>: TIMESTAMP or
4912<emphasis role='bold'>CurrentTime</emphasis>
4913<!-- .in -.2i -->
4914      </entry>
4915    </row>
4916    <row>
4917      <entry>
49184919      </entry>
4920    </row>
4921    <row>
4922      <entry>
4923<!-- .in +.2i -->
4924status:
4925{ <emphasis role='bold'>Success</emphasis>,
4926<emphasis role='bold'>AlreadyGrabbed</emphasis>,
4927<emphasis role='bold'>Frozen</emphasis>,
4928<emphasis role='bold'>InvalidTime</emphasis>,
4929<emphasis role='bold'>NotViewable</emphasis>}
4930<!-- .in -.2i -->
4931      </entry>
4932    </row>
4933    <row>
4934      <entry>
4935<!-- .in +.2i -->
4936Errors:
4937<emphasis role='bold'>Value</emphasis>,
4938<emphasis role='bold'>Window</emphasis>
4939<!-- .in -.2i -->
4940<!-- .eM -->
4941      </entry>
4942    </row>
4943  </tbody>
4944  </tgroup>
4945</informaltable>
4946<!-- .eM -->
4947<para>
4948This request actively grabs control of the keyboard.
4949Further key events are reported only to the grabbing client.
4950This request overrides any active keyboard grab by this client.
4951</para>
4952<para>
4953If owner-events is
4954<emphasis role='bold'>False</emphasis>,
4955all generated key events are reported with respect to grab-window.
4956If owner-events is
4957<emphasis role='bold'>True</emphasis>
4958and if a generated key event would normally be reported to this client,
4959it is reported normally.
4960Otherwise, the event is reported with respect to the grab-window.
4961Both
4962<link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>
4963and
4964<link linkend="events:KeyRelease"><emphasis role='bold'>KeyRelease</emphasis></link>
4965events are always reported,
4966independent of any event selection made by the client.
4967</para>
4968<para>
4969If keyboard-mode is
4970<emphasis role='bold'>Asynchronous</emphasis>,
4971keyboard event processing continues normally.
4972If the keyboard is currently frozen by this client,
4973then processing of keyboard events is resumed.
4974If keyboard-mode is
4975<emphasis role='bold'>Synchronous</emphasis>,
4976the state of the keyboard (as seen by means of the protocol) appears to freeze.
4977No further keyboard events are generated by the server until the
4978grabbing client issues a releasing
4979<link linkend="requests:AllowEvents"><emphasis role='bold'>AllowEvents</emphasis></link>
4980request or until the keyboard grab is released.
4981Actual keyboard changes are not lost while the keyboard is frozen.
4982They are simply queued for later processing.
4983</para>
4984<para>
4985If pointer-mode is
4986<emphasis role='bold'>Asynchronous</emphasis>,
4987pointer event processing is unaffected by activation of the grab.
4988If pointer-mode is
4989<emphasis role='bold'>Synchronous</emphasis>,
4990the state of the pointer (as seen by means of the protocol) appears to freeze.
4991No further pointer events are generated by the server
4992until the grabbing client issues a releasing
4993<link linkend="requests:AllowEvents"><emphasis role='bold'>AllowEvents</emphasis></link>
4994request or until the keyboard grab is released.
4995Actual pointer changes are not lost while the pointer is frozen.
4996They are simply queued for later processing.
4997</para>
4998<para>
4999This request generates
5000<link linkend="events:FocusIn"><emphasis role='bold'>FocusIn</emphasis></link>
5001and
5002<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>
5003events.
5004</para>
5005<para>
5006The request fails with status
5007<emphasis role='bold'>AlreadyGrabbed</emphasis>
5008if the keyboard is actively grabbed by some other client.
5009The request fails with status
5010<emphasis role='bold'>Frozen</emphasis>
5011if the keyboard is frozen by an active grab of another client.
5012The request fails with status
5013<emphasis role='bold'>NotViewable</emphasis>
5014if grab-window is not viewable.
5015The request fails with status
5016<emphasis role='bold'>InvalidTime</emphasis>
5017if the specified time is earlier than the last-keyboard-grab time
5018or later than the current server time.
5019Otherwise, the last-keyboard-grab time is set to the specified time with
5020<emphasis role='bold'>CurrentTime</emphasis>
5021replaced by the current server time.
5022<!-- .sp -->
5023</para>
5024  </section>
5025  <section id="requests:UngrabKeyboard">
5026    <title>UngrabKeyboard</title>
5027    <indexterm zone="requests:UngrabKeyboard" significance="preferred"><primary>UngrabKeyboard</primary></indexterm>
5028<informaltable frame='none'>
5029  <?dbfo keep-together="always" ?>
5030  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5031  <colspec colname='c1' colwidth='1.0*'/>
5032  <tbody>
5033    <row>
5034      <entry>
5035<!-- .in +.2i -->
5036<emphasis remap='I'>time</emphasis>: TIMESTAMP or
5037<emphasis role='bold'>CurrentTime</emphasis>
5038<!-- .in -.2i -->
5039<!-- .eM -->
5040      </entry>
5041    </row>
5042  </tbody>
5043  </tgroup>
5044</informaltable>
5045<!-- .eM -->
5046<para>
5047This request releases the keyboard if this client has it actively grabbed
5048(as a result of either
5049<link linkend="requests:GrabKeyboard"><emphasis role='bold'>GrabKeyboard</emphasis></link>
5050or
5051<link linkend="requests:GrabKey"><emphasis role='bold'>GrabKey</emphasis></link>)
5052and releases any queued events.
5053The request has no effect if the specified time is earlier than the
5054last-keyboard-grab time or is later than the current server time.
5055</para>
5056<para>
5057This request generates
5058<link linkend="events:FocusIn"><emphasis role='bold'>FocusIn</emphasis></link>
5059and
5060<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>
5061events.
5062</para>
5063<para>
5064An
5065<link linkend="requests:UngrabKeyboard"><emphasis role='bold'>UngrabKeyboard</emphasis></link>
5066is performed automatically if the event window for an active keyboard grab
5067becomes not viewable.
5068<!-- .sp -->
5069</para>
5070  </section>
5071  <section id="requests:GrabKey">
5072    <title>GrabKey</title>
5073    <indexterm zone="requests:GrabKey" significance="preferred"><primary>GrabKey</primary></indexterm>
5074    <indexterm zone="requests:GrabKey"><primary>Key</primary><secondary>grabbing</secondary></indexterm>
5075<informaltable frame='none'>
5076  <?dbfo keep-together="always" ?>
5077  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5078  <colspec colname='c1' colwidth='1.0*'/>
5079  <tbody>
5080    <row>
5081      <entry>
5082<!-- .in +.2i -->
5083<emphasis remap='I'>key</emphasis>: KEYCODE or
5084<emphasis role='bold'>AnyKey</emphasis>
5085      </entry>
5086    </row>
5087    <row>
5088      <entry>
5089<emphasis remap='I'>modifiers</emphasis>: SETofKEYMASK or
5090<emphasis role='bold'>AnyModifier</emphasis>
5091      </entry>
5092    </row>
5093    <row>
5094      <entry>
5095<emphasis remap='I'>grab-window</emphasis>: WINDOW
5096      </entry>
5097    </row>
5098    <row>
5099      <entry>
5100<emphasis remap='I'>owner-events</emphasis>: BOOL
5101      </entry>
5102    </row>
5103    <row>
5104      <entry>
5105<emphasis remap='I'>pointer-mode</emphasis>, <emphasis remap='I'>keyboard-mode</emphasis>:
5106{ <emphasis role='bold'>Synchronous</emphasis>,
5107<emphasis role='bold'>Asynchronous</emphasis>}
5108<!-- .in -.2i -->
5109      </entry>
5110    </row>
5111    <row>
5112      <entry>
5113<!-- .in +.2i -->
5114Errors:
5115<emphasis role='bold'>Access</emphasis>,
5116<emphasis role='bold'>Value</emphasis>,
5117<emphasis role='bold'>Window</emphasis>
5118<!-- .in -.2i -->
5119<!-- .eM -->
5120      </entry>
5121    </row>
5122  </tbody>
5123  </tgroup>
5124</informaltable>
5125<!-- .eM -->
5126<para>
5127This request establishes a passive grab on the keyboard.
5128<indexterm zone="requests:GrabKey"><primary>Passive grab</primary><secondary>keyboard</secondary></indexterm>
5129In the future,
5130the keyboard is actively grabbed as described in
5131<link linkend="requests:GrabKeyboard"><emphasis role='bold'>GrabKeyboard</emphasis></link>,
5132the last-keyboard-grab time is set to the time at which the key was pressed
5133(as transmitted in the
5134<link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>
5135event), and the
5136<emphasis role='bold'>KeyPress</emphasis>
5137event is reported if all of the following conditions are true:
5138<!-- .IP bu 5 -->
5139The keyboard is not grabbed and the specified key
5140(which can itself be a modifier key) is logically pressed
5141when the specified modifier keys are logically down,
5142and no other modifier keys are logically down.
5143<!-- .IP bu 5 -->
5144Either the grab-window is an ancestor of (or is) the focus window,
5145or the grab-window is a descendent of the focus window and contains the pointer.
5146<!-- .IP bu 5 -->
5147A passive grab on the same key combination does not exist
5148on any ancestor of grab-window.
5149</para>
5150<para>
5151The interpretation of the remaining arguments is the same as for
5152<link linkend="requests:GrabKeyboard"><emphasis role='bold'>GrabKeyboard</emphasis></link>.
5153The active grab is terminated automatically when the logical state
5154of the keyboard has the specified key released,
5155independent of the logical state of modifier keys.
5156Note that the logical state of a device (as seen by means of the protocol)
5157may lag the physical state if device event processing is frozen.
5158</para>
5159<para>
5160This request overrides all previous passive grabs by the same client
5161on the same key combinations on the same window.
5162A modifier of
5163<emphasis role='bold'>AnyModifier</emphasis>
5164is equivalent to issuing the request for all possible modifier combinations
5165(including the combination of no modifiers).
5166It is not required that all modifiers specified have
5167currently assigned keycodes.
5168A key of
5169<emphasis role='bold'>AnyKey</emphasis>
5170is equivalent to issuing the request for all possible keycodes.
5171Otherwise, the key must be in the range specified by min-keycode
5172and max-keycode in the connection setup (or a
5173<emphasis role='bold'>Value</emphasis>
5174error results).
5175</para>
5176<para>
5177An
5178<emphasis role='bold'>Access</emphasis>
5179error is generated if some other client has issued a
5180<emphasis role='bold'>GrabKey</emphasis>
5181with the same key combination on the same window.
5182When using
5183<emphasis role='bold'>AnyModifier</emphasis>
5184or
5185<emphasis role='bold'>AnyKey</emphasis>,
5186the request fails completely (no grabs are established),
5187and an
5188<emphasis role='bold'>Access</emphasis>
5189error is generated if there is a conflicting grab for any combination.
5190<!-- .sp -->
5191</para>
5192  </section>
5193  <section id="requests:UngrabKey">
5194    <title>UngrabKey</title>
5195    <indexterm zone="requests:UngrabKey" significance="preferred"><primary>UngrabKey</primary></indexterm>
5196<informaltable frame='none'>
5197  <?dbfo keep-together="always" ?>
5198  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5199  <colspec colname='c1' colwidth='1.0*'/>
5200  <tbody>
5201    <row>
5202      <entry>
5203<!-- .in +.2i -->
5204<emphasis remap='I'>key</emphasis>: KEYCODE or
5205<emphasis role='bold'>AnyKey</emphasis>
5206      </entry>
5207    </row>
5208    <row>
5209      <entry>
5210<emphasis remap='I'>modifiers</emphasis>: SETofKEYMASK or
5211<emphasis role='bold'>AnyModifier</emphasis>
5212      </entry>
5213    </row>
5214    <row>
5215      <entry>
5216<emphasis remap='I'>grab-window</emphasis>: WINDOW
5217<!-- .in -.2i -->
5218      </entry>
5219    </row>
5220    <row>
5221      <entry>
5222<!-- .in +.2i -->
5223Errors:
5224<emphasis role='bold'>Value</emphasis>,
5225<emphasis role='bold'>Window</emphasis>
5226<!-- .in -.2i -->
5227<!-- .eM -->
5228      </entry>
5229    </row>
5230  </tbody>
5231  </tgroup>
5232</informaltable>
5233<!-- .eM -->
5234<para>
5235This request releases the key combination on the specified window
5236if it was grabbed by this client.
5237A modifiers argument of
5238<emphasis role='bold'>AnyModifier</emphasis>
5239is equivalent to issuing the request for all possible modifier combinations
5240(including the combination of no modifiers).
5241A key of
5242<emphasis role='bold'>AnyKey</emphasis>
5243is equivalent to issuing the request for all possible keycodes.
5244This request has no effect on an active grab.
5245<!-- .sp -->
5246</para>
5247  </section>
5248  <section id="requests:AllowEvents">
5249    <title>AllowEvents</title>
5250    <indexterm zone="requests:AllowEvents" significance="preferred"><primary>AllowEvents</primary></indexterm>
5251<informaltable frame='none'>
5252  <?dbfo keep-together="always" ?>
5253  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5254  <colspec colname='c1' colwidth='1.0*'/>
5255  <tbody>
5256    <row>
5257      <entry>
5258<!-- .in +.2i -->
5259<emphasis remap='I'>mode</emphasis>:
5260{ <emphasis role='bold'>AsyncPointer</emphasis>,
5261<emphasis role='bold'>SyncPointer</emphasis>,
5262<emphasis role='bold'>ReplayPointer</emphasis>,
5263<emphasis role='bold'>AsyncKeyboard</emphasis>,
5264      </entry>
5265    </row>
5266    <row>
5267      <entry>
5268<emphasis role='bold'>SyncKeyboard</emphasis>,
5269<emphasis role='bold'>ReplayKeyboard</emphasis>,
5270<emphasis role='bold'>AsyncBoth</emphasis>,
5271<emphasis role='bold'>SyncBoth</emphasis>}
5272      </entry>
5273    </row>
5274    <row>
5275      <entry>
5276<emphasis remap='I'>time</emphasis>: TIMESTAMP or
5277<emphasis role='bold'>CurrentTime</emphasis>
5278<!-- .in -.2i -->
5279      </entry>
5280    </row>
5281    <row>
5282      <entry>
5283<!-- .in +.2i -->
5284Errors:
5285<emphasis role='bold'>Value</emphasis>
5286<!-- .in -.2i -->
5287<!-- .eM -->
5288      </entry>
5289    </row>
5290  </tbody>
5291  </tgroup>
5292</informaltable>
5293<!-- .eM -->
5294<para>
5295This request releases some queued events if the client has caused a device to
5296freeze.
5297The request has no effect if the specified time is earlier
5298than the last-grab time of the most recent active grab for the client
5299or if the specified time is later than the current server time.
5300</para>
5301<para>
5302For
5303<emphasis role='bold'>AsyncPointer</emphasis>,
5304if the pointer is frozen by the client,
5305pointer event processing continues normally.
5306If the pointer is frozen twice by the client on behalf of two separate grabs,
5307<emphasis role='bold'>AsyncPointer</emphasis>
5308thaws for both.
5309<emphasis role='bold'>AsyncPointer</emphasis>
5310has no effect if the pointer is not frozen by the client,
5311but the pointer need not be grabbed by the client.
5312</para>
5313<para>
5314For
5315<emphasis role='bold'>SyncPointer</emphasis>,
5316if the pointer is frozen and actively grabbed by the client,
5317pointer event processing continues normally until the next
5318<link linkend="events:ButtonPress"><emphasis role='bold'>ButtonPress</emphasis></link>
5319or
5320<link linkend="events:ButtonRelease"><emphasis role='bold'>ButtonRelease</emphasis></link>
5321event is reported to the client,
5322at which time the pointer again appears to freeze.
5323However, if the reported event causes the pointer grab to be released,
5324then the pointer does not freeze.
5325<emphasis role='bold'>SyncPointer</emphasis>
5326has no effect if the pointer is not frozen by the
5327client or if the pointer is not grabbed by the client.
5328</para>
5329<para>
5330For
5331<emphasis role='bold'>ReplayPointer</emphasis>,
5332if the pointer is actively grabbed by the client and
5333is frozen as the result of an event having been sent to the client
5334(either from the activation of a
5335<link linkend="requests:GrabButton"><emphasis role='bold'>GrabButton</emphasis></link>
5336or from a previous
5337<emphasis role='bold'>AllowEvents</emphasis>
5338with mode
5339<emphasis role='bold'>SyncPointer</emphasis>
5340but not from a
5341<link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>),
5342then the pointer grab is released and that event is completely reprocessed,
5343this time ignoring any passive grabs at or above (towards the root)
5344the grab-window of the grab just released.
5345The request has no effect if the pointer is not grabbed by the client
5346or if the pointer is not frozen as the result of an event.
5347</para>
5348<para>
5349For
5350<emphasis role='bold'>AsyncKeyboard</emphasis>,
5351if the keyboard is frozen by the client,
5352keyboard event processing continues normally.
5353If the keyboard is frozen twice by the client on behalf of two separate grabs,
5354<emphasis role='bold'>AsyncKeyboard</emphasis>
5355thaws for both.
5356<emphasis role='bold'>AsyncKeyboard</emphasis>
5357has no effect if the keyboard is not frozen by the client,
5358but the keyboard need not be grabbed by the client.
5359</para>
5360<para>
5361For
5362<emphasis role='bold'>SyncKeyboard</emphasis>,
5363if the keyboard is frozen and actively grabbed by the client,
5364keyboard event processing continues normally until the next
5365<link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>
5366or
5367<link linkend="events:KeyRelease"><emphasis role='bold'>KeyRelease</emphasis></link>
5368event is reported to the client,
5369at which time the keyboard again appears to freeze.
5370However, if the reported event causes the keyboard grab to be released,
5371then the keyboard does not freeze.
5372<emphasis role='bold'>SyncKeyboard</emphasis>
5373has no effect if the keyboard is not frozen by the client or
5374if the keyboard is not grabbed by the client.
5375</para>
5376<para>
5377For
5378<emphasis role='bold'>ReplayKeyboard</emphasis>,
5379if the keyboard is actively grabbed by the client
5380and is frozen as the result of an event having been sent to the client
5381(either from the activation of a
5382<link linkend="requests:GrabKey"><emphasis role='bold'>GrabKey</emphasis></link>
5383or from a previous
5384<emphasis role='bold'>AllowEvents</emphasis>
5385with mode
5386<emphasis role='bold'>SyncKeyboard</emphasis>
5387but not from a
5388<link linkend="requests:GrabKeyboard"><emphasis role='bold'>GrabKeyboard</emphasis></link>),
5389then the keyboard grab is released and that event is completely reprocessed,
5390this time ignoring any passive grabs at or above (towards the root)
5391the grab-window of the grab just released.
5392The request has no effect if the keyboard is not grabbed by the client
5393or if the keyboard is not frozen as the result of an event.
5394</para>
5395<para>
5396For
5397<emphasis role='bold'>SyncBoth</emphasis>,
5398if both pointer and keyboard are frozen by the client,
5399event processing (for both devices) continues normally until the next
5400<link linkend="events:ButtonPress"><emphasis role='bold'>ButtonPress</emphasis></link>,
5401<link linkend="events:ButtonRelease"><emphasis role='bold'>ButtonRelease</emphasis></link>,
5402<link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>,
5403or
5404<link linkend="events:KeyRelease"><emphasis role='bold'>KeyRelease</emphasis></link>
5405event is reported to the client for a grabbed device
5406(button event for the pointer, key event for the keyboard),
5407at which time the devices again appear to freeze.
5408However, if the reported event causes the grab to be released,
5409then the devices do not freeze (but if the other device is still
5410grabbed, then a subsequent event for it will still cause both devices
5411to freeze).
5412<emphasis role='bold'>SyncBoth</emphasis>
5413has no effect unless both pointer and keyboard are frozen by the client.
5414If the pointer or keyboard is frozen twice by the client on behalf
5415of two separate grabs,
5416<emphasis role='bold'>SyncBoth</emphasis>
5417thaws for both (but a subsequent freeze for
5418<emphasis role='bold'>SyncBoth</emphasis>
5419will only freeze each device once).
5420</para>
5421<para>
5422For
5423<emphasis role='bold'>AsyncBoth</emphasis>,
5424if the pointer and the keyboard are frozen by the client,
5425event processing for both devices continues normally.
5426If a device is frozen twice by the client on behalf of two separate grabs,
5427<emphasis role='bold'>AsyncBoth</emphasis>
5428thaws for both.
5429<emphasis role='bold'>AsyncBoth</emphasis>
5430has no effect unless both pointer and keyboard are frozen by the client.
5431</para>
5432<para>
5433<emphasis role='bold'>AsyncPointer</emphasis>,
5434<emphasis role='bold'>SyncPointer</emphasis>,
5435and
5436<emphasis role='bold'>ReplayPointer</emphasis>
5437have no effect on processing of keyboard events.
5438<emphasis role='bold'>AsyncKeyboard</emphasis>,
5439<emphasis role='bold'>SyncKeyboard</emphasis>,
5440and
5441<emphasis role='bold'>ReplayKeyboard</emphasis>
5442have no effect on processing of pointer events.
5443</para>
5444<para>
5445It is possible for both a pointer grab and a keyboard grab to be active
5446simultaneously (by the same or different clients).
5447When a device is frozen on behalf of either grab,
5448no event processing is performed for the device.
5449It is possible for a single device to be frozen because of both grabs.
5450In this case, the freeze must be released on behalf of both grabs
5451before events can again be processed.
5452If a device is frozen twice by a single client, then a single
5453<emphasis role='bold'>AllowEvents</emphasis>
5454releases both.
5455<!-- .sp -->
5456</para>
5457  </section>
5458  <section id="requests:GrabServer">
5459    <title>GrabServer</title>
5460    <indexterm zone="requests:GrabServer" significance="preferred"><primary>GrabServer</primary></indexterm>
5461    <indexterm zone="requests:GrabServer"><primary>Server</primary><secondary>grabbing</secondary></indexterm>
5462<para>
5463This request disables processing of requests and close-downs on all
5464connections other than the one this request arrived on.
5465<!-- .sp -->
5466</para>
5467  </section>
5468  <section id="requests:UngrabServer">
5469    <title>UngrabServer</title>
5470    <indexterm zone="requests:UngrabServer" significance="preferred"><primary>UngrabServer</primary></indexterm>
5471<para>
5472This request restarts processing of requests and close-downs
5473on other connections.
5474<!-- .sp -->
5475</para>
5476  </section>
5477  <section id="requests:QueryPointer">
5478    <title>QueryPointer</title>
5479    <indexterm zone="requests:QueryPointer" significance="preferred"><primary>QueryPointer</primary></indexterm>
5480<informaltable frame='none'>
5481  <?dbfo keep-together="always" ?>
5482  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5483  <colspec colname='c1' colwidth='1.0*'/>
5484  <tbody>
5485    <row>
5486      <entry>
5487<!-- .in +.2i -->
5488<emphasis remap='I'>window</emphasis>: WINDOW
5489<!-- .in -.2i -->
5490      </entry>
5491    </row>
5492    <row>
5493      <entry>
54945495      </entry>
5496    </row>
5497    <row>
5498      <entry>
5499<!-- .in +.2i -->
5500root: WINDOW
5501      </entry>
5502    </row>
5503    <row>
5504      <entry>
5505child: WINDOW or
5506<emphasis role='bold'>None</emphasis>
5507      </entry>
5508    </row>
5509    <row>
5510      <entry>
5511same-screen: BOOL
5512      </entry>
5513    </row>
5514    <row>
5515      <entry>
5516root-x, root-y, win-x, win-y: INT16
5517      </entry>
5518    </row>
5519    <row>
5520      <entry>
5521mask: SETofKEYBUTMASK
5522<!-- .in -.2i -->
5523      </entry>
5524    </row>
5525    <row>
5526      <entry>
5527<!-- .in +.2i -->
5528Errors:
5529<emphasis role='bold'>Window</emphasis>
5530<!-- .in -.2i -->
5531<!-- .eM -->
5532      </entry>
5533    </row>
5534  </tbody>
5535  </tgroup>
5536</informaltable>
5537<!-- .eM -->
5538<para>
5539The root window the pointer is logically on and the pointer coordinates
5540relative to the root's origin are returned.
5541If same-screen is
5542<emphasis role='bold'>False</emphasis>,
5543then the pointer is not on the same screen as the argument window,
5544child is
5545<emphasis role='bold'>None</emphasis>,
5546and win-x and win-y are zero.
5547If same-screen is
5548<emphasis role='bold'>True</emphasis>,
5549then win-x and win-y are the pointer coordinates relative to the
5550argument window's origin, and child is the child containing the
5551pointer, if any.
5552The current logical state of the modifier keys and the buttons
5553are also returned.
5554Note that the logical state of a device (as seen by means of the protocol)
5555may lag the physical state if device event processing is frozen.
5556<!-- .sp -->
5557</para>
5558  </section>
5559  <section id="requests:GetMotionEvents">
5560    <title>GetMotionEvents</title>
5561    <indexterm zone="requests:GetMotionEvents" significance="preferred"><primary>GetMotionEvents</primary></indexterm>
5562<informaltable frame='none'>
5563  <?dbfo keep-together="always" ?>
5564  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5565  <colspec colname='c1' colwidth='1.0*'/>
5566  <tbody>
5567    <row>
5568      <entry>
5569<!-- .in +.2i -->
5570<emphasis remap='I'>start</emphasis>,
5571<emphasis remap='I'>stop</emphasis>: TIMESTAMP or
5572<emphasis role='bold'>CurrentTime</emphasis>
5573      </entry>
5574    </row>
5575    <row>
5576      <entry>
5577<emphasis remap='I'>window</emphasis>: WINDOW
5578<!-- .in -.2i -->
5579      </entry>
5580    </row>
5581    <row>
5582      <entry>
55835584      </entry>
5585    </row>
5586    <row>
5587      <entry>
5588<!-- .in +.2i -->
5589events: LISTofTIMECOORD
5590<!-- .in -.2i -->
5591      </entry>
5592    </row>
5593    <row>
5594      <entry>
5595where:
5596      </entry>
5597    </row>
5598    <row>
5599      <entry>
5600TIMECOORD:	[x, y: INT16
5601      </entry>
5602    </row>
5603    <row>
5604      <entry>
5605      time: TIMESTAMP]
5606<!-- .TE -->
5607<!-- .in -.2i -->
5608      </entry>
5609    </row>
5610    <row>
5611      <entry>
5612<!-- .in +.2i -->
5613Errors:
5614<emphasis role='bold'>Window</emphasis>
5615<!-- .in -.2i -->
5616<!-- .eM -->
5617      </entry>
5618    </row>
5619  </tbody>
5620  </tgroup>
5621</informaltable>
5622<!-- .eM -->
5623<para>
5624This request returns all events in the motion history buffer that fall
5625between the specified start and stop times (inclusive)
5626and that have coordinates that lie within (including borders)
5627the specified window at its present placement.
5628The x and y coordinates are reported relative to the origin of the window.
5629</para>
5630<para>
5631If the start time is later than the stop time or if the start time is
5632in the future, no events are returned.
5633If the stop time is in the future, it is equivalent to specifying
5634<emphasis role='bold'>CurrentTime</emphasis>.
5635<!-- .sp -->
5636</para>
5637  </section>
5638  <section id="requests:TranslateCoordinates">
5639    <title>TranslateCoordinates</title>
5640    <indexterm zone="requests:TranslateCoordinates" significance="preferred"><primary>TranslateCoordinates</primary></indexterm>
5641    <indexterm zone="glossary:Coordinate_system"><primary>Coordinate system</primary><secondary>translating</secondary></indexterm>
5642<informaltable frame='none'>
5643  <?dbfo keep-together="always" ?>
5644  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5645  <colspec colname='c1' colwidth='1.0*'/>
5646  <tbody>
5647    <row>
5648      <entry>
5649<!-- .in +.2i -->
5650<emphasis remap='I'>src-window</emphasis>, <emphasis remap='I'>dst-window</emphasis>: WINDOW
5651      </entry>
5652    </row>
5653    <row>
5654      <entry>
5655<emphasis remap='I'>src-x</emphasis>, <emphasis remap='I'>src-y</emphasis>: INT16
5656<!-- .in -.2i -->
5657      </entry>
5658    </row>
5659    <row>
5660      <entry>
56615662      </entry>
5663    </row>
5664    <row>
5665      <entry>
5666<!-- .in +.2i -->
5667same-screen: BOOL
5668      </entry>
5669    </row>
5670    <row>
5671      <entry>
5672child: WINDOW or
5673<emphasis role='bold'>None</emphasis>
5674      </entry>
5675    </row>
5676    <row>
5677      <entry>
5678dst-x, dst-y: INT16
5679<!-- .in -.2i -->
5680      </entry>
5681    </row>
5682    <row>
5683      <entry>
5684<!-- .in +.2i -->
5685Errors:
5686<emphasis role='bold'>Window</emphasis>
5687<!-- .in -.2i -->
5688<!-- .eM -->
5689      </entry>
5690    </row>
5691  </tbody>
5692  </tgroup>
5693</informaltable>
5694<!-- .eM -->
5695<para>
5696The src-x and src-y coordinates are taken relative to src-window's
5697origin and are returned as dst-x and dst-y coordinates relative to
5698dst-window's origin.
5699If same-screen is
5700<emphasis role='bold'>False</emphasis>,
5701then src-window and dst-window are on different screens,
5702and dst-x and dst-y are zero.
5703If the coordinates are contained in a mapped child of dst-window,
5704then that child is returned.
5705<!-- .sp -->
5706</para>
5707  </section>
5708  <section id="requests:WarpPointer">
5709    <title>WarpPointer</title>
5710    <indexterm zone="requests:WarpPointer" significance="preferred"><primary>WarpPointer</primary></indexterm>
5711<informaltable frame='none'>
5712  <?dbfo keep-together="always" ?>
5713  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5714  <colspec colname='c1' colwidth='1.0*'/>
5715  <tbody>
5716    <row>
5717      <entry>
5718<!-- .in +.2i -->
5719<emphasis remap='I'>src-window</emphasis>: WINDOW or
5720<emphasis role='bold'>None</emphasis>
5721      </entry>
5722    </row>
5723    <row>
5724      <entry>
5725<emphasis remap='I'>dst-window</emphasis>: WINDOW or
5726<emphasis role='bold'>None</emphasis>
5727      </entry>
5728    </row>
5729    <row>
5730      <entry>
5731<emphasis remap='I'>src-x</emphasis>, <emphasis remap='I'>src-y</emphasis>: INT16
5732      </entry>
5733    </row>
5734    <row>
5735      <entry>
5736<emphasis remap='I'>src-width</emphasis>, <emphasis remap='I'>src-height</emphasis>: CARD16
5737      </entry>
5738    </row>
5739    <row>
5740      <entry>
5741<emphasis remap='I'>dst-x</emphasis>, <emphasis remap='I'>dst-y</emphasis>: INT16
5742<!-- .in -.2i -->
5743      </entry>
5744    </row>
5745    <row>
5746      <entry>
5747<!-- .in +.2i -->
5748Errors:
5749<emphasis role='bold'>Window</emphasis>
5750<!-- .in -.2i -->
5751<!-- .eM -->
5752      </entry>
5753    </row>
5754  </tbody>
5755  </tgroup>
5756</informaltable>
5757<!-- .eM -->
5758<para>
5759If dst-window is
5760<emphasis role='bold'>None</emphasis>,
5761this request moves the pointer by offsets [dst-x, dst-y]
5762relative to the current position of the pointer.
5763If dst-window is a window,
5764this request moves the pointer to [dst-x, dst-y] relative to dst-window's
5765origin.
5766However, if src-window is not
5767<emphasis role='bold'>None</emphasis>,
5768the move only takes place if src-window contains the pointer
5769and the pointer is contained in the specified rectangle of src-window.
5770</para>
5771<para>
5772The src-x and src-y coordinates are relative to src-window's origin.
5773If src-height is zero,
5774it is replaced with the current height of src-window minus src-y.
5775If src-width is zero,
5776it is replaced with the current width of src-window minus src-x.
5777</para>
5778<para>
5779This request cannot be used to move the pointer outside the confine-to
5780window of an active pointer grab.
5781An attempt will only move the pointer as far as the closest edge
5782of the confine-to window.
5783</para>
5784<para>
5785This request will generate events just as if the user had instantaneously
5786moved the pointer.
5787<!-- .sp -->
5788</para>
5789  </section>
5790  <section id="requests:SetInputFocus">
5791    <title>SetInputFocus</title>
5792    <indexterm zone="requests:SetInputFocus" significance="preferred"><primary>SetInputFocus</primary></indexterm>
5793    <indexterm zone="requests:SetInputFocus"><primary>Input focus</primary></indexterm>
5794<informaltable frame='none'>
5795  <?dbfo keep-together="always" ?>
5796  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5797  <colspec colname='c1' colwidth='1.0*'/>
5798  <tbody>
5799    <row>
5800      <entry>
5801<!-- .in +.2i -->
5802<emphasis remap='I'>focus</emphasis>: WINDOW or
5803<emphasis role='bold'>PointerRoot</emphasis>
5804or
5805<emphasis role='bold'>None</emphasis>
5806      </entry>
5807    </row>
5808    <row>
5809      <entry>
5810<emphasis remap='I'>revert-to</emphasis>:
5811{ <emphasis role='bold'>Parent</emphasis>,
5812<emphasis role='bold'>PointerRoot</emphasis>,
5813<emphasis role='bold'>None</emphasis>}
5814      </entry>
5815    </row>
5816    <row>
5817      <entry>
5818<emphasis remap='I'>time</emphasis>: TIMESTAMP or
5819<emphasis role='bold'>CurrentTime</emphasis>
5820<!-- .in -.2i -->
5821      </entry>
5822    </row>
5823    <row>
5824      <entry>
5825<!-- .in +.2i -->
5826Errors:
5827<emphasis role='bold'>Match</emphasis>,
5828<emphasis role='bold'>Value</emphasis>,
5829<emphasis role='bold'>Window</emphasis>
5830<!-- .in -.2i -->
5831<!-- .eM -->
5832      </entry>
5833    </row>
5834  </tbody>
5835  </tgroup>
5836</informaltable>
5837<!-- .eM -->
5838<para>
5839This request changes the input focus and the last-focus-change time.
5840The request has no effect if the specified time is earlier than the current
5841last-focus-change time or is later than the current server time.
5842Otherwise, the last-focus-change time is set to the specified time
5843with
5844<emphasis role='bold'>CurrentTime</emphasis>
5845replaced by the current server time.
5846</para>
5847<para>
5848If
5849<emphasis role='bold'>None</emphasis>
5850is specified as the focus,
5851all keyboard events are discarded until a new focus window is set.
5852In this case, the revert-to argument is ignored.
5853</para>
5854<para>
5855If a window is specified as the focus,
5856it becomes the keyboard's focus window.
5857If a generated keyboard event would normally be reported to
5858this window or one of its inferiors, the event is reported normally.
5859Otherwise, the event is reported with respect to the focus window.
5860</para>
5861<para>
5862If
5863<emphasis role='bold'>PointerRoot</emphasis>
5864is specified as the focus,
5865the focus window is dynamically taken to be the root window of whatever screen
5866the pointer is on at each keyboard event.
5867In this case,
5868the revert-to argument is ignored.
5869</para>
5870<para>
5871This request generates
5872<link linkend="events:FocusIn"><emphasis role='bold'>FocusIn</emphasis></link>
5873and
5874<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>
5875events.
5876</para>
5877<para>
5878The specified focus window must be viewable at the time of the request (or a
5879<emphasis role='bold'>Match</emphasis>
5880error results).
5881If the focus window later becomes not viewable,
5882the new focus window depends on the revert-to argument.
5883If revert-to is
5884<emphasis role='bold'>Parent</emphasis>,
5885the focus reverts to the parent (or the closest viewable ancestor)
5886and the new revert-to value is taken to be
5887<emphasis role='bold'>None</emphasis>.
5888If revert-to is
5889<emphasis role='bold'>PointerRoot</emphasis>
5890or
5891<emphasis role='bold'>None</emphasis>,
5892the focus reverts to that value.
5893When the focus reverts,
5894<link linkend="events:FocusIn"><emphasis role='bold'>FocusIn</emphasis></link>
5895and
5896<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>
5897events are generated,
5898but the last-focus-change time is not affected.
5899<!-- .sp -->
5900</para>
5901  </section>
5902  <section id="requests:GetInputFocus">
5903    <title>GetInputFocus</title>
5904    <indexterm zone="requests:GetInputFocus" significance="preferred"><primary>GetInputFocus</primary></indexterm>
5905<informaltable frame='none'>
5906  <?dbfo keep-together="always" ?>
5907  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5908  <colspec colname='c1' colwidth='1.0*'/>
5909  <tbody>
5910    <row>
5911      <entry>
59125913      </entry>
5914    </row>
5915    <row>
5916      <entry>
5917<!-- .in +.2i -->
5918focus: WINDOW or
5919<emphasis role='bold'>PointerRoot</emphasis>
5920or
5921<emphasis role='bold'>None</emphasis>
5922      </entry>
5923    </row>
5924    <row>
5925      <entry>
5926revert-to:
5927{ <emphasis role='bold'>Parent</emphasis>,
5928<emphasis role='bold'>PointerRoot</emphasis>,
5929<emphasis role='bold'>None</emphasis>}
5930<!-- .in -.2i -->
5931<!-- .eM -->
5932      </entry>
5933    </row>
5934  </tbody>
5935  </tgroup>
5936</informaltable>
5937<!-- .eM -->
5938<para>
5939This request returns the current focus state.
5940<!-- .sp -->
5941</para>
5942  </section>
5943  <section id="requests:QueryKeymap">
5944    <title>QueryKeymap</title>
5945    <indexterm zone="requests:QueryKeymap" significance="preferred"><primary>QueryKeymap</primary></indexterm>
5946<informaltable frame='none'>
5947  <?dbfo keep-together="always" ?>
5948  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5949  <colspec colname='c1' colwidth='1.0*'/>
5950  <tbody>
5951    <row>
5952      <entry>
59535954      </entry>
5955    </row>
5956    <row>
5957      <entry>
5958<!-- .in +.2i -->
5959keys: LISTofCARD8
5960<!-- .in -.2i -->
5961<!-- .eM -->
5962      </entry>
5963    </row>
5964  </tbody>
5965  </tgroup>
5966</informaltable>
5967<!-- .eM -->
5968<para>
5969This request returns a bit vector for the logical state of the keyboard.
5970Each bit set to 1 indicates that the corresponding key is currently pressed.
5971The vector is represented as 32 bytes.
5972Byte N (from 0) contains the bits for keys 8N to 8N + 7
5973with the least significant bit in the byte representing key 8N.
5974Note that the logical state of a device (as seen by means of the protocol)
5975may lag the physical state if device event processing is frozen.
5976<!-- .sp -->
5977</para>
5978  </section>
5979  <section id="requests:OpenFont">
5980    <title>OpenFont</title>
5981    <indexterm zone="requests:OpenFont" significance="preferred"><primary>OpenFont</primary></indexterm>
5982    <indexterm zone="requests:OpenFont"><primary>Font</primary></indexterm>
5983<informaltable frame='none'>
5984  <?dbfo keep-together="always" ?>
5985  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
5986  <colspec colname='c1' colwidth='1.0*'/>
5987  <tbody>
5988    <row>
5989      <entry>
5990<!-- .in +.2i -->
5991<emphasis remap='I'>fid</emphasis>: FONT
5992      </entry>
5993    </row>
5994    <row>
5995      <entry>
5996<emphasis remap='I'>name</emphasis>: STRING8
5997<!-- .in -.2i -->
5998      </entry>
5999    </row>
6000    <row>
6001      <entry>
6002<!-- .in +.2i -->
6003Errors:
6004<emphasis role='bold'>Alloc</emphasis>,
6005<emphasis role='bold'>IDChoice</emphasis>,
6006<emphasis role='bold'>Name</emphasis>
6007<!-- .in -.2i -->
6008<!-- .eM -->
6009      </entry>
6010    </row>
6011  </tbody>
6012  </tgroup>
6013</informaltable>
6014<!-- .eM -->
6015<para>
6016This request loads the specified font, if necessary,
6017and associates identifier fid with it.
6018The font name should use the ISO Latin-1 encoding,
6019and uppercase and lowercase do not matter.
6020When the characters <quote>?</quote> and <quote>*</quote> are used in a font name, a
6021pattern match is performed and any matching font is used.
6022In the pattern,
6023the <quote>?</quote> character (octal value 77) will match any single character,
6024and the <quote>*</quote> character (octal value 52) will match any number
6025of characters.
6026A structured format for font names is specified in the
6027X.Org standard <citetitle>X Logical Font Description Conventions</citetitle>.
6028</para>
6029<para>
6030Fonts are not associated with a particular screen
6031and can be stored as a component of any graphics context.
6032<!-- .sp -->
6033</para>
6034  </section>
6035  <section id="requests:CloseFont">
6036    <title>CloseFont</title>
6037    <indexterm zone="requests:CloseFont" significance="preferred"><primary>CloseFont</primary></indexterm>
6038<informaltable frame='none'>
6039  <?dbfo keep-together="always" ?>
6040  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6041  <colspec colname='c1' colwidth='1.0*'/>
6042  <tbody>
6043    <row>
6044      <entry>
6045<!-- .in +.2i -->
6046<emphasis remap='I'>font</emphasis>: FONT
6047<!-- .in -.2i -->
6048      </entry>
6049    </row>
6050    <row>
6051      <entry>
6052<!-- .in +.2i -->
6053Errors:
6054<emphasis role='bold'>Font</emphasis>
6055<!-- .in -.2i -->
6056<!-- .eM -->
6057      </entry>
6058    </row>
6059  </tbody>
6060  </tgroup>
6061</informaltable>
6062<!-- .eM -->
6063<para>
6064This request deletes the association between the resource ID and the font.
6065The font itself will be freed when no other resource references it.
6066<!-- .sp -->
6067</para>
6068  </section>
6069  <section id="requests:QueryFont">
6070    <title>QueryFont</title>
6071    <indexterm zone="requests:QueryFont" significance="preferred"><primary>QueryFont</primary></indexterm>
6072<informaltable frame='none'>
6073  <?dbfo keep-together="always" ?>
6074  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
6075  <colspec colname='c1' colwidth='1.0*'/>
6076  <colspec colname='c2' colwidth='1.0*'/>
6077  <colspec colname='c3' colwidth='1.0*'/>
6078  <spanspec spanname='all' namest='c1' nameend='c3'/>
6079  <tbody>
6080    <row>
6081      <entry spanname='all'>
6082<!-- .in +.2i -->
6083<emphasis remap='I'>font</emphasis>: FONTABLE
6084<!-- .in -.2i -->
6085      </entry>
6086    </row>
6087    <row>
6088      <entry spanname='all'>
60896090      </entry>
6091    </row>
6092    <row>
6093      <entry spanname='all'>
6094<!-- .in +.2i -->
6095font-info: FONTINFO
6096      </entry>
6097    </row>
6098    <row>
6099      <entry spanname='all'>
6100char-infos: LISTofCHARINFO
6101<!-- .in -.2i -->
6102      </entry>
6103    </row>
6104    <row>
6105      <entry valign='top' morerows='18'>
6106<!-- .in +.2i -->
6107where:
6108      </entry>
6109    </row>
6110    <row>
6111      <entry valign='top' morerows='9'>
6112FONTINFO:
6113      </entry>
6114      <entry>
6115[draw-direction:
6116{ <emphasis role='bold'>LeftToRight</emphasis>,
6117<emphasis role='bold'>RightToLeft</emphasis> }
6118      </entry>
6119    </row>
6120    <row>
6121      <entry>
6122min-char-or-byte2, max-char-or-byte2: CARD16
6123      </entry>
6124    </row>
6125    <row>
6126      <entry>
6127min-byte1, max-byte1: CARD8
6128      </entry>
6129    </row>
6130    <row>
6131      <entry>
6132all-chars-exist: BOOL
6133      </entry>
6134    </row>
6135    <row>
6136      <entry>
6137default-char: CARD16
6138      </entry>
6139    </row>
6140    <row>
6141      <entry>
6142min-bounds: CHARINFO
6143      </entry>
6144    </row>
6145    <row>
6146      <entry>
6147max-bounds: CHARINFO
6148      </entry>
6149    </row>
6150    <row>
6151      <entry>
6152font-ascent: INT16
6153      </entry>
6154    </row>
6155    <row>
6156      <entry>
6157font-descent: INT16
6158      </entry>
6159    </row>
6160    <row>
6161      <entry>
6162properties: LISTofFONTPROP]
6163      </entry>
6164    </row>
6165    <row>
6166      <entry valign='top' morerows='1'>
6167FONTPROP:
6168      </entry>
6169      <entry>
6170[name: ATOM
6171      </entry>
6172    </row>
6173    <row>
6174      <entry>
6175value: &lt;32-bit-value&gt;]
6176      </entry>
6177    </row>
6178    <row>
6179      <entry valign='top' morerows='5'>
6180CHARINFO:
6181      </entry>
6182      <entry>
6183[left-side-bearing: INT16
6184      </entry>
6185    </row>
6186    <row>
6187      <entry>
6188right-side-bearing: INT16
6189      </entry>
6190    </row>
6191    <row>
6192      <entry>
6193character-width: INT16
6194      </entry>
6195    </row>
6196    <row>
6197      <entry>
6198ascent: INT16
6199      </entry>
6200    </row>
6201    <row>
6202      <entry>
6203descent: INT16
6204      </entry>
6205    </row>
6206    <row>
6207      <entry>
6208attributes: CARD16]
6209      </entry>
6210    </row>
6211    <row>
6212      <entry spanname='all'>
6213<!-- .in +.2i -->
6214Errors:
6215<emphasis role='bold'>Font</emphasis>
6216<!-- .in -.2i -->
6217<!-- .eM -->
6218      </entry>
6219    </row>
6220  </tbody>
6221  </tgroup>
6222</informaltable>
6223<!-- .eM -->
6224<para>
6225This request returns logical information about a font.
6226If a gcontext is given for font,
6227the currently contained font is used.
6228</para>
6229<para>
6230The draw-direction is just a hint
6231and indicates whether most char-infos have a positive,
6232<emphasis role='bold'>LeftToRight</emphasis>,
6233or a negative,
6234<emphasis role='bold'>RightToLeft</emphasis>,
6235character-width metric.
6236The core protocol defines no support for vertical text.
6237</para>
6238<para>
6239If min-byte1 and max-byte1 are both zero,
6240then min-char-or-byte2 specifies the linear character index corresponding
6241to the first element of char-infos,
6242and max-char-or-byte2 specifies the linear character index of the last element.
6243If either min-byte1 or max-byte1 are nonzero,
6244then both min-char-or-byte2 and max-char-or-byte2 will be less than 256,
6245and the 2-byte character index values corresponding to char-infos element N
6246(counting from 0) are:
6247<literallayout class="monospaced">
6248	byte1 = N/D + min-byte1
6249	byte2 = N\\D + min-char-or-byte2
6250</literallayout>
6251</para>
6252<para>
6253where:
6254<literallayout class="monospaced">
6255	D = max-char-or-byte2 - min-char-or-byte2 + 1
6256	/ = integer division
6257	\\ = integer modulus
6258</literallayout>
6259</para>
6260<para>
6261If char-infos has length zero,
6262then min-bounds and max-bounds will be identical,
6263and the effective char-infos is one filled with this char-info, of length:
6264<literallayout class="monospaced">
6265	L = D * (max-byte1 - min-byte1 + 1)
6266</literallayout>
6267</para>
6268<para>
6269That is,
6270all glyphs in the specified linear or matrix range have the same information,
6271as given by min-bounds (and max-bounds).
6272If all-chars-exist is
6273<emphasis role='bold'>True</emphasis>,
6274then all characters in char-infos have nonzero bounding boxes.
6275</para>
6276<para>
6277The default-char specifies the character that will be used when an
6278undefined or nonexistent character is used.
6279Note that default-char is a CARD16, not CHAR2B.
6280For a font using 2-byte matrix format,
6281the default-char has byte1 in the most significant byte
6282and byte2 in the least significant byte.
6283If the default-char itself specifies an undefined or nonexistent character,
6284then no printing is performed for an undefined or nonexistent character.
6285</para>
6286<para>
6287The min-bounds and max-bounds contain the minimum and maximum values of
6288each individual CHARINFO component over all char-infos (ignoring
6289nonexistent characters).
6290The bounding box of the font (that is, the
6291smallest rectangle enclosing the shape obtained by superimposing all
6292characters at the same origin [x,y]) has its upper-left coordinate at:
6293<literallayout class="monospaced">
6294	[x + min-bounds.left-side-bearing, y - max-bounds.ascent]
6295</literallayout>
6296with a width of:
6297<literallayout class="monospaced">
6298	max-bounds.right-side-bearing - min-bounds.left-side-bearing
6299</literallayout>
6300</para>
6301<para>
6302and a height of:
6303<literallayout class="monospaced">
6304	max-bounds.ascent + max-bounds.descent
6305</literallayout>
6306</para>
6307<para>
6308The font-ascent is the logical extent of the font above the baseline
6309and is used for determining line spacing.
6310Specific characters may extend beyond this.
6311The font-descent is the logical extent of the font at or below the baseline
6312and is used for determining line spacing.
6313Specific characters may extend beyond this.
6314If the baseline is at Y-coordinate y,
6315then the logical extent of the font is inclusive
6316between the Y-coordinate values (y - font-ascent) and (y + font-descent - 1).
6317</para>
6318<para>
6319A font is not guaranteed to have any properties.
6320The interpretation of the property value (for example, INT32, CARD32)
6321must be derived from <emphasis remap='I'>a priori</emphasis> knowledge of the property.
6322A basic set of font properties is specified in the X.Org
6323standard <citetitle>X Logical Font Description Conventions</citetitle>.
6324</para>
6325<para>
6326For a character origin at [x,y],
6327the bounding box of a character (that is,
6328the smallest rectangle enclosing the character's shape), described in
6329terms of CHARINFO components, is a rectangle with its upper-left corner at:
6330<literallayout class="monospaced">
6331	[x + left-side-bearing, y - ascent]
6332</literallayout>
6333</para>
6334<para>
6335with a width of:
6336<literallayout class="monospaced">
6337	right-side-bearing - left-side-bearing
6338</literallayout>
6339</para>
6340<para>
6341and a height of:
6342<literallayout class="monospaced">
6343	ascent + descent
6344</literallayout>
6345</para>
6346<para>
6347and the origin for the next character is defined to be:
6348<literallayout class="monospaced">
6349	[x + character-width, y]
6350</literallayout>
6351</para>
6352<para>
6353Note that the baseline is logically viewed as being just below
6354nondescending characters (when descent is zero, only pixels with
6355Y-coordinates less than y are drawn) and that the origin is logically
6356viewed as being coincident with the left edge of a nonkerned character
6357(when left-side-bearing is zero, no pixels with X-coordinate less than
6358x are drawn).
6359</para>
6360<para>
6361Note that CHARINFO metric values can be negative.
6362</para>
6363<para>
6364A nonexistent character is represented with all CHARINFO components
6365zero.
6366</para>
6367<para>
6368The interpretation of the per-character attributes field is
6369server-dependent.
6370<!-- .sp -->
6371</para>
6372  </section>
6373  <section id="requests:QueryTextExtents">
6374    <title>QueryTextExtents</title>
6375    <indexterm zone="requests:QueryTextExtents" significance="preferred"><primary>QueryTextExtents</primary></indexterm>
6376<informaltable frame='none'>
6377  <?dbfo keep-together="always" ?>
6378  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6379  <colspec colname='c1' colwidth='1.0*'/>
6380  <tbody>
6381    <row>
6382      <entry>
6383<!-- .in +.2i -->
6384<emphasis remap='I'>font</emphasis>: FONTABLE
6385      </entry>
6386    </row>
6387    <row>
6388      <entry>
6389<emphasis remap='I'>string</emphasis>: STRING16
6390<!-- .in -.2i -->
6391      </entry>
6392    </row>
6393    <row>
6394      <entry>
63956396      </entry>
6397    </row>
6398    <row>
6399      <entry>
6400<!-- .in +.2i -->
6401draw-direction:
6402{ <emphasis role='bold'>LeftToRight</emphasis>,
6403<emphasis role='bold'>RightToLeft</emphasis>}
6404      </entry>
6405    </row>
6406    <row>
6407      <entry>
6408font-ascent: INT16
6409      </entry>
6410    </row>
6411    <row>
6412      <entry>
6413font-descent: INT16
6414      </entry>
6415    </row>
6416    <row>
6417      <entry>
6418overall-ascent: INT16
6419      </entry>
6420    </row>
6421    <row>
6422      <entry>
6423overall-descent: INT16
6424      </entry>
6425    </row>
6426    <row>
6427      <entry>
6428overall-width: INT32
6429      </entry>
6430    </row>
6431    <row>
6432      <entry>
6433overall-left: INT32
6434      </entry>
6435    </row>
6436    <row>
6437      <entry>
6438overall-right: INT32
6439<!-- .in -.2i -->
6440      </entry>
6441    </row>
6442    <row>
6443      <entry>
6444<!-- .in +.2i -->
6445Errors:
6446<emphasis role='bold'>Font</emphasis>
6447<!-- .in -.2i -->
6448<!-- .eM -->
6449      </entry>
6450    </row>
6451  </tbody>
6452  </tgroup>
6453</informaltable>
6454<!-- .eM -->
6455<para>
6456This request returns the logical extents of the specified string of characters
6457in the specified font.
6458If a gcontext is given for font,
6459the currently contained font is used.
6460The draw-direction, font-ascent, and font-descent are the same as
6461described in
6462<link linkend="requests:QueryFont"><emphasis role='bold'>QueryFont</emphasis></link>.
6463The overall-ascent is the maximum of the ascent metrics of all characters
6464in the string, and the overall-descent is the maximum of the descent metrics.
6465The overall-width is the sum of the character-width metrics of all characters
6466in the string.
6467For each character in the string,
6468let W be the sum of the character-width metrics of all characters preceding it
6469in the string,
6470let L be the left-side-bearing metric of the character plus W,
6471and let R be the right-side-bearing metric of the character plus W.
6472The overall-left is the minimum L of all characters in the string,
6473and the overall-right is the maximum R.
6474</para>
6475<para>
6476For fonts defined with linear indexing rather than 2-byte matrix indexing,
6477the server will interpret each CHAR2B as a 16-bit number that
6478has been transmitted most significant byte first (that is, byte1 of the
6479CHAR2B is taken as the most significant byte).
6480</para>
6481<para>
6482Characters with all zero metrics are ignored.
6483If the font has no defined default-char,
6484then undefined characters in the string are also ignored.
6485<!-- .sp -->
6486</para>
6487  </section>
6488  <section id="requests:ListFonts">
6489    <title>ListFonts</title>
6490    <indexterm zone="requests:ListFonts" significance="preferred"><primary>ListFonts</primary></indexterm>
6491<informaltable frame='none'>
6492  <?dbfo keep-together="always" ?>
6493  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6494  <colspec colname='c1' colwidth='1.0*'/>
6495  <tbody>
6496    <row>
6497      <entry>
6498<!-- .in +.2i -->
6499<emphasis remap='I'>pattern</emphasis>: STRING8
6500      </entry>
6501    </row>
6502    <row>
6503      <entry>
6504<emphasis remap='I'>max-names</emphasis>: CARD16
6505<!-- .in -.2i -->
6506      </entry>
6507    </row>
6508    <row>
6509      <entry>
65106511      </entry>
6512    </row>
6513    <row>
6514      <entry>
6515<!-- .in +.2i -->
6516names: LISTofSTRING8
6517<!-- .in -.2i -->
6518<!-- .eM -->
6519      </entry>
6520    </row>
6521  </tbody>
6522  </tgroup>
6523</informaltable>
6524<!-- .eM -->
6525<para>
6526This request returns a list
6527of available font names (as controlled by the font search path; see
6528<link linkend="requests:SetFontPath"><emphasis role='bold'>SetFontPath</emphasis></link>
6529request)
6530that match the pattern.
6531At most, max-names names will be returned.
6532The pattern should use the ISO Latin-1 encoding,
6533and uppercase and lowercase do not matter.
6534In the pattern,
6535the <quote>?</quote> character (octal value 77) will match any single character,
6536and the <quote>*</quote> character (octal value 52) will match any number
6537of characters.
6538The returned names are in lowercase.
6539<!-- .sp -->
6540</para>
6541  </section>
6542  <section id="requests:ListFontsWithInfo">
6543    <title>ListFontsWithInfo</title>
6544    <indexterm zone="requests:ListFontsWithInfo" significance="preferred"><primary>ListFontsWithInfo</primary></indexterm>
6545<informaltable frame='none'>
6546  <?dbfo keep-together="always" ?>
6547  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6548  <colspec colname='c1' colwidth='1.0*'/>
6549  <tbody>
6550    <row>
6551      <entry>
6552<!-- .in +.2i -->
6553<emphasis remap='I'>pattern</emphasis>: STRING8
6554      </entry>
6555    </row>
6556    <row>
6557      <entry>
6558<emphasis remap='I'>max-names</emphasis>: CARD16
6559<!-- .in -.2i -->
6560      </entry>
6561    </row>
6562    <row>
6563      <entry>
65646565      </entry>
6566    </row>
6567    <row>
6568      <entry>
6569<!-- .in +.2i -->
6570name: STRING8
6571      </entry>
6572    </row>
6573    <row>
6574      <entry>
6575info FONTINFO
6576      </entry>
6577    </row>
6578    <row>
6579      <entry>
6580replies-hint: CARD32
6581<!-- .in -.2i -->
6582      </entry>
6583    </row>
6584    <row>
6585      <entry>
6586<!-- .in +.2i -->
6587where:
6588<!-- .in -.2i -->
6589      </entry>
6590    </row>
6591    <row>
6592      <entry>
6593<!-- .in +.2i -->
6594FONTINFO: &lt;same type definition as in
6595<link linkend="requests:QueryFont"><emphasis role='bold'>QueryFont</emphasis></link>&gt;
6596<!-- .eM -->
6597      </entry>
6598    </row>
6599  </tbody>
6600  </tgroup>
6601</informaltable>
6602<!-- .eM -->
6603<para>
6604This request is similar to
6605<link linkend="requests:ListFonts"><emphasis role='bold'>ListFonts</emphasis></link>,
6606but it also returns information about each font.
6607The information returned for each font is identical to what
6608<link linkend="requests:QueryFont"><emphasis role='bold'>QueryFont</emphasis></link>
6609would return except that the per-character metrics are not returned.
6610Note that this request can generate multiple replies.
6611With each reply,
6612replies-hint may provide an indication of how many more fonts will be returned.
6613This number is a hint only and may be larger or smaller than
6614the number of fonts actually returned.
6615A zero value does not guarantee that no more fonts will be returned.
6616After the font replies,
6617a reply with a zero-length name is sent to indicate the end of the reply
6618sequence.
6619<!-- .sp -->
6620</para>
6621  </section>
6622  <section id="requests:SetFontPath">
6623    <title>SetFontPath</title>
6624    <indexterm zone="requests:SetFontPath" significance="preferred"><primary>SetFontPath</primary></indexterm>
6625<informaltable frame='none'>
6626  <?dbfo keep-together="always" ?>
6627  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6628  <colspec colname='c1' colwidth='1.0*'/>
6629  <tbody>
6630    <row>
6631      <entry>
6632<!-- .in +.2i -->
6633<emphasis remap='I'>path</emphasis>: LISTofSTRING8
6634<!-- .in -.2i -->
6635      </entry>
6636    </row>
6637    <row>
6638      <entry>
6639<!-- .in +.2i -->
6640Errors:
6641<emphasis role='bold'>Value</emphasis>
6642<!-- .in -.2i -->
6643<!-- .eM -->
6644      </entry>
6645    </row>
6646  </tbody>
6647  </tgroup>
6648</informaltable>
6649<!-- .eM -->
6650<para>
6651This request defines the search path for font lookup.
6652There is only one search path per server, not one per client.
6653The interpretation of the strings is operating-system-dependent,
6654but the strings are intended to specify directories to be searched in the
6655order listed.
6656</para>
6657<para>
6658Setting the path to the empty list restores the default path defined
6659for the server.
6660</para>
6661<para>
6662As a side effect of executing this request,
6663the server is guaranteed to flush all cached information about fonts
6664for which there currently are no explicit resource IDs allocated.
6665</para>
6666<para>
6667The meaning of an error from this request is system specific.
6668<!-- .sp -->
6669</para>
6670  </section>
6671  <section id="requests:GetFontPath">
6672    <title>GetFontPath</title>
6673    <indexterm zone="requests:GetFontPath" significance="preferred"><primary>GetFontPath</primary></indexterm>
6674<informaltable frame='none'>
6675  <?dbfo keep-together="always" ?>
6676  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6677  <colspec colname='c1' colwidth='1.0*'/>
6678  <tbody>
6679    <row>
6680      <entry>
66816682      </entry>
6683    </row>
6684    <row>
6685      <entry>
6686<!-- .in +.2i -->
6687path: LISTofSTRING8
6688<!-- .in -.2i -->
6689<!-- .eM -->
6690      </entry>
6691    </row>
6692  </tbody>
6693  </tgroup>
6694</informaltable>
6695<!-- .eM -->
6696<para>
6697This request returns the current search path for fonts.
6698<!-- .sp -->
6699</para>
6700  </section>
6701  <section id="requests:CreatePixmap">
6702    <title>CreatePixmap</title>
6703    <indexterm zone="requests:CreatePixmap" significance="preferred"><primary>CreatePixmap</primary></indexterm>
6704<informaltable frame='none'>
6705  <?dbfo keep-together="always" ?>
6706  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6707  <colspec colname='c1' colwidth='1.0*'/>
6708  <tbody>
6709    <row>
6710      <entry>
6711<!-- .in +.2i -->
6712<emphasis remap='I'>pid</emphasis>: PIXMAP
6713      </entry>
6714    </row>
6715    <row>
6716      <entry>
6717<emphasis remap='I'>drawable</emphasis>: DRAWABLE
6718      </entry>
6719    </row>
6720    <row>
6721      <entry>
6722<emphasis remap='I'>depth</emphasis>: CARD8
6723      </entry>
6724    </row>
6725    <row>
6726      <entry>
6727<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
6728<!-- .in -.2i -->
6729      </entry>
6730    </row>
6731    <row>
6732      <entry>
6733<!-- .in +.2i -->
6734Errors:
6735<emphasis role='bold'>Alloc</emphasis>,
6736<emphasis role='bold'>Drawable</emphasis>,
6737<emphasis role='bold'>IDChoice</emphasis>,
6738<emphasis role='bold'>Value</emphasis>
6739<!-- .in -.2i -->
6740<!-- .eM -->
6741      </entry>
6742    </row>
6743  </tbody>
6744  </tgroup>
6745</informaltable>
6746<!-- .eM -->
6747<para>
6748This request creates a pixmap and assigns the identifier pid to it.
6749The width and height must be nonzero (or a
6750<emphasis role='bold'>Value</emphasis>
6751error results).
6752The depth must be one of the depths supported by the root of the specified
6753drawable (or a
6754<emphasis role='bold'>Value</emphasis>
6755error results).
6756The initial contents of the pixmap are undefined.
6757</para>
6758<para>
6759It is legal to pass an
6760<emphasis role='bold'>InputOnly</emphasis>
6761window as a drawable to this request.
6762<!-- .sp -->
6763</para>
6764  </section>
6765  <section id="requests:FreePixmap">
6766    <title>FreePixmap</title>
6767    <indexterm zone="requests:FreePixmap" significance="preferred"><primary>FreePixmap</primary></indexterm>
6768<informaltable frame='none'>
6769  <?dbfo keep-together="always" ?>
6770  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6771  <colspec colname='c1' colwidth='1.0*'/>
6772  <tbody>
6773    <row>
6774      <entry>
6775<!-- .in +.2i -->
6776<emphasis remap='I'>pixmap</emphasis>: PIXMAP
6777<!-- .in -.2i -->
6778      </entry>
6779    </row>
6780    <row>
6781      <entry>
6782<!-- .in +.2i -->
6783Errors:
6784<emphasis role='bold'>Pixmap</emphasis>
6785<!-- .in -.2i -->
6786<!-- .eM -->
6787      </entry>
6788    </row>
6789  </tbody>
6790  </tgroup>
6791</informaltable>
6792<!-- .eM -->
6793<para>
6794This request deletes the association between the resource ID and the pixmap.
6795The pixmap storage will be freed when no other resource references it.
6796<!-- .sp -->
6797</para>
6798  </section>
6799  <section id="requests:CreateGC">
6800    <title>CreateGC</title>
6801    <indexterm zone="requests:CreateGC" significance="preferred"><primary>CreateGC</primary></indexterm>
6802    <indexterm zone="requests:CreateGC"><primary>Graphics context</primary></indexterm>
6803<informaltable frame='none'>
6804  <?dbfo keep-together="always" ?>
6805  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
6806  <colspec colname='c1' colwidth='1.0*'/>
6807  <tbody>
6808    <row>
6809      <entry>
6810<!-- .in +.2i -->
6811<emphasis remap='I'>cid</emphasis>: GCONTEXT
6812      </entry>
6813    </row>
6814    <row>
6815      <entry>
6816<emphasis remap='I'>drawable</emphasis>: DRAWABLE
6817      </entry>
6818    </row>
6819    <row>
6820      <entry>
6821<emphasis remap='I'>value-mask</emphasis>: BITMASK
6822      </entry>
6823    </row>
6824    <row>
6825      <entry>
6826<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
6827<!-- .in -.2i -->
6828      </entry>
6829    </row>
6830    <row>
6831      <entry>
6832<!-- .in +.2i -->
6833Errors:
6834<emphasis role='bold'>Alloc</emphasis>,
6835<emphasis role='bold'>Drawable</emphasis>,
6836<emphasis role='bold'>Font</emphasis>,
6837<emphasis role='bold'>IDChoice</emphasis>,
6838<emphasis role='bold'>Match</emphasis>,
6839<emphasis role='bold'>Pixmap</emphasis>,
6840<emphasis role='bold'>Value</emphasis>
6841<!-- .in -.2i -->
6842<!-- .eM -->
6843      </entry>
6844    </row>
6845  </tbody>
6846  </tgroup>
6847</informaltable>
6848
6849<para>
6850This request creates a graphics context
6851and assigns the identifier cid to it.
6852The gcontext can be used with any destination drawable having the same root
6853and depth as the specified drawable;
6854use with other drawables results in a
6855<emphasis role='bold'>Match</emphasis>
6856error.
6857</para>
6858<para>
6859The value-mask and value-list specify which components are to be
6860explicitly initialized.
6861The context components are:
6862</para>
6863
6864<informaltable frame='topbot'>
6865  <?dbfo keep-together="always" ?>
6866  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
6867  <colspec colname='c1' colwidth='1.0*'/>
6868  <colspec colname='c2' colwidth='2.0*'/>
6869  <thead>
6870    <row rowsep='1'>
6871      <entry>Component</entry>
6872      <entry>Type</entry>
6873    </row>
6874  </thead>
6875  <tbody>
6876    <row>
6877      <entry>function</entry>
6878      <entry>
6879{ <emphasis role='bold'>Clear</emphasis>,
6880<emphasis role='bold'>And</emphasis>,
6881<emphasis role='bold'>AndReverse</emphasis>,
6882<emphasis role='bold'>Copy</emphasis>,
6883<emphasis role='bold'>AndInverted</emphasis>,
6884<emphasis role='bold'>NoOp</emphasis>,
6885<emphasis role='bold'>Xor</emphasis>,
6886<emphasis role='bold'>Or</emphasis>,
6887<emphasis role='bold'>Nor</emphasis>,
6888<emphasis role='bold'>Equiv</emphasis>,
6889<emphasis role='bold'>Invert</emphasis>,
6890<emphasis role='bold'>OrReverse</emphasis>,
6891<emphasis role='bold'>CopyInverted</emphasis>,
6892<emphasis role='bold'>OrInverted</emphasis>,
6893<emphasis role='bold'>Nand</emphasis>,
6894<emphasis role='bold'>Set</emphasis> }
6895      </entry>
6896    </row>
6897    <row>
6898      <entry>plane-mask</entry>
6899      <entry>CARD32</entry>
6900    </row>
6901    <row>
6902      <entry>foreground</entry>
6903      <entry>CARD32</entry>
6904    </row>
6905    <row>
6906      <entry>background</entry>
6907      <entry>CARD32</entry>
6908    </row>
6909    <row>
6910      <entry>line-width</entry>
6911      <entry>CARD16</entry>
6912    </row>
6913    <row>
6914      <entry>line-style</entry>
6915      <entry>
6916{ <emphasis role='bold'>Solid</emphasis>,
6917<emphasis role='bold'>OnOffDash</emphasis>,
6918<emphasis role='bold'>DoubleDash</emphasis> }
6919      </entry>
6920    </row>
6921    <row>
6922      <entry>cap-style</entry>
6923      <entry>
6924{ <emphasis role='bold'>NotLast</emphasis>,
6925<emphasis role='bold'>Butt</emphasis>,
6926<emphasis role='bold'>Round</emphasis>,
6927<emphasis role='bold'>Projecting</emphasis> }
6928      </entry>
6929    </row>
6930    <row>
6931      <entry>join-style</entry>
6932      <entry>
6933{ <emphasis role='bold'>Miter</emphasis>,
6934<emphasis role='bold'>Round</emphasis>,
6935<emphasis role='bold'>Bevel</emphasis> }
6936      </entry>
6937    </row>
6938    <row>
6939      <entry>fill-style</entry>
6940      <entry>
6941{ <emphasis role='bold'>Solid</emphasis>,
6942<emphasis role='bold'>Tiled</emphasis>,
6943<emphasis role='bold'>OpaqueStippled</emphasis>,
6944<emphasis role='bold'>Stippled</emphasis> }
6945      </entry>
6946    </row>
6947    <row>
6948      <entry>fill-rule</entry>
6949      <entry>
6950{ <emphasis role='bold'>EvenOdd</emphasis>,
6951<emphasis role='bold'>Winding</emphasis> }
6952      </entry>
6953    </row>
6954    <row>
6955      <entry>arc-mode</entry>
6956      <entry>
6957{ <emphasis role='bold'>Chord</emphasis>,
6958<emphasis role='bold'>PieSlice</emphasis> }
6959      </entry>
6960    </row>
6961    <row>
6962      <entry>tile</entry>
6963      <entry>PIXMAP</entry>
6964    </row>
6965    <row>
6966      <entry>stipple</entry>
6967      <entry>PIXMAP</entry>
6968    </row>
6969    <row>
6970      <entry>tile-stipple-x-origin</entry>
6971      <entry>INT16</entry>
6972    </row>
6973    <row>
6974      <entry>tile-stipple-y-origin</entry>
6975      <entry>INT16</entry>
6976    </row>
6977    <row>
6978      <entry>font</entry>
6979      <entry>FONT</entry>
6980    </row>
6981    <row>
6982      <entry>subwindow-mode</entry>
6983      <entry>
6984{ <emphasis role='bold'>ClipByChildren</emphasis>,
6985<emphasis role='bold'>IncludeInferiors</emphasis> }
6986      </entry>
6987    </row>
6988    <row>
6989      <entry>graphics-exposures</entry>
6990      <entry>BOOL</entry>
6991    </row>
6992    <row>
6993      <entry>clip-x-origin</entry>
6994      <entry>INT16</entry>
6995    </row>
6996    <row>
6997      <entry>clip-y-origin</entry>
6998      <entry>INT16</entry>
6999    </row>
7000    <row>
7001      <entry>clip-mask</entry>
7002      <entry>
7003PIXMAP or
7004<emphasis role='bold'>None</emphasis>
7005      </entry>
7006    </row>
7007    <row>
7008      <entry>dash-offset</entry>
7009      <entry>CARD16</entry>
7010    </row>
7011    <row>
7012      <entry>dashes</entry>
7013      <entry>CARD8</entry>
7014    </row>
7015  </tbody>
7016  </tgroup>
7017</informaltable>
7018
7019<para id="requests:CreateGC:plane-mask">
7020<indexterm zone="requests:CreateGC:plane-mask"><primary>Plane</primary><secondary>mask</secondary></indexterm>
7021In graphics operations,
7022given a source and destination pixel,
7023the result is computed bitwise on corresponding bits of the pixels;
7024that is, a Boolean operation is performed in each bit plane.
7025The plane-mask restricts the operation to a subset of planes,
7026so the result is:
7027</para>
7028
7029<literallayout class="monospaced">
7030	((src FUNC dst) AND plane-mask) OR (dst AND (NOT plane-mask))
7031</literallayout>
7032
7033<para>
7034Range checking is not performed on the values for foreground, background,
7035or plane-mask.
7036They are simply truncated to the appropriate number of bits.
7037</para>
7038
7039<para id="requests:CreateGC:function">
7040The meanings of the functions are:
7041</para>
7042
7043<informaltable frame='topbot'>
7044  <?dbfo keep-together="always" ?>
7045  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7046  <colspec colname='c1' colwidth='1.0*'/>
7047  <colspec colname='c2' colwidth='2.0*'/>
7048  <thead>
7049    <row rowsep='1'>
7050      <entry>Function</entry>
7051      <entry>Operation</entry>
7052    </row>
7053  </thead>
7054  <tbody>
7055    <row>
7056      <entry>
7057<emphasis role='bold'>Clear</emphasis>
7058      </entry>
7059      <entry>0</entry>
7060    </row>
7061    <row>
7062      <entry>
7063<emphasis role='bold'>And</emphasis>
7064      </entry>
7065      <entry>src AND dst</entry>
7066    </row>
7067    <row>
7068      <entry>
7069<emphasis role='bold'>AndReverse</emphasis>
7070      </entry>
7071      <entry>src AND (NOT dst)</entry>
7072    </row>
7073    <row>
7074      <entry>
7075<emphasis role='bold'>Copy</emphasis>
7076      </entry>
7077      <entry>src</entry>
7078    </row>
7079    <row>
7080      <entry>
7081<emphasis role='bold'>AndInverted</emphasis>
7082      </entry>
7083      <entry>(NOT src) AND dst</entry>
7084    </row>
7085    <row>
7086      <entry>
7087<emphasis role='bold'>NoOp</emphasis>
7088      </entry>
7089      <entry>dst</entry>
7090    </row>
7091    <row>
7092      <entry>
7093<emphasis role='bold'>Xor</emphasis>
7094      </entry>
7095      <entry>src XOR dst</entry>
7096    </row>
7097    <row>
7098      <entry>
7099<emphasis role='bold'>Or</emphasis>
7100      </entry>
7101      <entry>src OR dst</entry>
7102    </row>
7103    <row>
7104      <entry>
7105<emphasis role='bold'>Nor</emphasis>
7106      </entry>
7107      <entry>(NOT src) AND (NOT dst)</entry>
7108    </row>
7109    <row>
7110      <entry>
7111<emphasis role='bold'>Equiv</emphasis>
7112      </entry>
7113      <entry>(NOT src) XOR dst</entry>
7114    </row>
7115    <row>
7116      <entry>
7117<emphasis role='bold'>Invert</emphasis>
7118      </entry>
7119      <entry>NOT dst</entry>
7120    </row>
7121    <row>
7122      <entry>
7123<emphasis role='bold'>OrReverse</emphasis>
7124      </entry>
7125      <entry>src OR (NOT dst)</entry>
7126    </row>
7127    <row>
7128      <entry>
7129<emphasis role='bold'>CopyInverted</emphasis>
7130      </entry>
7131      <entry>NOT src</entry>
7132    </row>
7133    <row>
7134      <entry>
7135<emphasis role='bold'>OrInverted</emphasis>
7136      </entry>
7137      <entry>(NOT src) OR dst</entry>
7138    </row>
7139    <row>
7140      <entry>
7141<emphasis role='bold'>Nand</emphasis>
7142      </entry>
7143      <entry>(NOT src) OR (NOT dst)</entry>
7144    </row>
7145    <row>
7146      <entry>
7147<emphasis role='bold'>Set</emphasis>
7148      </entry>
7149      <entry>1</entry>
7150    </row>
7151  </tbody>
7152  </tgroup>
7153</informaltable>
7154
7155<para id="requests:CreateGC:line-width">
7156<indexterm zone="requests:CreateGC:line-width"><primary>Line</primary><secondary>drawing</secondary></indexterm>
7157The line-width is measured in pixels and can be greater than or equal to
7158one, a wide line, or the special value zero, a thin line.
7159</para>
7160
7161<para>
7162Wide lines are drawn centered on the path described by the graphics request.
7163Unless otherwise specified by the join or cap style,
7164the bounding box of a wide line with endpoints [x1, y1], [x2, y2] and
7165width w is a rectangle with vertices at the following real coordinates:
7166</para>
7167
7168<literallayout class="monospaced">
7169	[x1-(w*sn/2), y1+(w*cs/2)], [x1+(w*sn/2), y1-(w*cs/2)],
7170	[x2-(w*sn/2), y2+(w*cs/2)], [x2+(w*sn/2), y2-(w*cs/2)]
7171</literallayout>
7172
7173<para>
7174The sn is the sine of the angle of the line and cs is the cosine of
7175the angle of the line.
7176A pixel is part of the line (and hence drawn) if the center of the pixel
7177is fully inside the bounding box, which is viewed as having infinitely thin
7178edges.
7179If the center of the pixel is exactly on the bounding box,
7180it is part of the line if and only if the interior is immediately to its right
7181(x increasing direction).
7182Pixels with centers on a horizontal edge are a special case and are part of
7183the line if and only if the interior or the boundary is immediately below
7184(y increasing direction) and if the interior or the boundary is immediately
7185to the right (x increasing direction).
7186Note that this description is a mathematical model describing the pixels
7187that are drawn for a wide line and does not imply that trigonometry is required
7188to implement such a model.
7189Real or fixed point arithmetic is recommended for computing the corners of the
7190line endpoints for lines greater than one pixel in width.
7191</para>
7192<para>
7193Thin lines (zero line-width) are nominally one pixel wide lines drawn using an
7194unspecified, device-dependent algorithm.
7195There are only two constraints on this algorithm.
7196First, if a line is drawn unclipped from [x1,y1] to [x2,y2]
7197and another line is drawn unclipped from [x1+dx,y1+dy] to [x2+dx,y2+dy],
7198then a point [x,y] is touched by drawing the first line if
7199and only if the point [x+dx,y+dy] is touched by drawing the second line.
7200Second, the effective set of points comprising a line cannot be affected
7201by clipping.
7202Thus, a point is touched in a clipped line if and only if the point lies
7203inside the clipping region and the point would be touched by the line
7204when drawn unclipped.
7205</para>
7206<para>
7207Note that a wide line drawn from [x1,y1] to [x2,y2] always draws the
7208same pixels as a wide line drawn from [x2,y2] to [x1,y1], not counting
7209cap-style and join-style.
7210Implementors are encouraged to make this property true for thin lines,
7211but it is not required.
7212A line-width of zero may differ from a line-width of one in which pixels
7213are drawn.
7214In general,
7215drawing a thin line will be faster than drawing a wide line of width one,
7216but thin lines may not mix well aesthetically with wide lines
7217because of the different drawing algorithms.
7218If it is desirable to obtain precise and uniform results across all displays,
7219a client should always use a line-width of one, rather than a line-width of
7220zero.
7221</para>
7222<para id="requests:CreateGC:line-style">
7223The line-style defines which sections of a line are drawn:
7224</para>
7225
7226<informaltable frame='none'>
7227  <?dbfo keep-together="always" ?>
7228  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7229  <colspec colname='c1' colwidth='1.0*'/>
7230  <colspec colname='c2' colwidth='2.0*'/>
7231  <tbody>
7232    <row>
7233      <entry>
7234<emphasis role='bold'>Solid</emphasis>
7235      </entry>
7236      <entry>
7237The full path of the line is drawn.
7238      </entry>
7239    </row>
7240    <row>
7241      <entry>
7242<emphasis role='bold'>DoubleDash</emphasis>
7243      </entry>
7244      <entry>
7245The full path of the line is drawn,
7246but the even dashes are filled differently than the odd dashes
7247(see fill-style), with
7248<emphasis role='bold'>Butt</emphasis>
7249cap-style used where even and odd dashes meet.
7250      </entry>
7251    </row>
7252    <row>
7253      <entry>
7254<emphasis role='bold'>OnOffDash</emphasis>
7255      </entry>
7256      <entry>
7257Only the even dashes are drawn,
7258and cap-style applies to all internal ends of the individual dashes
7259(except
7260<emphasis role='bold'>NotLast</emphasis>
7261is treated as
7262<emphasis role='bold'>Butt</emphasis>).
7263      </entry>
7264    </row>
7265  </tbody>
7266  </tgroup>
7267</informaltable>
7268
7269<para id="requests:CreateGC:cap-style">
7270The cap-style defines how the endpoints of a path are drawn:
7271</para>
7272
7273<informaltable frame='none'>
7274  <?dbfo keep-together="always" ?>
7275  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7276  <colspec colname='c1' colwidth='1.0*'/>
7277  <colspec colname='c2' colwidth='2.0*'/>
7278  <tbody>
7279    <row>
7280      <entry>
7281<emphasis role='bold'>NotLast</emphasis>
7282      </entry>
7283      <entry>
7284The result is equivalent to
7285<emphasis role='bold'>Butt</emphasis>,
7286except that for a line-width of zero the final endpoint is not drawn.
7287      </entry>
7288    </row>
7289    <row>
7290      <entry>
7291<emphasis role='bold'>Butt</emphasis>
7292      </entry>
7293      <entry>
7294The result is square at the endpoint (perpendicular to the slope of the
7295line) with no projection beyond.
7296      </entry>
7297    </row>
7298    <row>
7299      <entry>
7300<emphasis role='bold'>Round</emphasis>
7301      </entry>
7302      <entry>
7303The result is a circular arc with its diameter equal to the line-width,
7304centered on the endpoint; it is equivalent to
7305<emphasis role='bold'>Butt</emphasis>
7306for line-width zero.
7307      </entry>
7308    </row>
7309    <row>
7310      <entry>
7311<emphasis role='bold'>Projecting</emphasis>
7312      </entry>
7313      <entry>
7314The result is square at the end, but the path continues beyond the
7315endpoint for a distance equal to half the line-width;
7316it is equivalent to
7317<emphasis role='bold'>Butt</emphasis>
7318for line-width zero.
7319      </entry>
7320    </row>
7321  </tbody>
7322  </tgroup>
7323</informaltable>
7324
7325
7326
7327<para id="requests:CreateGC:join-style">
7328The join-style defines how corners are drawn for wide lines:
7329</para>
7330
7331<informaltable frame='none'>
7332  <?dbfo keep-together="always" ?>
7333  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7334  <colspec colname='c1' colwidth='1.0*'/>
7335  <colspec colname='c2' colwidth='2.0*'/>
7336  <tbody>
7337    <row>
7338      <entry>
7339<emphasis role='bold'>Miter</emphasis>
7340      </entry>
7341      <entry>
7342The outer edges of the two lines extend to meet at an angle.
7343However, if the angle is less than 11 degrees, a
7344<emphasis role='bold'>Bevel</emphasis>
7345join-style is used instead.
7346      </entry>
7347    </row>
7348    <row>
7349      <entry>
7350<emphasis role='bold'>Round</emphasis>
7351      </entry>
7352      <entry>
7353The result is a circular arc with a diameter equal to the line-width,
7354centered on the joinpoint.
7355      </entry>
7356    </row>
7357    <row>
7358      <entry>
7359<emphasis role='bold'>Bevel</emphasis>
7360      </entry>
7361      <entry>
7362The result is
7363<emphasis role='bold'>Butt</emphasis>
7364endpoint styles, and then the triangular notch is filled.
7365      </entry>
7366    </row>
7367  </tbody>
7368  </tgroup>
7369</informaltable>
7370
7371
7372<para>
7373For a line with coincident endpoints (x1=x2, y1=y2), when the cap-style
7374is applied to both endpoints, the semantics depends on the line-width
7375and the cap-style:
7376</para>
7377
7378<informaltable frame='none'>
7379  <?dbfo keep-together="always" ?>
7380  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
7381  <colspec colname='c1' colwidth='1.0*'/>
7382  <colspec colname='c2' colwidth='1.0*'/>
7383  <colspec colname='c3' colwidth='4.0*'/>
7384  <tbody>
7385    <row>
7386      <entry>
7387<emphasis role='bold'>NotLast</emphasis>
7388      </entry>
7389      <entry>thin</entry>
7390      <entry>
7391This is device-dependent, but the desired effect is that nothing is drawn.
7392      </entry>
7393    </row>
7394    <row>
7395      <entry>
7396<emphasis role='bold'>Butt</emphasis>
7397      </entry>
7398      <entry>thin</entry>
7399      <entry>
7400This is device-dependent, but the desired effect is that
7401a single pixel is drawn.
7402      </entry>
7403    </row>
7404    <row>
7405      <entry>
7406<emphasis role='bold'>Round</emphasis>
7407      </entry>
7408      <entry>thin</entry>
7409      <entry>
7410This is the same as
7411<emphasis role='bold'>Butt</emphasis>/thin.
7412      </entry>
7413    </row>
7414    <row>
7415      <entry>
7416<emphasis role='bold'>Projecting</emphasis>
7417      </entry>
7418      <entry>thin</entry>
7419      <entry>
7420This is the same as
7421<emphasis role='bold'>Butt</emphasis>/thin.
7422      </entry>
7423    </row>
7424    <row>
7425      <entry>
7426<emphasis role='bold'>Butt</emphasis>
7427      </entry>
7428      <entry>wide</entry>
7429      <entry>
7430Nothing is drawn.
7431      </entry>
7432    </row>
7433    <row>
7434      <entry>
7435<emphasis role='bold'>Round</emphasis>
7436      </entry>
7437      <entry>wide</entry>
7438      <entry>
7439The closed path is a circle, centered at the endpoint and
7440with a diameter equal to the line-width.
7441      </entry>
7442    </row>
7443    <row>
7444      <entry>
7445<emphasis role='bold'>Projecting</emphasis>
7446      </entry>
7447      <entry>wide</entry>
7448      <entry>
7449The closed path is a square, aligned with the coordinate axes,
7450centered at the endpoint and with sides equal to the line-width.
7451      </entry>
7452    </row>
7453  </tbody>
7454  </tgroup>
7455</informaltable>
7456
7457<para>
7458For a line with coincident endpoints (x1=x2, y1=y2),
7459when the join-style is applied at one or both endpoints,
7460the effect is as if the line was removed from the overall path.
7461However, if the total path consists of (or is reduced to) a single point
7462joined with itself,
7463the effect is the same as when the cap-style is applied at both endpoints.
7464</para>
7465<para>
7466The tile/stipple represents an infinite two-dimensional plane
7467with the tile/stipple
7468replicated in all dimensions.  When that plane is superimposed on
7469the drawable for use in a graphics operation, the upper-left corner
7470of some instance of the tile/stipple is at the coordinates within
7471the drawable specified by the tile/stipple origin.
7472The tile/stipple and clip origins are interpreted relative to the
7473origin of whatever destination drawable is specified in a graphics
7474request.
7475</para>
7476<para>
7477The tile pixmap must have the same root and depth as the gcontext (or a
7478<emphasis role='bold'>Match</emphasis>
7479error results).
7480The stipple pixmap must have depth one and must have the same root
7481as the gcontext (or a
7482<emphasis role='bold'>Match</emphasis>
7483error results).
7484For fill-style
7485<emphasis role='bold'>Stippled</emphasis>
7486(but not fill-style
7487<emphasis role='bold'>OpaqueStippled</emphasis>),
7488the stipple pattern is tiled in a single plane
7489and acts as an additional clip mask to be ANDed with the clip-mask.
7490Any size pixmap can be used for tiling or stippling,
7491although some sizes may be faster to use than others.
7492</para>
7493<para>
7494The fill-style defines the contents of the source for line, text, and
7495fill requests.
7496For all text and fill requests (for example,
7497<link linkend="requests:PolyText8"><emphasis role='bold'>PolyText8</emphasis></link>,
7498<link linkend="requests:PolyText16"><emphasis role='bold'>PolyText16</emphasis></link>,
7499<link linkend="requests:PolyFillRectangle"><emphasis role='bold'>PolyFillRectangle</emphasis></link>,
7500<link linkend="requests:FillPoly"><emphasis role='bold'>FillPoly</emphasis></link>,
7501and
7502<link linkend="requests:PolyFillArc"><emphasis role='bold'>PolyFillArc</emphasis></link>)
7503as well as for line requests with line-style
7504<emphasis role='bold'>Solid</emphasis>,
7505(for example,
7506<link linkend="requests:PolyLine"><emphasis role='bold'>PolyLine</emphasis></link>,
7507<link linkend="requests:PolySegment"><emphasis role='bold'>PolySegment</emphasis></link>,
7508<link linkend="requests:PolyRectangle"><emphasis role='bold'>PolyRectangle</emphasis></link>,
7509<link linkend="requests:PolyArc"><emphasis role='bold'>PolyArc</emphasis></link> )
7510and for the even dashes for line requests with line-style
7511<emphasis role='bold'>OnOffDash</emphasis>
7512or
7513<emphasis role='bold'>DoubleDash</emphasis>:
7514</para>
7515
7516<informaltable frame='none'>
7517  <?dbfo keep-together="always" ?>
7518  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7519  <colspec colname='c1' colwidth='1.0*'/>
7520  <colspec colname='c2' colwidth='2.0*'/>
7521  <tbody>
7522    <row>
7523      <entry>
7524<emphasis role='bold'>Solid</emphasis>
7525      </entry>
7526      <entry>Foreground</entry>
7527    </row>
7528    <row>
7529      <entry>
7530<emphasis role='bold'>Tiled</emphasis>
7531      </entry>
7532      <entry>Tile</entry>
7533    </row>
7534    <row>
7535      <entry>
7536<emphasis role='bold'>OpaqueStippled</emphasis>
7537      </entry>
7538      <entry>
7539A tile with the same width and height as stipple
7540but with background everywhere stipple has a zero
7541and with foreground everywhere stipple has a one
7542      </entry>
7543    </row>
7544    <row>
7545      <entry>
7546<emphasis role='bold'>Stippled</emphasis>
7547      </entry>
7548      <entry>
7549Foreground masked by stipple
7550      </entry>
7551    </row>
7552  </tbody>
7553  </tgroup>
7554</informaltable>
7555
7556<para>
7557For the odd dashes for line requests with line-style
7558<emphasis role='bold'>DoubleDash</emphasis>:
7559</para>
7560
7561<informaltable frame='none'>
7562  <?dbfo keep-together="always" ?>
7563  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7564  <colspec colname='c1' colwidth='1.0*'/>
7565  <colspec colname='c2' colwidth='2.0*'/>
7566  <tbody>
7567    <row>
7568      <entry>
7569<emphasis role='bold'>Solid</emphasis>
7570      </entry>
7571      <entry>Background</entry>
7572    </row>
7573    <row>
7574      <entry>
7575<emphasis role='bold'>Tiled</emphasis>
7576      </entry>
7577      <entry>Same as for even dashes</entry>
7578    </row>
7579    <row>
7580      <entry>
7581<emphasis role='bold'>OpaqueStippled</emphasis>
7582      </entry>
7583      <entry>Same as for even dashes</entry>
7584    </row>
7585    <row>
7586      <entry>
7587<emphasis role='bold'>Stippled</emphasis>
7588      </entry>
7589      <entry>Background masked by stipple</entry>
7590    </row>
7591  </tbody>
7592  </tgroup>
7593</informaltable>
7594
7595
7596<para>
7597The dashes value allowed here is actually a simplified form of the more
7598general patterns that can be set with
7599<link linkend="requests:SetDashes"><emphasis role='bold'>SetDashes</emphasis></link>.
7600Specifying a value of N here is equivalent to specifying
7601the two element list [N, N] in
7602<link linkend="requests:SetDashes"><emphasis role='bold'>SetDashes</emphasis></link>.
7603The value must be nonzero (or a
7604<emphasis role='bold'>Value</emphasis>
7605error results).
7606The meaning of dash-offset and dashes are explained in the
7607<link linkend="requests:SetDashes"><emphasis role='bold'>SetDashes</emphasis></link>
7608request.
7609</para>
7610<para id="requests:CreateGC:clip-mask">
7611<indexterm zone="requests:CreateGC:clip-mask"><primary>Clipping region</primary></indexterm>
7612The clip-mask restricts writes to the destination drawable.
7613Only pixels where the clip-mask has bits set to 1 are drawn.
7614Pixels are not drawn outside the area covered by the clip-mask
7615or where the clip-mask has bits set to 0.
7616The clip-mask affects all graphics requests,
7617but it does not clip sources.
7618The clip-mask origin is interpreted relative to the origin of whatever
7619destination drawable is specified in a graphics request.
7620If a pixmap is specified as the clip-mask,
7621it must have depth 1 and have the same root as the gcontext (or a
7622<emphasis role='bold'>Match</emphasis>
7623error results).
7624If clip-mask is
7625<emphasis role='bold'>None</emphasis>,
7626then pixels are always drawn, regardless of the clip origin.
7627The clip-mask can also be set with the
7628<link linkend="requests:SetClipRectangles"><emphasis role='bold'>SetClipRectangles</emphasis></link>
7629request.
7630</para>
7631<para>
7632For
7633<emphasis role='bold'>ClipByChildren</emphasis>,
7634both source and destination windows are additionally clipped by all viewable
7635<emphasis role='bold'>InputOutput</emphasis>
7636children.
7637For
7638<emphasis role='bold'>IncludeInferiors</emphasis>,
7639neither source nor destination window is clipped by inferiors.
7640This will result in including subwindow contents in the
7641source and drawing through subwindow boundaries of the destination.
7642The use of
7643<emphasis role='bold'>IncludeInferiors</emphasis>
7644with a source or destination window of one depth with mapped inferiors
7645of differing depth is not illegal,
7646but the semantics is undefined by the core protocol.
7647</para>
7648<para id="requests:CreateGC:fill-rule">
7649<indexterm zone="requests:CreateGC:fill-rule" significance="preferred"><primary>Winding rule</primary></indexterm>
7650<indexterm zone="requests:CreateGC:fill-rule" significance="preferred"><primary>Fill rule</primary></indexterm>
7651The fill-rule defines what pixels are inside (that is, are drawn) for
7652paths given in
7653<link linkend="requests:FillPoly"><emphasis role='bold'>FillPoly</emphasis></link>
7654requests.
7655<emphasis role='bold'>EvenOdd</emphasis>
7656means a point is inside if an infinite ray with the point as origin crosses
7657the path an odd number of times.
7658For
7659<emphasis role='bold'>Winding</emphasis>,
7660a point is inside if an infinite ray with the point as origin crosses an
7661unequal number of clockwise and counterclockwise directed path segments.
7662A clockwise directed path segment is one that crosses the ray from left
7663to right as observed from the point.
7664A counter-clockwise segment is one that crosses the ray from right to left
7665as observed from the point.
7666The case where a directed line segment is coincident with the ray is
7667uninteresting because one can simply choose a different ray that is not
7668coincident with a segment.
7669</para>
7670<para>
7671For both fill rules,
7672a point is infinitely small and the path is an infinitely thin line.
7673A pixel is inside if the center point of the pixel is inside
7674and the center point is not on the boundary.
7675If the center point is on the boundary,
7676the pixel is inside if and only if the polygon interior is immediately
7677to its right (x increasing direction).
7678Pixels with centers along a horizontal edge are a special case
7679and are inside if and only if the polygon interior is immediately below
7680(y increasing direction).
7681</para>
7682<para>
7683The arc-mode controls filling in the
7684<link linkend="requests:PolyFillArc"><emphasis role='bold'>PolyFillArc</emphasis></link>
7685request.
7686</para>
7687<para>
7688The graphics-exposures flag controls
7689<link linkend="events:GraphicsExposure"><emphasis role='bold'>GraphicsExposure</emphasis></link>
7690event generation for
7691<link linkend="requests:CopyArea"><emphasis role='bold'>CopyArea</emphasis></link>
7692and
7693<link linkend="requests:CopyPlane"><emphasis role='bold'>CopyPlane</emphasis></link>
7694requests (and any similar requests defined by extensions).
7695</para>
7696<para>
7697The default component values are:
7698</para>
7699
7700<informaltable frame='topbot'>
7701  <?dbfo keep-together="always" ?>
7702  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
7703  <colspec colname='c1' colwidth='1.0*'/>
7704  <colspec colname='c2' colwidth='2.0*'/>
7705  <thead>
7706    <row rowsep='1'>
7707      <entry>Component</entry>
7708      <entry>Default</entry>
7709    </row>
7710  </thead>
7711  <tbody>
7712    <row>
7713      <entry>function</entry>
7714      <entry>
7715<emphasis role='bold'>Copy</emphasis>
7716      </entry>
7717    </row>
7718    <row>
7719      <entry>plane-mask</entry>
7720      <entry>all ones</entry>
7721    </row>
7722    <row>
7723      <entry>foreground</entry>
7724      <entry>0</entry>
7725    </row>
7726    <row>
7727      <entry>background</entry>
7728      <entry>1</entry>
7729    </row>
7730    <row>
7731      <entry>line-width</entry>
7732      <entry>0</entry>
7733    </row>
7734    <row>
7735      <entry>line-style</entry>
7736      <entry><emphasis role='bold'>Solid</emphasis></entry>
7737    </row>
7738    <row>
7739      <entry>cap-style</entry>
7740      <entry><emphasis role='bold'>Butt</emphasis></entry>
7741    </row>
7742    <row>
7743      <entry>join-style</entry>
7744      <entry><emphasis role='bold'>Miter</emphasis></entry>
7745    </row>
7746    <row>
7747      <entry>fill-style</entry>
7748      <entry><emphasis role='bold'>Solid</emphasis></entry>
7749    </row>
7750    <row>
7751      <entry>fill-rule</entry>
7752      <entry><emphasis role='bold'>EvenOdd</emphasis></entry>
7753    </row>
7754    <row>
7755      <entry>arc-mode</entry>
7756      <entry><emphasis role='bold'>PieSlice</emphasis></entry>
7757    </row>
7758    <row>
7759      <entry>tile</entry>
7760      <entry>
7761<para>
7762Pixmap of unspecified size filled with foreground pixel
7763</para>
7764<para>
7765(that is, client specified pixel if any, else 0)
7766</para>
7767<para>
7768(subsequent changes to foreground do not affect this pixmap)
7769</para>
7770      </entry>
7771    </row>
7772    <row>
7773      <entry>stipple</entry>
7774      <entry>
7775Pixmap of unspecified size filled with ones
7776      </entry>
7777    </row>
7778    <row>
7779      <entry>tile-stipple-x-origin</entry>
7780      <entry>0</entry>
7781    </row>
7782    <row>
7783      <entry>tile-stipple-y-origin</entry>
7784      <entry>0</entry>
7785    </row>
7786    <row>
7787      <entry>font</entry>
7788      <entry>&lt;server-dependent-font&gt;</entry>
7789    </row>
7790    <row>
7791      <entry>subwindow-mode</entry>
7792      <entry>
7793<emphasis role='bold'>ClipByChildren</emphasis>
7794      </entry>
7795    </row>
7796    <row>
7797      <entry>graphics-exposures</entry>
7798      <entry>
7799<emphasis role='bold'>True</emphasis>
7800      </entry>
7801    </row>
7802    <row>
7803      <entry>clip-x-origin</entry>
7804      <entry>0</entry>
7805    </row>
7806    <row>
7807      <entry>clip-y-origin</entry>
7808      <entry>0</entry>
7809    </row>
7810    <row>
7811      <entry>clip-mask</entry>
7812      <entry>
7813<emphasis role='bold'>None</emphasis>
7814      </entry>
7815    </row>
7816    <row>
7817      <entry>dash-offset</entry>
7818      <entry>0</entry>
7819    </row>
7820    <row>
7821      <entry>dashes</entry>
7822      <entry>4 (that is, the list [4, 4])</entry>
7823    </row>
7824  </tbody>
7825  </tgroup>
7826</informaltable>
7827
7828<para>
7829Storing a pixmap in a gcontext might or might not result in a copy
7830being made.
7831If the pixmap is later used as the destination for a graphics request,
7832the change might or might not be reflected in the gcontext.
7833If the pixmap is used simultaneously in a graphics request
7834as both a destination and as a tile or stipple,
7835the results are not defined.
7836</para>
7837<para>
7838It is quite likely that some amount of gcontext information will be
7839cached in display hardware and that such hardware can only cache a
7840small number of gcontexts.
7841Given the number and complexity of components,
7842clients should view switching between gcontexts with nearly
7843identical state as significantly more expensive than making minor
7844changes to a single gcontext.
7845<!-- .sp -->
7846</para>
7847  </section>
7848  <section id="requests:ChangeGC">
7849    <title>ChangeGC</title>
7850    <indexterm zone="requests:ChangeGC" significance="preferred"><primary>ChangeGC</primary></indexterm>
7851<informaltable frame='none'>
7852  <?dbfo keep-together="always" ?>
7853  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
7854  <colspec colname='c1' colwidth='1.0*'/>
7855  <tbody>
7856    <row>
7857      <entry>
7858<!-- .in +.2i -->
7859<emphasis remap='I'>gc</emphasis>: GCONTEXT
7860      </entry>
7861    </row>
7862    <row>
7863      <entry>
7864<emphasis remap='I'>value-mask</emphasis>: BITMASK
7865      </entry>
7866    </row>
7867    <row>
7868      <entry>
7869<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
7870<!-- .in -.2i -->
7871      </entry>
7872    </row>
7873    <row>
7874      <entry>
7875<!-- .in +.2i -->
7876Errors:
7877<emphasis role='bold'>Alloc</emphasis>,
7878<emphasis role='bold'>Font</emphasis>,
7879<emphasis role='bold'>GContext</emphasis>,
7880<emphasis role='bold'>Match</emphasis>,
7881<emphasis role='bold'>Pixmap</emphasis>,
7882<emphasis role='bold'>Value</emphasis>
7883<!-- .in -.2i -->
7884<!-- .eM -->
7885      </entry>
7886    </row>
7887  </tbody>
7888  </tgroup>
7889</informaltable>
7890<!-- .eM -->
7891<para>
7892This request changes components in gc.
7893The value-mask and value-list specify which components are to be changed.
7894The values and restrictions are the same
7895as for
7896<link linkend="requests:CreateGC"><emphasis role='bold'>CreateGC</emphasis></link>.
7897</para>
7898<para>
7899Changing the clip-mask also overrides any previous
7900<link linkend="requests:SetClipRectangles"><emphasis role='bold'>SetClipRectangles</emphasis></link>
7901request on the context.
7902Changing dash-offset or dashes overrides any previous
7903<link linkend="requests:SetDashes"><emphasis role='bold'>SetDashes</emphasis></link>
7904request on the context.
7905</para>
7906<para>
7907The order in which components are verified and altered is server-dependent.
7908If an error is generated,
7909a subset of the components may have been altered.
7910<!-- .sp -->
7911</para>
7912  </section>
7913  <section id="requests:CopyGC">
7914    <title>CopyGC</title>
7915    <indexterm zone="requests:CopyGC" significance="preferred"><primary>CopyGC</primary></indexterm>
7916<informaltable frame='none'>
7917  <?dbfo keep-together="always" ?>
7918  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
7919  <colspec colname='c1' colwidth='1.0*'/>
7920  <tbody>
7921    <row>
7922      <entry>
7923<!-- .in +.2i -->
7924<emphasis remap='I'>src-gc</emphasis>, <emphasis remap='I'>dst-gc</emphasis>: GCONTEXT
7925      </entry>
7926    </row>
7927    <row>
7928      <entry>
7929<emphasis remap='I'>value-mask</emphasis>: BITMASK
7930<!-- .in -.2i -->
7931      </entry>
7932    </row>
7933    <row>
7934      <entry>
7935<!-- .in +.2i -->
7936Errors:
7937<emphasis role='bold'>Alloc</emphasis>,
7938<emphasis role='bold'>GContext</emphasis>,
7939<emphasis role='bold'>Match</emphasis>,
7940<emphasis role='bold'>Value</emphasis>
7941<!-- .in -.2i -->
7942<!-- .eM -->
7943      </entry>
7944    </row>
7945  </tbody>
7946  </tgroup>
7947</informaltable>
7948<!-- .eM -->
7949<para>
7950This request copies components from src-gc to dst-gc.
7951The value-mask specifies which components to copy, as for
7952<link linkend="requests:CreateGC"><emphasis role='bold'>CreateGC</emphasis></link>.
7953The two gcontexts must have the same root and the same depth (or a
7954<emphasis role='bold'>Match</emphasis>
7955error results).
7956<!-- .sp -->
7957</para>
7958  </section>
7959  <section id="requests:SetDashes">
7960    <title>SetDashes</title>
7961    <indexterm zone="requests:SetDashes" significance="preferred"><primary>SetDashes</primary></indexterm>
7962<informaltable frame='none'>
7963  <?dbfo keep-together="always" ?>
7964  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
7965  <colspec colname='c1' colwidth='1.0*'/>
7966  <tbody>
7967    <row>
7968      <entry>
7969<!-- .in +.2i -->
7970<emphasis remap='I'>gc</emphasis>: GCONTEXT
7971      </entry>
7972    </row>
7973    <row>
7974      <entry>
7975<emphasis remap='I'>dash-offset</emphasis>: CARD16
7976      </entry>
7977    </row>
7978    <row>
7979      <entry>
7980<emphasis remap='I'>dashes</emphasis>: LISTofCARD8
7981<!-- .in -.2i -->
7982      </entry>
7983    </row>
7984    <row>
7985      <entry>
7986<!-- .in +.2i -->
7987Errors:
7988<emphasis role='bold'>Alloc</emphasis>,
7989<emphasis role='bold'>GContext</emphasis>,
7990<emphasis role='bold'>Value</emphasis>
7991<!-- .in -.2i -->
7992<!-- .eM -->
7993      </entry>
7994    </row>
7995  </tbody>
7996  </tgroup>
7997</informaltable>
7998<!-- .eM -->
7999<para>
8000This request sets dash-offset and dashes in gc for dashed line styles.
8001Dashes cannot be empty (or a
8002<emphasis role='bold'>Value</emphasis>
8003error results).
8004Specifying an odd-length list is equivalent to specifying the same list
8005concatenated with itself to produce an even-length list.
8006The initial and alternating elements of dashes are the even dashes;
8007the others are the odd dashes.
8008Each element specifies a dash length in pixels.
8009All of the elements must be nonzero (or a
8010<emphasis role='bold'>Value</emphasis>
8011error results).
8012The dash-offset defines the phase of the pattern,
8013specifying how many pixels into dashes the pattern should actually begin in
8014any single graphics request.
8015Dashing is continuous through path elements combined with a join-style
8016but is reset to the dash-offset between each sequence of joined lines.
8017</para>
8018<para>
8019The unit of measure for dashes is the same as in the ordinary
8020coordinate system.
8021Ideally, a dash length is measured along the slope of the line,
8022but implementations are only required to match this ideal
8023for horizontal and vertical lines.
8024Failing the ideal semantics,
8025it is suggested that the length be measured along the major axis of the line.
8026The major axis is defined as the x axis for lines drawn at an angle of
8027between -45 and +45 degrees or between 135 and 225 degrees from the x axis.
8028For all other lines, the major axis is the y axis.
8029</para>
8030<para>
8031For any graphics primitive, the computation of the endpoint of an individual
8032dash only depends on the geometry of the primitive, the start position
8033of the dash, the direction of the dash, and the dash length.
8034</para>
8035<para>
8036For any graphics primitive, the total set of pixels used to render the
8037primitive (both even and odd numbered dash elements) with
8038<emphasis role='bold'>DoubleDash</emphasis>
8039line-style is the same as the set of pixels used to render the
8040primitive with
8041<emphasis role='bold'>Solid</emphasis>
8042line-style.
8043</para>
8044<para>
8045For any graphics primitive, if the primitive is drawn with
8046<emphasis role='bold'>OnOffDash</emphasis>
8047or
8048<emphasis role='bold'>DoubleDash</emphasis>
8049line-style unclipped at position [x,y] and again at position
8050[x+dx,y+dy], then a point [x1,y1] is included in a dash in the first
8051instance if and only if the point [x1+dx,y1+dy] is included in the dash in
8052the second instance.  In addition, the effective set of points comprising a
8053dash cannot be affected by clipping.  A point is included in a clipped dash
8054if and only if the point lies inside the clipping region and the point
8055would be included in the dash when drawn unclipped.
8056<!-- .sp -->
8057</para>
8058  </section>
8059  <section id="requests:SetClipRectangles">
8060    <title>SetClipRectangles</title>
8061    <indexterm zone="requests:SetClipRectangles" significance="preferred"><primary>SetClipRectangles</primary></indexterm>
8062<informaltable frame='none'>
8063  <?dbfo keep-together="always" ?>
8064  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8065  <colspec colname='c1' colwidth='1.0*'/>
8066  <tbody>
8067    <row>
8068      <entry>
8069<!-- .in +.2i -->
8070<emphasis remap='I'>gc</emphasis>: GCONTEXT
8071      </entry>
8072    </row>
8073    <row>
8074      <entry>
8075<emphasis remap='I'>clip-x-origin</emphasis>, <emphasis remap='I'>clip-y-origin</emphasis>: INT16
8076      </entry>
8077    </row>
8078    <row>
8079      <entry>
8080<emphasis remap='I'>rectangles</emphasis>: LISTofRECTANGLE
8081      </entry>
8082    </row>
8083    <row>
8084      <entry>
8085<emphasis remap='I'>ordering</emphasis>:
8086{ <emphasis role='bold'>UnSorted</emphasis>,
8087<emphasis role='bold'>YSorted</emphasis>,
8088<emphasis role='bold'>YXSorted</emphasis>,
8089<emphasis role='bold'>YXBanded</emphasis>}
8090<!-- .in -.2i -->
8091      </entry>
8092    </row>
8093    <row>
8094      <entry>
8095<!-- .in +.2i -->
8096Errors:
8097<emphasis role='bold'>Alloc</emphasis>,
8098<emphasis role='bold'>GContext</emphasis>,
8099<emphasis role='bold'>Match</emphasis>,
8100<emphasis role='bold'>Value</emphasis>
8101<!-- .in -.2i -->
8102<!-- .eM -->
8103      </entry>
8104    </row>
8105  </tbody>
8106  </tgroup>
8107</informaltable>
8108<!-- .eM -->
8109<para>
8110This request changes clip-mask in gc to the specified list of rectangles
8111and sets the clip origin.
8112Output will be clipped to remain contained within the rectangles.
8113The clip origin is interpreted relative to the origin of
8114whatever destination drawable is specified in a graphics request.
8115The rectangle coordinates are interpreted relative to the clip origin.
8116The rectangles should be nonintersecting, or graphics results will be
8117undefined.
8118Note that the list of rectangles can be empty,
8119which effectively disables output.
8120This is the opposite of passing
8121<emphasis role='bold'>None</emphasis>
8122as the clip-mask in
8123<link linkend="requests:CreateGC"><emphasis role='bold'>CreateGC</emphasis></link>
8124and
8125<link linkend="requests:ChangeGC"><emphasis role='bold'>ChangeGC</emphasis></link>.
8126</para>
8127<para>
8128If known by the client,
8129ordering relations on the rectangles can be specified with the ordering
8130argument.
8131This may provide faster operation by the server.
8132If an incorrect ordering is specified,
8133the server may generate a
8134<emphasis role='bold'>Match</emphasis>
8135error, but it is not required to do so.
8136If no error is generated,
8137the graphics results are undefined.
8138<emphasis role='bold'>UnSorted</emphasis>
8139means that the rectangles are in arbitrary order.
8140<emphasis role='bold'>YSorted</emphasis>
8141means that the rectangles are nondecreasing in their Y origin.
8142<emphasis role='bold'>YXSorted</emphasis>
8143additionally constrains
8144<emphasis role='bold'>YSorted</emphasis>
8145order in that all rectangles with an equal Y origin are
8146nondecreasing in their X origin.
8147<emphasis role='bold'>YXBanded</emphasis>
8148additionally constrains
8149<emphasis role='bold'>YXSorted</emphasis>
8150by requiring that, for every possible Y scanline,
8151all rectangles that include that scanline have identical Y origins and Y
8152extents.
8153<!-- .sp -->
8154</para>
8155  </section>
8156  <section id="requests:FreeGC">
8157    <title>FreeGC</title>
8158    <indexterm zone="requests:FreeGC" significance="preferred"><primary>FreeGC</primary></indexterm>
8159<informaltable frame='none'>
8160  <?dbfo keep-together="always" ?>
8161  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8162  <colspec colname='c1' colwidth='1.0*'/>
8163  <tbody>
8164    <row>
8165      <entry>
8166<!-- .in +.2i -->
8167<emphasis remap='I'>gc</emphasis>: GCONTEXT
8168<!-- .in -.2i -->
8169      </entry>
8170    </row>
8171    <row>
8172      <entry>
8173<!-- .in +.2i -->
8174Errors:
8175<emphasis role='bold'>GContext</emphasis>
8176<!-- .in -.2i -->
8177<!-- .eM -->
8178      </entry>
8179    </row>
8180  </tbody>
8181  </tgroup>
8182</informaltable>
8183<!-- .eM -->
8184<para>
8185This request deletes the association between the resource ID and the gcontext
8186and destroys the gcontext.
8187<!-- .sp -->
8188</para>
8189  </section>
8190  <section id="requests:ClearArea">
8191    <title>ClearArea</title>
8192    <indexterm zone="requests:ClearArea" significance="preferred"><primary>ClearArea</primary></indexterm>
8193    <indexterm zone="requests:ClearArea"><primary>Background</primary></indexterm><informaltable frame='none'>
8194  <?dbfo keep-together="always" ?>
8195  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8196  <colspec colname='c1' colwidth='1.0*'/>
8197  <tbody>
8198    <row>
8199      <entry>
8200<!-- .in +.2i -->
8201<emphasis remap='I'>window</emphasis>: WINDOW
8202      </entry>
8203    </row>
8204    <row>
8205      <entry>
8206<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
8207      </entry>
8208    </row>
8209    <row>
8210      <entry>
8211<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
8212      </entry>
8213    </row>
8214    <row>
8215      <entry>
8216<emphasis remap='I'>exposures</emphasis>: BOOL
8217<!-- .in -.2i -->
8218      </entry>
8219    </row>
8220    <row>
8221      <entry>
8222<!-- .in +.2i -->
8223Errors:
8224<emphasis role='bold'>Match</emphasis>,
8225<emphasis role='bold'>Value</emphasis>,
8226<emphasis role='bold'>Window</emphasis>
8227<!-- .in -.2i -->
8228<!-- .eM -->
8229      </entry>
8230    </row>
8231  </tbody>
8232  </tgroup>
8233</informaltable>
8234<!-- .eM -->
8235<para>
8236The x and y coordinates are relative to the window's origin
8237and specify the upper-left corner of the rectangle.
8238If width is zero,
8239it is replaced with the current width of the window minus x.
8240If height is zero,
8241it is replaced with the current height of the window minus y.
8242If the window has a defined background tile,
8243the rectangle is tiled with a plane-mask of all ones and function of
8244<emphasis role='bold'>Copy</emphasis>
8245and a subwindow-mode of
8246<emphasis role='bold'>ClipByChildren</emphasis>.
8247If the window has background
8248<emphasis role='bold'>None</emphasis>,
8249the contents of the window are not changed.
8250In either case,
8251if exposures is
8252<emphasis role='bold'>True</emphasis>,
8253then one or more exposure events are generated for regions of the rectangle
8254that are either visible or are being retained in a backing store.
8255</para>
8256<para>
8257It is a
8258<emphasis role='bold'>Match</emphasis>
8259error to use an
8260<emphasis role='bold'>InputOnly</emphasis>
8261window in this request.
8262<!-- .sp -->
8263</para>
8264  </section>
8265  <section id="requests:CopyArea">
8266    <title>CopyArea</title>
8267    <indexterm zone="requests:CopyArea" significance="preferred"><primary>CopyArea</primary></indexterm>
8268<informaltable frame='none'>
8269  <?dbfo keep-together="always" ?>
8270  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8271  <colspec colname='c1' colwidth='1.0*'/>
8272  <tbody>
8273    <row>
8274      <entry>
8275<!-- .in +.2i -->
8276<emphasis remap='I'>src-drawable</emphasis>, <emphasis remap='I'>dst-drawable</emphasis>: DRAWABLE
8277      </entry>
8278    </row>
8279    <row>
8280      <entry>
8281<emphasis remap='I'>gc</emphasis>: GCONTEXT
8282      </entry>
8283    </row>
8284    <row>
8285      <entry>
8286<emphasis remap='I'>src-x</emphasis>, <emphasis remap='I'>src-y</emphasis>: INT16
8287      </entry>
8288    </row>
8289    <row>
8290      <entry>
8291<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
8292      </entry>
8293    </row>
8294    <row>
8295      <entry>
8296<emphasis remap='I'>dst-x</emphasis>, <emphasis remap='I'>dst-y</emphasis>: INT16
8297<!-- .in -.2i -->
8298      </entry>
8299    </row>
8300    <row>
8301      <entry>
8302<!-- .in +.2i -->
8303Errors:
8304<emphasis role='bold'>Drawable</emphasis>,
8305<emphasis role='bold'>GContext</emphasis>,
8306<emphasis role='bold'>Match</emphasis>
8307<!-- .in -.2i -->
8308<!-- .eM -->
8309      </entry>
8310    </row>
8311  </tbody>
8312  </tgroup>
8313</informaltable>
8314<!-- .eM -->
8315<para>
8316This request combines the specified rectangle of src-drawable with the
8317specified rectangle of dst-drawable.
8318The src-x and src-y coordinates are relative to src-drawable's origin.
8319The dst-x and dst-y are relative to dst-drawable's origin,
8320each pair specifying the upper-left corner of the rectangle.
8321The src-drawable must have the same root and the same depth
8322as dst-drawable (or a
8323<emphasis role='bold'>Match</emphasis>
8324error results).
8325</para>
8326<para>
8327If regions of the source rectangle are obscured and have not been retained
8328in backing store
8329or if regions outside the boundaries of the source drawable are specified,
8330then those regions are not copied,
8331but the following occurs on all corresponding destination regions that are
8332either visible or are retained in backing-store.
8333If the dst-drawable is a window with a background other than
8334<emphasis role='bold'>None</emphasis>,
8335these corresponding destination regions are tiled
8336(with plane-mask of all ones and function
8337<emphasis role='bold'>Copy</emphasis>)
8338with that background.
8339Regardless of tiling and whether the destination is a window or a pixmap,
8340if graphics-exposures in gc is
8341<emphasis role='bold'>True</emphasis>,
8342then
8343<link linkend="events:GraphicsExposure"><emphasis role='bold'>GraphicsExposure</emphasis></link>
8344events for all corresponding destination regions are generated.
8345</para>
8346<para>
8347If graphics-exposures is
8348<emphasis role='bold'>True</emphasis>
8349but no
8350<emphasis role='bold'>GraphicsExposure</emphasis>
8351events are generated,
8352then a
8353<link linkend="events:NoExposure"><emphasis role='bold'>NoExposure</emphasis></link>
8354event is generated.
8355</para>
8356<para>
8357GC components: function, plane-mask, subwindow-mode,
8358graphics-exposures, clip-x-origin, clip-y-origin, clip-mask
8359<!-- .sp -->
8360</para>
8361  </section>
8362  <section id="requests:CopyPlane">
8363    <title>CopyPlane</title>
8364    <indexterm zone="requests:CopyPlane" significance="preferred"><primary>CopyPlane</primary></indexterm>
8365<informaltable frame='none'>
8366  <?dbfo keep-together="always" ?>
8367  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8368  <colspec colname='c1' colwidth='1.0*'/>
8369  <tbody>
8370    <row>
8371      <entry>
8372<!-- .in +.2i -->
8373<emphasis remap='I'>src-drawable</emphasis>, <emphasis remap='I'>dst-drawable</emphasis>: DRAWABLE
8374      </entry>
8375    </row>
8376    <row>
8377      <entry>
8378<emphasis remap='I'>gc</emphasis>: GCONTEXT
8379      </entry>
8380    </row>
8381    <row>
8382      <entry>
8383<emphasis remap='I'>src-x</emphasis>, <emphasis remap='I'>src-y</emphasis>: INT16
8384      </entry>
8385    </row>
8386    <row>
8387      <entry>
8388<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
8389      </entry>
8390    </row>
8391    <row>
8392      <entry>
8393<emphasis remap='I'>dst-x</emphasis>, <emphasis remap='I'>dst-y</emphasis>: INT16
8394      </entry>
8395    </row>
8396    <row>
8397      <entry>
8398<emphasis remap='I'>bit-plane</emphasis>: CARD32
8399<!-- .in -.2i -->
8400      </entry>
8401    </row>
8402    <row>
8403      <entry>
8404<!-- .in +.2i -->
8405Errors:
8406<emphasis role='bold'>Drawable</emphasis>,
8407<emphasis role='bold'>GContext</emphasis>,
8408<emphasis role='bold'>Match</emphasis>,
8409<emphasis role='bold'>Value</emphasis>
8410<!-- .in -.2i -->
8411<!-- .eM -->
8412      </entry>
8413    </row>
8414  </tbody>
8415  </tgroup>
8416</informaltable>
8417<!-- .eM -->
8418<para>
8419The src-drawable must have the same root as dst-drawable (or a
8420<emphasis role='bold'>Match</emphasis>
8421error results), but it need not have the same depth.
8422The bit-plane must have exactly one bit set to 1 and the value of bit-plane
8423must be less than %2 sup n% where <emphasis remap='I'>n</emphasis> is the depth of src-drawable (or a
8424<emphasis role='bold'>Value</emphasis>
8425error results).
8426Effectively, a pixmap of the same depth as dst-drawable and with size specified
8427by the source region is formed using the foreground/background pixels in gc
8428(foreground everywhere the bit-plane in src-drawable contains a bit set to 1,
8429background everywhere the bit-plane contains a bit set to 0),
8430and the equivalent of a
8431<link linkend="requests:CopyArea"><emphasis role='bold'>CopyArea</emphasis></link>
8432is performed, with all the same exposure semantics.
8433This can also be thought of as using the specified region of the source
8434bit-plane as a stipple with a fill-style of
8435<emphasis role='bold'>OpaqueStippled</emphasis>
8436for filling a rectangular area of the destination.
8437</para>
8438<para>
8439GC components: function, plane-mask, foreground, background,
8440subwindow-mode, graphics-exposures, clip-x-origin, clip-y-origin,
8441clip-mask
8442<!-- .sp -->
8443</para>
8444  </section>
8445  <section id="requests:PolyPoint">
8446    <title>PolyPoint</title>
8447    <indexterm zone="requests:PolyPoint" significance="preferred"><primary>PolyPoint</primary></indexterm>
8448<informaltable frame='none'>
8449  <?dbfo keep-together="always" ?>
8450  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8451  <colspec colname='c1' colwidth='1.0*'/>
8452  <tbody>
8453    <row>
8454      <entry>
8455<!-- .in +.2i -->
8456<emphasis remap='I'>drawable</emphasis>: DRAWABLE
8457      </entry>
8458    </row>
8459    <row>
8460      <entry>
8461<emphasis remap='I'>gc</emphasis>: GCONTEXT
8462      </entry>
8463    </row>
8464    <row>
8465      <entry>
8466<emphasis remap='I'>coordinate-mode</emphasis>:
8467{ <emphasis role='bold'>Origin</emphasis>,
8468<emphasis role='bold'>Previous</emphasis>}
8469      </entry>
8470    </row>
8471    <row>
8472      <entry>
8473<emphasis remap='I'>points</emphasis>: LISTofPOINT
8474<!-- .in -.2i -->
8475      </entry>
8476    </row>
8477    <row>
8478      <entry>
8479<!-- .in +.2i -->
8480Errors:
8481<emphasis role='bold'>Drawable</emphasis>,
8482<emphasis role='bold'>GContext</emphasis>,
8483<emphasis role='bold'>Match</emphasis>,
8484<emphasis role='bold'>Value</emphasis>
8485<!-- .in -.2i -->
8486<!-- .eM -->
8487      </entry>
8488    </row>
8489  </tbody>
8490  </tgroup>
8491</informaltable>
8492<!-- .eM -->
8493<para>
8494This request combines the foreground pixel in gc with the pixel
8495at each point in the drawable.
8496The points are drawn in the order listed.
8497</para>
8498<para>
8499The first point is always relative to the drawable's origin.
8500The rest are relative either to that origin or the previous point,
8501depending on the coordinate-mode.
8502</para>
8503<para>
8504GC components: function, plane-mask, foreground, subwindow-mode,
8505clip-x-origin, clip-y-origin, clip-mask
8506<!-- .sp -->
8507</para>
8508  </section>
8509  <section id="requests:PolyLine">
8510    <title>PolyLine</title>
8511    <indexterm zone="requests:PolyLine" significance="preferred"><primary>PolyLine</primary></indexterm>
8512    <indexterm zone="requests:PolyLine"><primary>Line</primary><secondary>drawing</secondary></indexterm>
8513<informaltable frame='none'>
8514  <?dbfo keep-together="always" ?>
8515  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8516  <colspec colname='c1' colwidth='1.0*'/>
8517  <tbody>
8518    <row>
8519      <entry>
8520<!-- .in +.2i -->
8521<emphasis remap='I'>drawable</emphasis>: DRAWABLE
8522      </entry>
8523    </row>
8524    <row>
8525      <entry>
8526<emphasis remap='I'>gc</emphasis>: GCONTEXT
8527      </entry>
8528    </row>
8529    <row>
8530      <entry>
8531<emphasis remap='I'>coordinate-mode</emphasis>:
8532{ <emphasis role='bold'>Origin</emphasis>,
8533<emphasis role='bold'>Previous</emphasis>}
8534      </entry>
8535    </row>
8536    <row>
8537      <entry>
8538<emphasis remap='I'>points</emphasis>: LISTofPOINT
8539<!-- .in -.2i -->
8540      </entry>
8541    </row>
8542    <row>
8543      <entry>
8544<!-- .in +.2i -->
8545Errors:
8546<emphasis role='bold'>Drawable</emphasis>,
8547<emphasis role='bold'>GContext</emphasis>,
8548<emphasis role='bold'>Match</emphasis>,
8549<emphasis role='bold'>Value</emphasis>
8550<!-- .in -.2i -->
8551<!-- .eM -->
8552      </entry>
8553    </row>
8554  </tbody>
8555  </tgroup>
8556</informaltable>
8557<!-- .eM -->
8558<para>
8559This request draws lines between each pair of points (point[i], point[i+1]).
8560The lines are drawn in the order listed.
8561The lines join correctly at all intermediate points,
8562and if the first and last points coincide,
8563the first and last lines also join correctly.
8564</para>
8565<para>
8566For any given line,
8567no pixel is drawn more than once.
8568If thin (zero line-width) lines intersect,
8569the intersecting pixels are drawn multiple times.
8570If wide lines intersect,
8571the intersecting pixels are drawn only once, as though the entire
8572<emphasis role='bold'>PolyLine</emphasis>
8573were a single filled shape.
8574</para>
8575<para>
8576The first point is always relative to the drawable's origin.
8577The rest are relative either to that origin or the previous point,
8578depending on the coordinate-mode.
8579</para>
8580<para>
8581When either of the two lines involved in a
8582<emphasis role='bold'>Bevel</emphasis>
8583join is neither vertical
8584nor horizontal, then the slope and position of the line segment defining
8585the bevel join edge is implementation dependent.  However, the computation
8586of the slope and distance (relative to the join point) only depends on
8587the line width and the slopes of the two lines.
8588</para>
8589<para>
8590GC components: function, plane-mask, line-width, line-style,
8591cap-style, join-style, fill-style, subwindow-mode, clip-x-origin,
8592clip-y-origin, clip-mask
8593</para>
8594<para>
8595GC mode-dependent components: foreground, background, tile, stipple,
8596tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dashes
8597<!-- .sp -->
8598</para>
8599  </section>
8600  <section id="requests:PolySegment">
8601    <title>PolySegment</title>
8602    <indexterm zone="requests:PolySegment" significance="preferred"><primary>PolySegment</primary></indexterm>
8603<informaltable frame='none'>
8604  <?dbfo keep-together="always" ?>
8605  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8606  <colspec colname='c1' colwidth='1.0*'/>
8607  <tbody>
8608    <row>
8609      <entry>
8610<!-- .in +.2i -->
8611<emphasis remap='I'>drawable</emphasis>: DRAWABLE
8612      </entry>
8613    </row>
8614    <row>
8615      <entry>
8616<emphasis remap='I'>gc</emphasis>: GCONTEXT
8617      </entry>
8618    </row>
8619    <row>
8620      <entry>
8621<emphasis remap='I'>segments</emphasis>: LISTofSEGMENT
8622<!-- .in -.2i -->
8623      </entry>
8624    </row>
8625    <row>
8626      <entry>
8627<!-- .in +.2i -->
8628where:
8629<!-- .in -.2i -->
8630      </entry>
8631    </row>
8632    <row>
8633      <entry>
8634<!-- .in +.2i -->
8635SEGMENT: [x1, y1, x2, y2: INT16]
8636<!-- .in -.2i -->
8637      </entry>
8638    </row>
8639    <row>
8640      <entry>
8641<!-- .in +.2i -->
8642Errors:
8643<emphasis role='bold'>Drawable</emphasis>,
8644<emphasis role='bold'>GContext</emphasis>,
8645<emphasis role='bold'>Match</emphasis>
8646<!-- .in -.2i -->
8647<!-- .eM -->
8648      </entry>
8649    </row>
8650  </tbody>
8651  </tgroup>
8652</informaltable>
8653<!-- .eM -->
8654<para>
8655For each segment,
8656this request draws a line between [x1, y1] and [x2, y2].
8657The lines are drawn in the order listed.
8658No joining is performed at coincident endpoints.
8659For any given line,
8660no pixel is drawn more than once.
8661If lines intersect,
8662the intersecting pixels are drawn multiple times.
8663</para>
8664<para>
8665GC components: function, plane-mask, line-width, line-style,
8666cap-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin,
8667clip-mask
8668</para>
8669<para>
8670GC mode-dependent components: foreground, background, tile, stipple,
8671tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dashes
8672<!-- .sp -->
8673</para>
8674  </section>
8675  <section id="requests:PolyRectangle">
8676    <title>PolyRectangle</title>
8677    <indexterm zone="requests:PolyRectangle" significance="preferred"><primary>PolyRectangle</primary></indexterm>
8678<informaltable frame='none'>
8679  <?dbfo keep-together="always" ?>
8680  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8681  <colspec colname='c1' colwidth='1.0*'/>
8682  <tbody>
8683    <row>
8684      <entry>
8685<!-- .in +.2i -->
8686<emphasis remap='I'>drawable</emphasis>: DRAWABLE
8687      </entry>
8688    </row>
8689    <row>
8690      <entry>
8691<emphasis remap='I'>gc</emphasis>: GCONTEXT
8692      </entry>
8693    </row>
8694    <row>
8695      <entry>
8696<emphasis remap='I'>rectangles</emphasis>: LISTofRECTANGLE
8697<!-- .in -.2i -->
8698      </entry>
8699    </row>
8700    <row>
8701      <entry>
8702<!-- .in +.2i -->
8703Errors:
8704<emphasis role='bold'>Drawable</emphasis>,
8705<emphasis role='bold'>GContext</emphasis>,
8706<emphasis role='bold'>Match</emphasis>
8707<!-- .in -.2i -->
8708<!-- .eM -->
8709      </entry>
8710    </row>
8711  </tbody>
8712  </tgroup>
8713</informaltable>
8714<!-- .eM -->
8715<para>
8716This request draws the outlines of the specified rectangles, as if a five-point
8717<link linkend="requests:PolyLine"><emphasis role='bold'>PolyLine</emphasis></link>
8718were specified for each rectangle:
8719</para>
8720<para>
8721<literallayout class="monospaced">
8722	[x,y] [x+width,y] [x+width,y+height] [x,y+height] [x,y]
8723</literallayout>
8724</para>
8725<para>
8726The x and y coordinates of each rectangle are relative to the drawable's origin
8727and define the upper-left corner of the rectangle.
8728</para>
8729<para>
8730The rectangles are drawn in the order listed.
8731For any given rectangle,
8732no pixel is drawn more than once.
8733If rectangles intersect,
8734the intersecting pixels are drawn multiple times.
8735</para>
8736<para>
8737GC components: function, plane-mask, line-width, line-style,
8738cap-style, join-style, fill-style, subwindow-mode, clip-x-origin,
8739clip-y-origin, clip-mask
8740</para>
8741<para>
8742GC mode-dependent components: foreground, background, tile, stipple,
8743tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dashes
8744<!-- .sp -->
8745</para>
8746  </section>
8747  <section id="requests:PolyArc">
8748    <title>PolyArc</title>
8749    <indexterm zone="requests:PolyArc" significance="preferred"><primary>PolyArc</primary></indexterm>
8750<informaltable frame='none'>
8751  <?dbfo keep-together="always" ?>
8752  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8753  <colspec colname='c1' colwidth='1.0*'/>
8754  <tbody>
8755    <row>
8756      <entry>
8757<!-- .in +.2i -->
8758<emphasis remap='I'>drawable</emphasis>: DRAWABLE
8759      </entry>
8760    </row>
8761    <row>
8762      <entry>
8763<emphasis remap='I'>gc</emphasis>: GCONTEXT
8764      </entry>
8765    </row>
8766    <row>
8767      <entry>
8768<emphasis remap='I'>arcs</emphasis>: LISTofARC
8769<!-- .in -.2i -->
8770      </entry>
8771    </row>
8772    <row>
8773      <entry>
8774<!-- .in +.2i -->
8775Errors:
8776<emphasis role='bold'>Drawable</emphasis>,
8777<emphasis role='bold'>GContext</emphasis>,
8778<emphasis role='bold'>Match</emphasis>
8779<!-- .in -.2i -->
8780<!-- .eM -->
8781      </entry>
8782    </row>
8783  </tbody>
8784  </tgroup>
8785</informaltable>
8786<!-- .eM -->
8787<para>
8788This request draws circular or elliptical arcs.
8789Each arc is specified by a rectangle and two angles.
8790The angles are signed integers in degrees scaled by 64,
8791with positive indicating counterclockwise motion and
8792negative indicating clockwise motion.
8793The start of the arc is specified by angle1 relative to the three-o'clock
8794position from the center of the rectangle,
8795and the path and extent of the arc is specified by angle2 relative to the
8796start of the arc.
8797If the magnitude of angle2 is greater than 360 degrees,
8798it is truncated to 360 degrees.
8799The x and y coordinates of the rectangle are relative to the origin of
8800the drawable.
8801For an arc specified as [x,y,w,h,a1,a2],
8802the origin of the major and minor axes is at [x+(w/2),y+(h/2)],
8803and the infinitely thin path describing the entire circle/ellipse intersects
8804the horizontal axis at [x,y+(h/2)] and [x+w,y+(h/2)] and intersects the
8805vertical axis at [x+(w/2),y] and [x+(w/2),y+h].
8806These coordinates are not necessarily integral; that is,
8807they are not truncated to discrete coordinates.
8808</para>
8809<para>
8810For a wide line with line-width lw, the ideal bounding outlines for filling
8811are given by the two infinitely thin paths consisting of all points whose
8812perpendicular distance from a tangent to the path of the circle/ellipse is
8813equal to lw/2 (which may be a fractional value).  When the width and height
8814of the arc are not equal and both are nonzero, then the actual bounding
8815outlines are implementation dependent.  However, the computation of the
8816shape and position of the bounding outlines (relative to the center of the
8817arc) only depends on the width and height of the arc and the
8818line-width.
8819</para>
8820<para>
8821The cap-style is applied the same as for a line corresponding to the
8822tangent of the circle/ellipse at the endpoint.  When the angle of an arc
8823face is not an integral multiple of 90 degrees, and the width and height of
8824the arc are both are nonzero, then the shape and position of the cap at
8825that face is implementation dependent.  However, for a
8826<emphasis role='bold'>Butt</emphasis>
8827cap, the face
8828is defined by a straight line, and the computation of the position
8829(relative to the center of the arc) and the slope of the line only
8830depends on the width and height of the arc and the angle of the arc face.
8831For other cap styles, the computation of the position (relative to the
8832center of the arc) and the shape of the cap only depends on the width
8833and height of the arc, the line-width, the angle of the arc face, and the
8834direction (clockwise or counter clockwise) of the arc from the endpoint.
8835</para>
8836<para>
8837The join-style is applied the same as for two lines corresponding to the
8838tangents of the circles/ellipses at the join point.  When the width and
8839height of both arcs are nonzero, and the angle of either arc face is not an
8840integral multiple of 90 degrees, then the shape of the join is
8841implementation dependent.  However, the computation of the shape only
8842depends on the width and height of each arc, the line-width, the angles of
8843the two arc faces, the direction (clockwise or counter clockwise) of the
8844arcs from the join point, and the relative orientation of the two arc
8845center points.
8846</para>
8847<para>
8848For an arc specified as [x,y,w,h,a1,a2],
8849the angles must be specified in the effectively skewed coordinate system of
8850the ellipse (for a circle, the angles and coordinate systems are identical).
8851The relationship between these angles and angles expressed in the normal
8852coordinate system of the screen (as measured with a protractor) is as
8853follows:
8854<literallayout class="monospaced">
8855	skewed-angle = atan(tan(normal-angle) * w/h) + adjust
8856</literallayout>
8857</para>
8858<para>
8859The skewed-angle and normal-angle are expressed in radians (rather
8860than in degrees scaled by 64) in the range [0,2*PI).
8861The atan returns a value in the range [-PI/2,PI/2].
8862The adjust is:
8863<informaltable frame="none">
8864  <?dbfo keep-together="always" ?>
8865  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
8866    <colspec colname='c1' colwidth='1.0*'/>
8867    <colspec colname='c2' colwidth='2.0*'/>
8868    <tbody>
8869      <row>
8870	<entry>0</entry>
8871	<entry>for normal-angle in the range [0,PI/2)</entry>
8872      </row>
8873      <row>
8874	<entry>PI</entry>
8875	<entry>for normal-angle in the range [PI/2,(3*PI)/2)</entry>
8876      </row>
8877      <row>
8878	<entry>2*PI</entry>
8879	<entry>for normal-angle in the range [(3*PI)/2,2*PI)</entry>
8880      </row>
8881    </tbody>
8882  </tgroup>
8883</informaltable>
8884</para>
8885<para>
8886The arcs are drawn in the order listed.
8887If the last point in one arc coincides with the first point in the following
8888arc,
8889the two arcs will join correctly.
8890If the first point in the first arc coincides with the last point
8891in the last arc,
8892the two arcs will join correctly.
8893For any given arc,
8894no pixel is drawn more than once.
8895If two arcs join correctly and the line-width is greater than zero
8896and the arcs intersect,
8897no pixel is drawn more than once.
8898Otherwise, the intersecting pixels of intersecting arcs are drawn multiple
8899times.
8900Specifying an arc with one endpoint and a clockwise extent draws the
8901same pixels as specifying the other endpoint and an equivalent
8902counterclockwise extent, except as it affects joins.
8903</para>
8904<para>
8905By specifying one axis to be zero,
8906a horizontal or vertical line can be drawn.
8907</para>
8908<para>
8909Angles are computed based solely on the coordinate system,
8910ignoring the aspect ratio.
8911</para>
8912<para>
8913GC components: function, plane-mask, line-width, line-style,
8914cap-style, join-style, fill-style, subwindow-mode, clip-x-origin,
8915clip-y-origin, clip-mask
8916</para>
8917<para>
8918GC mode-dependent components: foreground, background, tile, stipple,
8919tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dashes
8920<!-- .sp -->
8921</para>
8922  </section>
8923  <section id="requests:FillPoly">
8924    <title>FillPoly</title>
8925    <indexterm zone="requests:FillPoly" significance="preferred"><primary>FillPoly</primary></indexterm>
8926<informaltable frame='none'>
8927  <?dbfo keep-together="always" ?>
8928  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
8929  <colspec colname='c1' colwidth='1.0*'/>
8930  <tbody>
8931    <row>
8932      <entry>
8933<!-- .in +.2in -->
8934<emphasis remap='I'>drawable</emphasis>: DRAWABLE
8935      </entry>
8936    </row>
8937    <row>
8938      <entry>
8939<emphasis remap='I'>gc</emphasis>: GCONTEXT
8940      </entry>
8941    </row>
8942    <row>
8943      <entry>
8944<emphasis remap='I'>shape</emphasis>:
8945{ <emphasis role='bold'>Complex</emphasis>,
8946<emphasis role='bold'>Nonconvex</emphasis>,
8947<emphasis role='bold'>Convex</emphasis>}
8948      </entry>
8949    </row>
8950    <row>
8951      <entry>
8952<emphasis remap='I'>coordinate-mode</emphasis>:
8953{ <emphasis role='bold'>Origin</emphasis>,
8954<emphasis role='bold'>Previous</emphasis>}
8955      </entry>
8956    </row>
8957    <row>
8958      <entry>
8959<emphasis remap='I'>points</emphasis>: LISTofPOINT
8960<!-- .in -.2i -->
8961      </entry>
8962    </row>
8963    <row>
8964      <entry>
8965<!-- .in +.2i -->
8966Errors:
8967<emphasis role='bold'>Drawable</emphasis>,
8968<emphasis role='bold'>GContext</emphasis>,
8969<emphasis role='bold'>Match</emphasis>,
8970<emphasis role='bold'>Value</emphasis>
8971<!-- .in -.2i -->
8972<!-- .eM -->
8973      </entry>
8974    </row>
8975  </tbody>
8976  </tgroup>
8977</informaltable>
8978<!-- .eM -->
8979<para>
8980This request fills the region closed by the specified path.
8981The path is closed automatically if the last point in the list does not
8982coincide with the first point.
8983No pixel of the region is drawn more than once.
8984</para>
8985<para>
8986The first point is always relative to the drawable's origin.
8987The rest are relative either to that origin or the previous point,
8988depending on the coordinate-mode.
8989</para>
8990<para>
8991The shape parameter may be used by the server to improve performance.
8992<emphasis role='bold'>Complex</emphasis>
8993means the path may self-intersect.
8994Contiguous coincident points in the path are not treated
8995as self-intersection.
8996</para>
8997<para>
8998<emphasis role='bold'>Nonconvex</emphasis>
8999means the path does not self-intersect,
9000but the shape is not wholly convex.
9001If known by the client,
9002specifying
9003<emphasis role='bold'>Nonconvex</emphasis>
9004over
9005<emphasis role='bold'>Complex</emphasis>
9006may improve performance.
9007If
9008<emphasis role='bold'>Nonconvex</emphasis>
9009is specified for a self-intersecting path,
9010the graphics results are undefined.
9011</para>
9012<para>
9013<emphasis role='bold'>Convex</emphasis>
9014means that for every pair of points inside the polygon,
9015the line segment connecting them does not intersect the path.
9016If known by the client,
9017specifying
9018<emphasis role='bold'>Convex</emphasis>
9019can improve performance.
9020If
9021<emphasis role='bold'>Convex</emphasis>
9022is specified for a path that is not convex,
9023the graphics results are undefined.
9024</para>
9025<para>
9026GC components: function, plane-mask, fill-style, fill-rule,
9027subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
9028</para>
9029<para>
9030GC mode-dependent components: foreground, background, tile, stipple,
9031tile-stipple-x-origin, tile-stipple-y-origin
9032<!-- .sp -->
9033</para>
9034  </section>
9035  <section id="requests:PolyFillRectangle">
9036    <title>PolyFillRectangle</title>
9037    <indexterm zone="requests:PolyFillRectangle" significance="preferred"><primary>PolyFillRectangle</primary></indexterm>
9038<informaltable frame='none'>
9039  <?dbfo keep-together="always" ?>
9040  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9041  <colspec colname='c1' colwidth='1.0*'/>
9042  <tbody>
9043    <row>
9044      <entry>
9045<!-- .in +.2i -->
9046<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9047      </entry>
9048    </row>
9049    <row>
9050      <entry>
9051<emphasis remap='I'>gc</emphasis>: GCONTEXT
9052      </entry>
9053    </row>
9054    <row>
9055      <entry>
9056<emphasis remap='I'>rectangles</emphasis>: LISTofRECTANGLE
9057<!-- .in -.2i -->
9058      </entry>
9059    </row>
9060    <row>
9061      <entry>
9062<!-- .in +.2i -->
9063Errors:
9064<emphasis role='bold'>Drawable</emphasis>,
9065<emphasis role='bold'>GContext</emphasis>,
9066<emphasis role='bold'>Match</emphasis>
9067<!-- .in -.2i -->
9068<!-- .eM -->
9069      </entry>
9070    </row>
9071  </tbody>
9072  </tgroup>
9073</informaltable>
9074<!-- .eM -->
9075<para>
9076This request fills the specified rectangles, as if a four-point
9077<link linkend="requests:FillPoly"><emphasis role='bold'>FillPoly</emphasis></link>
9078were specified for each rectangle:
9079<literallayout class="monospaced">
9080	[x,y] [x+width,y] [x+width,y+height] [x,y+height]
9081</literallayout>
9082</para>
9083<para>
9084The x and y coordinates of each rectangle are relative to the drawable's origin
9085and define the upper-left corner of the rectangle.
9086</para>
9087<para>
9088The rectangles are drawn in the order listed.
9089For any given rectangle,
9090no pixel is drawn more than once.
9091If rectangles intersect,
9092the intersecting pixels are drawn multiple times.
9093</para>
9094<para>
9095GC components: function, plane-mask, fill-style, subwindow-mode,
9096clip-x-origin, clip-y-origin, clip-mask
9097</para>
9098<para>
9099GC mode-dependent components: foreground, background, tile, stipple,
9100tile-stipple-x-origin, tile-stipple-y-origin
9101<!-- .sp -->
9102</para>
9103  </section>
9104  <section id="requests:PolyFillArc">
9105    <title>PolyFillArc</title>
9106    <indexterm zone="requests:PolyFillArc" significance="preferred"><primary>PolyFillArc</primary></indexterm>
9107<informaltable frame='none'>
9108  <?dbfo keep-together="always" ?>
9109  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9110  <colspec colname='c1' colwidth='1.0*'/>
9111  <tbody>
9112    <row>
9113      <entry>
9114<!-- .in +.2i -->
9115<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9116      </entry>
9117    </row>
9118    <row>
9119      <entry>
9120<emphasis remap='I'>gc</emphasis>: GCONTEXT
9121      </entry>
9122    </row>
9123    <row>
9124      <entry>
9125<emphasis remap='I'>arcs</emphasis>: LISTofARC
9126<!-- .in -.2i -->
9127      </entry>
9128    </row>
9129    <row>
9130      <entry>
9131<!-- .in +.2i -->
9132Errors:
9133<emphasis role='bold'>Drawable</emphasis>,
9134<emphasis role='bold'>GContext</emphasis>,
9135<emphasis role='bold'>Match</emphasis>
9136<!-- .in -.2i -->
9137<!-- .eM -->
9138      </entry>
9139    </row>
9140  </tbody>
9141  </tgroup>
9142</informaltable>
9143<!-- .eM -->
9144<para>
9145For each arc,
9146this request fills the region closed by the infinitely thin path
9147described by the specified arc and one or two line segments,
9148depending on the arc-mode.
9149For
9150<emphasis role='bold'>Chord</emphasis>,
9151the single line segment joining the endpoints of the arc is used.
9152For
9153<emphasis role='bold'>PieSlice</emphasis>,
9154the two line segments joining the endpoints of the arc with the center point
9155are used.
9156</para>
9157<para>
9158For an arc specified as [x,y,w,h,a1,a2], the origin of the major and minor
9159axes is at [x+(w/2),y+(h/2)], and the infinitely thin path describing the
9160entire circle/ellipse intersects the horizontal axis at [x,y+(h/2)] and
9161[x+w,y+(h/2)] and intersects the vertical axis at [x+(w/2),y] and
9162[x+(w/2),y+h].  These coordinates are not necessarily integral; that is,
9163they are not truncated to discrete coordinates.
9164</para>
9165<para>
9166The arc angles are interpreted as specified in the
9167<link linkend="requests:PolyArc"><emphasis role='bold'>PolyArc</emphasis></link>
9168request.  When
9169the angle of an arc face is not an integral multiple of 90 degrees, then
9170the precise endpoint on the arc is implementation dependent.  However, for
9171<emphasis role='bold'>Chord</emphasis>
9172arc-mode, the computation of the pair of endpoints (relative to the
9173center of the arc) only depends on the width and height of the arc and
9174the angles of the two arc faces.  For
9175<emphasis role='bold'>PieSlice</emphasis>
9176arc-mode, the computation of
9177an endpoint only depends on the angle of the arc face for that
9178endpoint and the ratio of the arc width to arc height.
9179</para>
9180<para>
9181The arcs are filled in the order listed.
9182For any given arc,
9183no pixel is drawn more than once.
9184If regions intersect,
9185the intersecting pixels are drawn multiple times.
9186</para>
9187<para>
9188GC components: function, plane-mask, fill-style, arc-mode,
9189subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
9190</para>
9191<para>
9192GC mode-dependent components: foreground, background, tile, stipple,
9193tile-stipple-x-origin, tile-stipple-y-origin
9194<!-- .sp -->
9195</para>
9196  </section>
9197  <section id="requests:PutImage">
9198    <title>PutImage</title>
9199    <indexterm zone="requests:PutImage" significance="preferred"><primary>PutImage</primary></indexterm>
9200<informaltable frame='none'>
9201  <?dbfo keep-together="always" ?>
9202  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9203  <colspec colname='c1' colwidth='1.0*'/>
9204  <tbody>
9205    <row>
9206      <entry>
9207<!-- .in +.2i -->
9208<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9209      </entry>
9210    </row>
9211    <row>
9212      <entry>
9213<emphasis remap='I'>gc</emphasis>: GCONTEXT
9214      </entry>
9215    </row>
9216    <row>
9217      <entry>
9218<emphasis remap='I'>depth</emphasis>: CARD8
9219      </entry>
9220    </row>
9221    <row>
9222      <entry>
9223<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
9224      </entry>
9225    </row>
9226    <row>
9227      <entry>
9228<emphasis remap='I'>dst-x</emphasis>, <emphasis remap='I'>dst-y</emphasis>: INT16
9229      </entry>
9230    </row>
9231    <row>
9232      <entry>
9233<emphasis remap='I'>left-pad</emphasis>: CARD8
9234      </entry>
9235    </row>
9236    <row>
9237      <entry>
9238<emphasis remap='I'>format</emphasis>:
9239{ <emphasis role='bold'>Bitmap</emphasis>,
9240<emphasis role='bold'>XYPixmap</emphasis>,
9241<emphasis role='bold'>ZPixmap</emphasis>}
9242      </entry>
9243    </row>
9244    <row>
9245      <entry>
9246<emphasis remap='I'>data</emphasis>: LISTofBYTE
9247<!-- .in -.2i -->
9248      </entry>
9249    </row>
9250    <row>
9251      <entry>
9252<!-- .in +.2i -->
9253Errors:
9254<emphasis role='bold'>Drawable</emphasis>,
9255<emphasis role='bold'>GContext</emphasis>,
9256<emphasis role='bold'>Match</emphasis>,
9257<emphasis role='bold'>Value</emphasis>
9258<!-- .in -.2i -->
9259<!-- .eM -->
9260      </entry>
9261    </row>
9262  </tbody>
9263  </tgroup>
9264</informaltable>
9265<!-- .eM -->
9266<para>
9267This request combines an image with a rectangle of the drawable.
9268The dst-x and dst-y coordinates are relative to the drawable's origin.
9269</para>
9270<para>
9271If
9272<emphasis role='bold'>Bitmap</emphasis>
9273format is used,
9274then depth must be one (or a
9275<emphasis role='bold'>Match</emphasis>
9276error results), and the image must be in XY format.
9277The foreground pixel in gc defines the source for bits set to 1 in the image,
9278and the background pixel defines the source for the bits set to 0.
9279</para>
9280<para>
9281For
9282<emphasis role='bold'>XYPixmap</emphasis>
9283and
9284<emphasis role='bold'>ZPixmap</emphasis>,
9285the depth must match the depth of the drawable (or a
9286<emphasis role='bold'>Match</emphasis>
9287error results).
9288For
9289<emphasis role='bold'>XYPixmap</emphasis>,
9290the image must be sent in XY format.
9291For
9292<emphasis role='bold'>ZPixmap</emphasis>,
9293the image must be sent in the Z format defined for the given depth.
9294</para>
9295<para>
9296The left-pad must be zero for
9297<emphasis role='bold'>ZPixmap</emphasis>
9298format (or a
9299<emphasis role='bold'>Match</emphasis>
9300error results).
9301For
9302<emphasis role='bold'>Bitmap</emphasis>
9303and
9304<emphasis role='bold'>XYPixmap</emphasis>
9305format,
9306left-pad must be less than bitmap-scanline-pad as given in the server
9307connection setup information (or a
9308<emphasis role='bold'>Match</emphasis>
9309error results).
9310The first left-pad bits in every scanline are to be ignored by the server.
9311The actual image begins that many bits into the data.
9312The width argument defines the width of the actual image
9313and does not include left-pad.
9314</para>
9315<para>
9316GC components: function, plane-mask, subwindow-mode, clip-x-origin,
9317clip-y-origin, clip-mask
9318</para>
9319<para>
9320GC mode-dependent components: foreground, background
9321<!-- .sp -->
9322</para>
9323  </section>
9324  <section id="requests:GetImage">
9325    <title>GetImage</title>
9326    <indexterm zone="requests:GetImage" significance="preferred"><primary>GetImage</primary></indexterm>
9327<informaltable frame='none'>
9328  <?dbfo keep-together="always" ?>
9329  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9330  <colspec colname='c1' colwidth='1.0*'/>
9331  <tbody>
9332    <row>
9333      <entry>
9334<!-- .in +.2i -->
9335<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9336      </entry>
9337    </row>
9338    <row>
9339      <entry>
9340<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
9341      </entry>
9342    </row>
9343    <row>
9344      <entry>
9345<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
9346      </entry>
9347    </row>
9348    <row>
9349      <entry>
9350<emphasis remap='I'>plane-mask</emphasis>: CARD32
9351      </entry>
9352    </row>
9353    <row>
9354      <entry>
9355<emphasis remap='I'>format</emphasis>:
9356{ <emphasis role='bold'>XYPixmap</emphasis>,
9357<emphasis role='bold'>ZPixmap</emphasis>}
9358<!-- .in -.2i -->
9359      </entry>
9360    </row>
9361    <row>
9362      <entry>
93639364      </entry>
9365    </row>
9366    <row>
9367      <entry>
9368<!-- .in +.2i -->
9369depth: CARD8
9370      </entry>
9371    </row>
9372    <row>
9373      <entry>
9374visual: VISUALID or
9375<emphasis role='bold'>None</emphasis>
9376      </entry>
9377    </row>
9378    <row>
9379      <entry>
9380data: LISTofBYTE
9381<!-- .in -.2i -->
9382      </entry>
9383    </row>
9384    <row>
9385      <entry>
9386<!-- .in +.2i -->
9387Errors:
9388<emphasis role='bold'>Drawable</emphasis>,
9389<emphasis role='bold'>Match</emphasis>,
9390<emphasis role='bold'>Value</emphasis>
9391<!-- .in -.2i -->
9392<!-- .eM -->
9393      </entry>
9394    </row>
9395  </tbody>
9396  </tgroup>
9397</informaltable>
9398<!-- .eM -->
9399<para>
9400This request returns the contents of the given rectangle of the drawable in the
9401given format.
9402The x and y coordinates are relative to the drawable's origin
9403and define the upper-left corner of the rectangle.
9404If
9405<emphasis role='bold'>XYPixmap</emphasis>
9406is specified,
9407only the bit planes specified in plane-mask are transmitted,
9408with the planes appearing from most significant to least significant
9409in bit order.
9410If
9411<emphasis role='bold'>ZPixmap</emphasis>
9412is specified, then bits in all planes not specified in plane-mask are
9413transmitted as zero.
9414Range checking is not performed on plane-mask;
9415extraneous bits are simply ignored.
9416The returned depth is as specified when the drawable was created
9417and is the same as a depth component in a FORMAT structure (in the connection
9418setup), not a bits-per-pixel component.
9419If the drawable is a window,
9420its visual type is returned.
9421If the drawable is a pixmap,
9422the visual is
9423<emphasis role='bold'>None</emphasis>.
9424</para>
9425<para>
9426If the drawable is a pixmap,
9427then the given rectangle must be wholly contained within the pixmap (or a
9428<emphasis role='bold'>Match</emphasis>
9429error results).
9430If the drawable is a window,
9431the window must be viewable,
9432and it must be the case that,
9433if there were no inferiors or overlapping windows,
9434the specified rectangle of the window would be fully visible on the screen
9435and wholly contained within the outside edges of the window (or a
9436<emphasis role='bold'>Match</emphasis>
9437error results).
9438Note that the borders of the window can be included and read with this request.
9439If the window has a backing store,
9440then the backing-store contents are returned for regions of the window
9441that are obscured by noninferior windows;
9442otherwise, the returned contents of such obscured regions are undefined.
9443Also undefined are the returned contents of visible
9444regions of inferiors of different depth than the specified window.
9445The pointer cursor image is not included in the contents returned.
9446</para>
9447<para>
9448This request is not general-purpose in the same sense as other
9449graphics-related requests.
9450It is intended specifically for rudimentary hardcopy support.
9451<!-- .sp -->
9452</para>
9453  </section>
9454  <section id="requests:PolyText8">
9455    <title>PolyText8</title>
9456    <indexterm zone="requests:PolyText8" significance="preferred"><primary>PolyText8</primary></indexterm>
9457<informaltable frame='none'>
9458  <?dbfo keep-together="always" ?>
9459  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
9460  <colspec colname='c1' colwidth='1.0*'/>
9461  <colspec colname='c2' colwidth='1.0*'/>
9462  <colspec colname='c3' colwidth='1.0*'/>
9463  <spanspec spanname='all' namest='c1' nameend='c3'/>
9464  <tbody>
9465    <row>
9466      <entry spanname='all'>
9467<!-- .in +.2i -->
9468<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9469      </entry>
9470    </row>
9471    <row>
9472      <entry spanname='all'>
9473<emphasis remap='I'>gc</emphasis>: GCONTEXT
9474      </entry>
9475    </row>
9476    <row>
9477      <entry spanname='all'>
9478<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
9479      </entry>
9480    </row>
9481    <row>
9482      <entry spanname='all'>
9483<emphasis remap='I'>items</emphasis>: LISTofTEXTITEM8
9484<!-- .in -.2i -->
9485      </entry>
9486    </row>
9487    <row>
9488      <entry valign='top' morerows='3'>
9489<!-- .in +.2i -->
9490where:
9491      </entry>
9492    </row>
9493    <row>
9494      <entry>
9495TEXTITEM8:
9496      </entry>
9497      <entry>
9498TEXTELT8 or FONT
9499      </entry>
9500    </row>
9501    <row>
9502      <entry valign='top' morerows='1'>
9503TEXTELT8:
9504      </entry>
9505      <entry>
9506[delta: INT8
9507      </entry>
9508    </row>
9509    <row>
9510      <entry>
9511string: STRING8]
9512<!-- .in -.2i -->
9513      </entry>
9514    </row>
9515    <row>
9516      <entry spanname='all'>
9517<!-- .in +.2i -->
9518Errors:
9519<emphasis role='bold'>Drawable</emphasis>,
9520<emphasis role='bold'>Font</emphasis>,
9521<emphasis role='bold'>GContext</emphasis>,
9522<emphasis role='bold'>Match</emphasis>
9523<!-- .in -.2i -->
9524<!-- .eM -->
9525      </entry>
9526    </row>
9527  </tbody>
9528  </tgroup>
9529</informaltable>
9530<!-- .eM -->
9531<para>
9532The x and y coordinates are relative to the drawable's origin
9533and specify the baseline starting position (the initial character origin).
9534Each text item is processed in turn.
9535A font item causes the font to be stored in gc
9536and to be used for subsequent text.
9537Switching among fonts does not affect the next character origin.
9538A text element delta specifies an additional change in the position
9539along the x axis before the string is drawn;
9540the delta is always added to the character origin.
9541Each character image, as defined by the font in gc,
9542is treated as an additional mask for a fill operation on the drawable.
9543</para>
9544<para>
9545All contained FONTs are always transmitted most significant byte first.
9546</para>
9547<para>
9548If a
9549<emphasis role='bold'>Font</emphasis>
9550error is generated for an item,
9551the previous items may have been drawn.
9552</para>
9553<para>
9554For fonts defined with 2-byte matrix indexing,
9555each STRING8 byte is interpreted as a byte2 value of a CHAR2B with a byte1
9556value of zero.
9557</para>
9558<para>
9559GC components: function, plane-mask, fill-style, font,
9560subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
9561</para>
9562<para>
9563GC mode-dependent components: foreground, background, tile, stipple,
9564tile-stipple-x-origin, tile-stipple-y-origin
9565<!-- .sp -->
9566</para>
9567  </section>
9568  <section id="requests:PolyText16">
9569    <title>PolyText16</title>
9570    <indexterm zone="requests:PolyText16" significance="preferred"><primary>PolyText16</primary></indexterm>
9571<informaltable frame='none'>
9572  <?dbfo keep-together="always" ?>
9573  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
9574  <colspec colname='c1' colwidth='1.0*'/>
9575  <colspec colname='c2' colwidth='1.0*'/>
9576  <colspec colname='c3' colwidth='1.0*'/>
9577  <spanspec spanname='all' namest='c1' nameend='c3'/>
9578  <tbody>
9579    <row>
9580      <entry spanname='all'>
9581<!-- .in +.2i -->
9582<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9583      </entry>
9584    </row>
9585    <row>
9586      <entry spanname='all'>
9587<emphasis remap='I'>gc</emphasis>: GCONTEXT
9588      </entry>
9589    </row>
9590    <row>
9591      <entry spanname='all'>
9592<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
9593      </entry>
9594    </row>
9595    <row>
9596      <entry spanname='all'>
9597<emphasis remap='I'>items</emphasis>: LISTofTEXTITEM16
9598<!-- .in -.2i -->
9599      </entry>
9600    </row>
9601    <row>
9602      <entry valign='top' morerows='3'>
9603<!-- .in +.2i -->
9604where:
9605      </entry>
9606    </row>
9607    <row>
9608      <entry>
9609TEXTITEM16:
9610      </entry>
9611      <entry>
9612TEXTELT16 or FONT
9613      </entry>
9614    </row>
9615    <row>
9616      <entry valign='top' morerows='1'>
9617TEXTELT16:
9618      </entry>
9619      <entry>
9620[delta: INT8
9621      </entry>
9622    </row>
9623    <row>
9624      <entry>
9625string: STRING16]
9626<!-- .in -.2i -->
9627      </entry>
9628    </row>
9629    <row>
9630      <entry spanname='all'>
9631<!-- .in +.2i -->
9632Errors:
9633<emphasis role='bold'>Drawable</emphasis>,
9634<emphasis role='bold'>Font</emphasis>,
9635<emphasis role='bold'>GContext</emphasis>,
9636<emphasis role='bold'>Match</emphasis>
9637<!-- .in -.2i -->
9638<!-- .eM -->
9639      </entry>
9640    </row>
9641  </tbody>
9642  </tgroup>
9643</informaltable>
9644<!-- .eM -->
9645<para>
9646This request is similar to
9647<link linkend="requests:PolyText8"><emphasis role='bold'>PolyText8</emphasis></link>,
9648except 2-byte (or 16-bit) characters are used.
9649For fonts defined with linear indexing rather than 2-byte matrix indexing,
9650the server will interpret each CHAR2B as a 16-bit number that
9651has been transmitted most significant byte first (that is, byte1 of the
9652CHAR2B is taken as the most significant byte).
9653<!-- .sp -->
9654</para>
9655  </section>
9656  <section id="requests:ImageText8">
9657    <title>ImageText8</title>
9658    <indexterm zone="requests:ImageText8" significance="preferred"><primary>ImageText8</primary></indexterm>
9659<informaltable frame='none'>
9660  <?dbfo keep-together="always" ?>
9661  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9662  <colspec colname='c1' colwidth='1.0*'/>
9663  <tbody>
9664    <row>
9665      <entry>
9666<!-- .in +.2i -->
9667<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9668      </entry>
9669    </row>
9670    <row>
9671      <entry>
9672<emphasis remap='I'>gc</emphasis>: GCONTEXT
9673      </entry>
9674    </row>
9675    <row>
9676      <entry>
9677<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
9678      </entry>
9679    </row>
9680    <row>
9681      <entry>
9682<emphasis remap='I'>string</emphasis>: STRING8
9683<!-- .in -.2i -->
9684      </entry>
9685    </row>
9686    <row>
9687      <entry>
9688<!-- .in +.2i -->
9689Errors:
9690<emphasis role='bold'>Drawable</emphasis>,
9691<emphasis role='bold'>GContext</emphasis>,
9692<emphasis role='bold'>Match</emphasis>
9693<!-- .in -.2i -->
9694<!-- .eM -->
9695      </entry>
9696    </row>
9697  </tbody>
9698  </tgroup>
9699</informaltable>
9700<!-- .eM -->
9701<para>
9702The x and y coordinates are relative to the drawable's origin
9703and specify the baseline starting position (the initial character origin).
9704The effect is first to fill a destination rectangle with the background
9705pixel defined in gc and then to paint the text with the foreground pixel.
9706The upper-left corner of the filled rectangle is at:
9707<literallayout class="monospaced">
9708	[x, y - font-ascent]
9709</literallayout>
9710</para>
9711<para>
9712the width is:
9713<literallayout class="monospaced">
9714	overall-width
9715</literallayout>
9716</para>
9717<para>
9718and the height is:
9719<literallayout class="monospaced">
9720	font-ascent + font-descent
9721</literallayout>
9722</para>
9723<para>
9724The overall-width, font-ascent, and font-descent are as
9725they would be returned by a
9726<link linkend="requests:QueryTextExtents"><emphasis role='bold'>QueryTextExtents</emphasis></link>
9727call using gc and string.
9728</para>
9729<para>
9730The function and fill-style defined in gc are ignored for this request.
9731The effective function is
9732<emphasis role='bold'>Copy</emphasis>,
9733and the effective fill-style
9734<emphasis role='bold'>Solid</emphasis>.
9735</para>
9736<para>
9737For fonts defined with 2-byte matrix indexing,
9738each STRING8 byte is interpreted as a byte2 value of a CHAR2B with a byte1
9739value of zero.
9740</para>
9741<para>
9742GC components: plane-mask, foreground, background, font,
9743subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
9744<!-- .sp -->
9745</para>
9746  </section>
9747  <section id="requests:ImageText16">
9748    <title>ImageText16</title>
9749    <indexterm zone="requests:ImageText16" significance="preferred"><primary>ImageText16</primary></indexterm>
9750<informaltable frame='none'>
9751  <?dbfo keep-together="always" ?>
9752  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9753  <colspec colname='c1' colwidth='1.0*'/>
9754  <tbody>
9755    <row>
9756      <entry>
9757<!-- .in +.2i -->
9758<emphasis remap='I'>drawable</emphasis>: DRAWABLE
9759      </entry>
9760    </row>
9761    <row>
9762      <entry>
9763<emphasis remap='I'>gc</emphasis>: GCONTEXT
9764      </entry>
9765    </row>
9766    <row>
9767      <entry>
9768<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
9769      </entry>
9770    </row>
9771    <row>
9772      <entry>
9773<emphasis remap='I'>string</emphasis>: STRING16
9774<!-- .in -.2i -->
9775      </entry>
9776    </row>
9777    <row>
9778      <entry>
9779<!-- .in +.2i -->
9780Errors:
9781<emphasis role='bold'>Drawable</emphasis>,
9782<emphasis role='bold'>GContext</emphasis>,
9783<emphasis role='bold'>Match</emphasis>
9784<!-- .in -.2i -->
9785<!-- .eM -->
9786      </entry>
9787    </row>
9788  </tbody>
9789  </tgroup>
9790</informaltable>
9791<!-- .eM -->
9792<para>
9793This request is similar to
9794<link linkend="requests:ImageText8"><emphasis role='bold'>ImageText8</emphasis></link>,
9795except 2-byte (or 16-bit) characters are used.
9796For fonts defined with linear indexing rather than 2-byte matrix indexing,
9797the server will interpret each CHAR2B as a 16-bit number that
9798has been transmitted most significant byte first (that is, byte1 of the
9799CHAR2B is taken as the most significant byte).
9800<!-- .sp -->
9801</para>
9802  </section>
9803  <section id="requests:CreateColormap">
9804    <title>CreateColormap</title>
9805    <indexterm zone="requests:CreateColormap" significance="preferred"><primary>CreateColormap</primary></indexterm>
9806    <indexterm zone="requests:CreateColormap"><primary>Colormap</primary></indexterm>
9807<informaltable frame='none'>
9808  <?dbfo keep-together="always" ?>
9809  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9810  <colspec colname='c1' colwidth='1.0*'/>
9811  <tbody>
9812    <row>
9813      <entry>
9814<!-- .in +.2i -->
9815<emphasis remap='I'>mid</emphasis>: COLORMAP
9816      </entry>
9817    </row>
9818    <row>
9819      <entry>
9820<emphasis remap='I'>visual</emphasis>: VISUALID
9821      </entry>
9822    </row>
9823    <row>
9824      <entry>
9825<emphasis remap='I'>window</emphasis>: WINDOW
9826      </entry>
9827    </row>
9828    <row>
9829      <entry>
9830<emphasis remap='I'>alloc</emphasis>:
9831{ <emphasis role='bold'>None</emphasis>,
9832<emphasis role='bold'>All</emphasis>}
9833<!-- .in -.2i -->
9834      </entry>
9835    </row>
9836    <row>
9837      <entry>
9838<!-- .in +.2i -->
9839Errors:
9840<emphasis role='bold'>Alloc</emphasis>,
9841<emphasis role='bold'>IDChoice</emphasis>,
9842<emphasis role='bold'>Match</emphasis>,
9843<emphasis role='bold'>Value</emphasis>,
9844<emphasis role='bold'>Window</emphasis>
9845<!-- .in -.2i -->
9846<!-- .eM -->
9847      </entry>
9848    </row>
9849  </tbody>
9850  </tgroup>
9851</informaltable>
9852<!-- .eM -->
9853<para>
9854This request creates a colormap of the specified visual type for the screen
9855on which the window resides and associates the identifier mid with it.
9856The visual type must be one supported by the screen (or a
9857<emphasis role='bold'>Match</emphasis>
9858error results).
9859The initial values of the colormap entries are undefined for classes
9860<emphasis role='bold'>GrayScale</emphasis>,
9861<emphasis role='bold'>PseudoColor</emphasis>,
9862and
9863<emphasis role='bold'>DirectColor</emphasis>.
9864For
9865<emphasis role='bold'>StaticGray</emphasis>,
9866<emphasis role='bold'>StaticColor</emphasis>,
9867and
9868<emphasis role='bold'>TrueColor</emphasis>,
9869the entries will have defined values,
9870but those values are specific to the visual and are not defined
9871by the core protocol.
9872For
9873<emphasis role='bold'>StaticGray</emphasis>,
9874<emphasis role='bold'>StaticColor</emphasis>,
9875and
9876<emphasis role='bold'>TrueColor</emphasis>,
9877alloc must be specified as
9878<emphasis role='bold'>None</emphasis>
9879(or a
9880<emphasis role='bold'>Match</emphasis>
9881error results).
9882For the other classes, if alloc is
9883<emphasis role='bold'>None</emphasis>,
9884the colormap initially has no allocated entries,
9885and clients can allocate entries.
9886</para>
9887<para>
9888If alloc is
9889<emphasis role='bold'>All</emphasis>,
9890then the entire colormap is allocated writable.
9891The initial values of all allocated entries are undefined.
9892For
9893<emphasis role='bold'>GrayScale</emphasis>
9894and
9895<emphasis role='bold'>PseudoColor</emphasis>,
9896the effect is as if an
9897<link linkend="requests:AllocColorCells"><emphasis role='bold'>AllocColorCells</emphasis></link>
9898request returned all pixel values from zero to N - 1,
9899where N is the colormap-entries value in the specified visual.
9900For
9901<emphasis role='bold'>DirectColor</emphasis>,
9902the effect is as if an
9903<link linkend="requests:AllocColorPlanes"><emphasis role='bold'>AllocColorPlanes</emphasis></link>
9904request returned a pixel value of zero and red-mask,
9905green-mask, and blue-mask values containing the same bits as the
9906corresponding masks in the specified visual.
9907However,
9908in all cases, none of these entries can be freed with
9909<link linkend="requests:FreeColors"><emphasis role='bold'>FreeColors</emphasis></link>.
9910<!-- .sp -->
9911</para>
9912  </section>
9913  <section id="requests:FreeColormap">
9914    <title>FreeColormap</title>
9915    <indexterm zone="requests:FreeColormap" significance="preferred"><primary>FreeColormap</primary></indexterm>
9916<informaltable frame='none'>
9917  <?dbfo keep-together="always" ?>
9918  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9919  <colspec colname='c1' colwidth='1.0*'/>
9920  <tbody>
9921    <row>
9922      <entry>
9923<!-- .in +.2i -->
9924<emphasis remap='I'>cmap</emphasis>: COLORMAP
9925<!-- .in -.2i -->
9926      </entry>
9927    </row>
9928    <row>
9929      <entry>
9930<!-- .in +.2i -->
9931Errors:
9932<emphasis role='bold'>Colormap</emphasis>
9933<!-- .in -.2i -->
9934<!-- .eM -->
9935      </entry>
9936    </row>
9937  </tbody>
9938  </tgroup>
9939</informaltable>
9940<!-- .eM -->
9941<para>
9942This request deletes the association between the resource ID and the colormap
9943and frees the colormap storage.
9944If the colormap is an installed map for a screen,
9945it is uninstalled (see
9946<link linkend="requests:UninstallColormap"><emphasis role='bold'>UninstallColormap</emphasis></link>
9947request).
9948If the colormap is defined as the colormap for a window (by means of
9949<link linkend="requests:CreateWindow"><emphasis role='bold'>CreateWindow</emphasis></link>
9950or
9951<link linkend="requests:ChangeWindowAttributes"><emphasis role='bold'>ChangeWindowAttributes</emphasis></link>),
9952the colormap for the window is changed to
9953<emphasis role='bold'>None</emphasis>,
9954and a
9955<link linkend="events:ColormapNotify"><emphasis role='bold'>ColormapNotify</emphasis></link>
9956event is generated.
9957The protocol does not define the colors displayed for a window with a colormap of
9958<emphasis role='bold'>None</emphasis>.
9959</para>
9960<para>
9961This request has no effect on a default colormap for a screen.
9962<!-- .sp -->
9963</para>
9964  </section>
9965  <section id="requests:CopyColormapAndFree">
9966    <title>CopyColormapAndFree</title>
9967    <indexterm zone="requests:CopyColormapAndFree" significance="preferred"><primary>CopyColormapAndFree</primary></indexterm>
9968<informaltable frame='none'>
9969  <?dbfo keep-together="always" ?>
9970  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
9971  <colspec colname='c1' colwidth='1.0*'/>
9972  <tbody>
9973    <row>
9974      <entry>
9975<!-- .in +.2i -->
9976<emphasis remap='I'>mid</emphasis>, <emphasis remap='I'>src-cmap</emphasis>: COLORMAP
9977<!-- .in -.2i -->
9978      </entry>
9979    </row>
9980    <row>
9981      <entry>
9982<!-- .in +.2i -->
9983Errors:
9984<emphasis role='bold'>Alloc</emphasis>,
9985<emphasis role='bold'>Colormap</emphasis>,
9986<emphasis role='bold'>IDChoice</emphasis>
9987<!-- .in -.2i -->
9988<!-- .eM -->
9989      </entry>
9990    </row>
9991  </tbody>
9992  </tgroup>
9993</informaltable>
9994<!-- .eM -->
9995<para>
9996This request creates a colormap of the same visual type
9997and for the same screen as src-cmap,
9998and it associates identifier mid with it.
9999It also moves all of the client's existing allocations from src-cmap
10000to the new colormap with their color values intact
10001and their read-only or writable characteristics intact,
10002and it frees those entries in src-cmap.
10003Color values in other entries in the new colormap are undefined.
10004If src-cmap was created by the client with alloc
10005<emphasis role='bold'>All</emphasis>
10006(see
10007<link linkend="requests:CreateColormap"><emphasis role='bold'>CreateColormap</emphasis></link>
10008request),
10009then the new colormap is also created with alloc
10010<emphasis role='bold'>All</emphasis>,
10011all color values for all entries are copied from src-cmap,
10012and then all entries in src-cmap are freed.
10013If src-cmap was not created by the client with alloc
10014<emphasis role='bold'>All</emphasis>,
10015then the allocations to be moved are all those pixels and planes that have
10016been allocated by the client using either
10017<link linkend="requests:AllocColor"><emphasis role='bold'>AllocColor</emphasis></link>,
10018<link linkend="requests:AllocNamedColor"><emphasis role='bold'>AllocNamedColor</emphasis></link>,
10019<link linkend="requests:AllocColorCells"><emphasis role='bold'>AllocColorCells</emphasis></link>,
10020or
10021<link linkend="requests:AllocColorPlanes"><emphasis role='bold'>AllocColorPlanes</emphasis></link>
10022and that have not been freed since they were allocated.
10023<!-- .sp -->
10024</para>
10025  </section>
10026  <section id="requests:InstallColormap">
10027    <title>InstallColormap</title>
10028    <indexterm zone="requests:InstallColormap" significance="preferred"><primary>InstallColormap</primary></indexterm>
10029<informaltable frame='none'>
10030  <?dbfo keep-together="always" ?>
10031  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10032  <colspec colname='c1' colwidth='1.0*'/>
10033  <tbody>
10034    <row>
10035      <entry>
10036<!-- .in +.2i -->
10037<emphasis remap='I'>cmap</emphasis>: COLORMAP
10038<!-- .in -.2i -->
10039      </entry>
10040    </row>
10041    <row>
10042      <entry>
10043<!-- .in +.2i -->
10044Errors:
10045<emphasis role='bold'>Colormap</emphasis>
10046<!-- .in -.2i -->
10047<!-- .eM -->
10048      </entry>
10049    </row>
10050  </tbody>
10051  </tgroup>
10052</informaltable>
10053<!-- .eM -->
10054<para>
10055This request makes this colormap an installed map for its screen.
10056All windows associated with this colormap immediately display with true colors.
10057As a side effect,
10058additional colormaps might be implicitly installed
10059or uninstalled by the server.
10060Which other colormaps get installed or uninstalled is server-dependent
10061except that the required list must remain installed.
10062</para>
10063<para>
10064If cmap is not already an installed map, a
10065<link linkend="events:ColormapNotify"><emphasis role='bold'>ColormapNotify</emphasis></link>
10066event is generated on every window having cmap as an attribute.
10067In addition,
10068for every other colormap that is installed or uninstalled as a result
10069of the request, a
10070<emphasis role='bold'>ColormapNotify</emphasis>
10071event is generated on every window having that colormap as an attribute.
10072</para>
10073<para>
10074At any time, there is a subset of the installed maps that are viewed as an
10075ordered list and are called the required list.
10076The length of the required list is at most M,
10077where M is the min-installed-maps specified for the screen in the
10078connection setup.
10079The required list is maintained as follows.
10080When a colormap is an explicit argument to
10081<emphasis role='bold'>InstallColormap</emphasis>,
10082it is added to the head of the list; the list is truncated at the
10083tail, if necessary, to keep the length of the list to at most M.
10084When a colormap is an explicit argument to
10085<link linkend="requests:UninstallColormap"><emphasis role='bold'>UninstallColormap</emphasis></link>
10086and it is in the required list, it is removed from the list.
10087A colormap is not added to the required list when it is installed implicitly
10088by the server, and the server cannot implicitly uninstall a colormap that is
10089in the required list.
10090</para>
10091<para>
10092Initially the default colormap for a screen is installed (but is not in
10093the required list).
10094<!-- .sp -->
10095</para>
10096  </section>
10097  <section id="requests:UninstallColormap">
10098    <title>UninstallColormap</title>
10099    <indexterm zone="requests:UninstallColormap" significance="preferred"><primary>UninstallColormap</primary></indexterm>
10100<informaltable frame='none'>
10101  <?dbfo keep-together="always" ?>
10102  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10103  <colspec colname='c1' colwidth='1.0*'/>
10104  <tbody>
10105    <row>
10106      <entry>
10107<!-- .in +.2i -->
10108<emphasis remap='I'>cmap</emphasis>: COLORMAP
10109<!-- .in -.2i -->
10110      </entry>
10111    </row>
10112    <row>
10113      <entry>
10114<!-- .in +.2i -->
10115Errors:
10116<emphasis role='bold'>Colormap</emphasis>
10117<!-- .in -.2i -->
10118<!-- .eM -->
10119      </entry>
10120    </row>
10121  </tbody>
10122  </tgroup>
10123</informaltable>
10124<!-- .eM -->
10125<para>
10126If cmap is on the required list for its screen (see
10127<link linkend="requests:InstallColormap"><emphasis role='bold'>InstallColormap</emphasis></link>
10128request),
10129it is removed from the list.
10130As a side effect,
10131cmap might be uninstalled,
10132and additional colormaps might be implicitly installed or uninstalled.
10133Which colormaps get installed or uninstalled is server-dependent
10134except that the required list must remain installed.
10135</para>
10136<para>
10137If cmap becomes uninstalled, a
10138<link linkend="events:ColormapNotify"><emphasis role='bold'>ColormapNotify</emphasis></link>
10139event is generated on every window having cmap as an attribute.
10140In addition,
10141for every other colormap that is installed or uninstalled as a result of
10142the request, a
10143<emphasis role='bold'>ColormapNotify</emphasis>
10144event is generated on every window having that colormap as an attribute.
10145<!-- .sp -->
10146</para>
10147  </section>
10148  <section id="requests:ListInstalledColormaps">
10149    <title>ListInstalledColormaps</title>
10150    <indexterm zone="requests:ListInstalledColormaps" significance="preferred"><primary>ListInstalledColormaps</primary></indexterm>
10151<informaltable frame='none'>
10152  <?dbfo keep-together="always" ?>
10153  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10154  <colspec colname='c1' colwidth='1.0*'/>
10155  <tbody>
10156    <row>
10157      <entry>
10158<!-- .in +.2i -->
10159<emphasis remap='I'>window</emphasis>: WINDOW
10160<!-- .in -.2i -->
10161      </entry>
10162    </row>
10163    <row>
10164      <entry>
1016510166      </entry>
10167    </row>
10168    <row>
10169      <entry>
10170<!-- .in +.2i -->
10171cmaps: LISTofCOLORMAP
10172<!-- .in -.2i -->
10173      </entry>
10174    </row>
10175    <row>
10176      <entry>
10177<!-- .in +.2i -->
10178Errors:
10179<emphasis role='bold'>Window</emphasis>
10180<!-- .in -.2i -->
10181<!-- .eM -->
10182      </entry>
10183    </row>
10184  </tbody>
10185  </tgroup>
10186</informaltable>
10187<!-- .eM -->
10188<para>
10189This request returns a list of the currently installed colormaps for the
10190screen of the specified window.
10191The order of colormaps is not significant,
10192and there is no explicit indication of the required list (see
10193<link linkend="requests:InstallColormap"><emphasis role='bold'>InstallColormap</emphasis></link>
10194request).
10195<!-- .sp -->
10196</para>
10197  </section>
10198  <section id="requests:AllocColor">
10199    <title>AllocColor</title>
10200    <indexterm zone="requests:AllocColor" significance="preferred"><primary>AllocColor</primary></indexterm>
10201<informaltable frame='none'>
10202  <?dbfo keep-together="always" ?>
10203  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10204  <colspec colname='c1' colwidth='1.0*'/>
10205  <tbody>
10206    <row>
10207      <entry>
10208<!-- .in +.2i -->
10209<emphasis remap='I'>cmap</emphasis>: COLORMAP
10210      </entry>
10211    </row>
10212    <row>
10213      <entry>
10214<emphasis remap='I'>red</emphasis>, <emphasis remap='I'>green</emphasis>, <emphasis remap='I'>blue</emphasis>: CARD16
10215<!-- .in -.2i -->
10216      </entry>
10217    </row>
10218    <row>
10219      <entry>
1022010221      </entry>
10222    </row>
10223    <row>
10224      <entry>
10225<!-- .in +.2i -->
10226pixel: CARD32
10227      </entry>
10228    </row>
10229    <row>
10230      <entry>
10231red, green, blue: CARD16
10232<!-- .in -.2i -->
10233      </entry>
10234    </row>
10235    <row>
10236      <entry>
10237<!-- .in +.2i -->
10238Errors:
10239<emphasis role='bold'>Alloc</emphasis>,
10240<emphasis role='bold'>Colormap</emphasis>
10241<!-- .in -.2i -->
10242<!-- .eM -->
10243      </entry>
10244    </row>
10245  </tbody>
10246  </tgroup>
10247</informaltable>
10248<!-- .eM -->
10249<para>
10250This request allocates a read-only colormap entry corresponding to the closest
10251RGB values provided by the hardware.
10252It also returns the pixel and the RGB values actually used.
10253Multiple clients requesting the same effective RGB values can be assigned
10254the same read-only entry, allowing entries to be shared.
10255<!-- .sp -->
10256</para>
10257  </section>
10258  <section id="requests:AllocNamedColor">
10259    <title>AllocNamedColor</title>
10260    <indexterm zone="requests:AllocNamedColor" significance="preferred"><primary>AllocNamedColor</primary></indexterm>
10261<informaltable frame='none'>
10262  <?dbfo keep-together="always" ?>
10263  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10264  <colspec colname='c1' colwidth='1.0*'/>
10265  <tbody>
10266    <row>
10267      <entry>
10268<!-- .in +.2i -->
10269<emphasis remap='I'>cmap</emphasis>: COLORMAP
10270      </entry>
10271    </row>
10272    <row>
10273      <entry>
10274<emphasis remap='I'>name</emphasis>: STRING8
10275<!-- .in -.2i -->
10276      </entry>
10277    </row>
10278    <row>
10279      <entry>
1028010281      </entry>
10282    </row>
10283    <row>
10284      <entry>
10285<!-- .in +.2i -->
10286pixel: CARD32
10287      </entry>
10288    </row>
10289    <row>
10290      <entry>
10291exact-red, exact-green, exact-blue: CARD16
10292      </entry>
10293    </row>
10294    <row>
10295      <entry>
10296visual-red, visual-green, visual-blue: CARD16
10297<!-- .in -.2i -->
10298      </entry>
10299    </row>
10300    <row>
10301      <entry>
10302<!-- .in +.2i -->
10303Errors:
10304<emphasis role='bold'>Alloc</emphasis>,
10305<emphasis role='bold'>Colormap</emphasis>,
10306<emphasis role='bold'>Name</emphasis>
10307<!-- .in -.2i -->
10308<!-- .eM -->
10309      </entry>
10310    </row>
10311  </tbody>
10312  </tgroup>
10313</informaltable>
10314<!-- .eM -->
10315<para>
10316This request looks up the named color with respect to the screen associated
10317with the colormap.
10318Then, it does an
10319<link linkend="requests:AllocColor"><emphasis role='bold'>AllocColor</emphasis></link>
10320on cmap.
10321The name should use the ISO Latin-1 encoding,
10322and uppercase and lowercase do not matter.
10323The exact RGB values specify the true values for the color,
10324and the visual values specify the values actually used in the colormap.
10325<!-- .sp -->
10326</para>
10327  </section>
10328  <section id="requests:AllocColorCells">
10329    <title>AllocColorCells</title>
10330    <indexterm zone="requests:AllocColorCells" significance="preferred"><primary>AllocColorCells</primary></indexterm>
10331<informaltable frame='none'>
10332  <?dbfo keep-together="always" ?>
10333  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10334  <colspec colname='c1' colwidth='1.0*'/>
10335  <tbody>
10336    <row>
10337      <entry>
10338<!-- .in +.2i -->
10339<emphasis remap='I'>cmap</emphasis>: COLORMAP
10340      </entry>
10341    </row>
10342    <row>
10343      <entry>
10344<emphasis remap='I'>colors</emphasis>, <emphasis remap='I'>planes</emphasis>: CARD16
10345      </entry>
10346    </row>
10347    <row>
10348      <entry>
10349<emphasis remap='I'>contiguous</emphasis>: BOOL
10350<!-- .in -.2i -->
10351      </entry>
10352    </row>
10353    <row>
10354      <entry>
1035510356      </entry>
10357    </row>
10358    <row>
10359      <entry>
10360<!-- .in +.2i -->
10361pixels, masks: LISTofCARD32
10362<!-- .in -.2i -->
10363      </entry>
10364    </row>
10365    <row>
10366      <entry>
10367<!-- .in +.2i -->
10368Errors:
10369<emphasis role='bold'>Alloc</emphasis>,
10370<emphasis role='bold'>Colormap</emphasis>,
10371<emphasis role='bold'>Value</emphasis>
10372<!-- .in -.2i -->
10373<!-- .eM -->
10374      </entry>
10375    </row>
10376  </tbody>
10377  </tgroup>
10378</informaltable>
10379<!-- .eM -->
10380<para>
10381The number of colors must be positive,
10382and the number of planes must be nonnegative (or a
10383<emphasis role='bold'>Value</emphasis>
10384error results).
10385If C colors and P planes are requested,
10386then C pixels and P masks are returned.
10387No mask will have any bits in common with any other mask
10388or with any of the pixels.
10389By ORing together masks and pixels,
10390C*%2 sup P% distinct pixels can be produced;
10391all of these are allocated writable by the request.
10392For
10393<emphasis role='bold'>GrayScale</emphasis>
10394or
10395<emphasis role='bold'>PseudoColor</emphasis>,
10396each mask will have exactly one bit set to 1; for
10397<emphasis role='bold'>DirectColor</emphasis>,
10398each will have exactly three bits set to 1.
10399If contiguous is
10400<emphasis role='bold'>True</emphasis>
10401and if all masks are ORed together,
10402a single contiguous set of bits will be formed for
10403<emphasis role='bold'>GrayScale</emphasis>
10404or
10405<emphasis role='bold'>PseudoColor</emphasis>,
10406and three contiguous sets of bits (one within each pixel subfield) for
10407<emphasis role='bold'>DirectColor</emphasis>.
10408The RGB values of the allocated entries are undefined.
10409<!-- .sp -->
10410</para>
10411  </section>
10412  <section id="requests:AllocColorPlanes">
10413    <title>AllocColorPlanes</title>
10414    <indexterm zone="requests:AllocColorPlanes" significance="preferred"><primary>AllocColorPlanes</primary></indexterm>
10415<informaltable frame='none'>
10416  <?dbfo keep-together="always" ?>
10417  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10418  <colspec colname='c1' colwidth='1.0*'/>
10419  <tbody>
10420    <row>
10421      <entry>
10422<!-- .in +.2i -->
10423<emphasis remap='I'>cmap</emphasis>: COLORMAP
10424      </entry>
10425    </row>
10426    <row>
10427      <entry>
10428<emphasis remap='I'>colors</emphasis>, <emphasis remap='I'>reds</emphasis>, <emphasis remap='I'>greens</emphasis>, <emphasis remap='I'>blues</emphasis>: CARD16
10429      </entry>
10430    </row>
10431    <row>
10432      <entry>
10433<emphasis remap='I'>contiguous</emphasis>: BOOL
10434<!-- .in -.2i -->
10435      </entry>
10436    </row>
10437    <row>
10438      <entry>
1043910440      </entry>
10441    </row>
10442    <row>
10443      <entry>
10444<!-- .in +.2i -->
10445pixels: LISTofCARD32
10446      </entry>
10447    </row>
10448    <row>
10449      <entry>
10450red-mask, green-mask, blue-mask: CARD32
10451<!-- .in -.2i -->
10452      </entry>
10453    </row>
10454    <row>
10455      <entry>
10456<!-- .in +.2i -->
10457Errors:
10458<emphasis role='bold'>Alloc</emphasis>,
10459<emphasis role='bold'>Colormap</emphasis>,
10460<emphasis role='bold'>Value</emphasis>
10461<!-- .in -.2i -->
10462<!-- .eM -->
10463      </entry>
10464    </row>
10465  </tbody>
10466  </tgroup>
10467</informaltable>
10468<!-- .eM -->
10469<para>
10470The number of colors must be positive,
10471and the reds, greens, and blues must be nonnegative (or a
10472<emphasis role='bold'>Value</emphasis>
10473error results).
10474If C colors, R reds, G greens, and B blues are requested,
10475then C pixels are returned, and the masks have R, G, and B bits set,
10476respectively.
10477If contiguous is
10478<emphasis role='bold'>True</emphasis>,
10479then each mask will have a contiguous set of bits.
10480No mask will have any bits in common with any other mask
10481or with any of the pixels.
10482For
10483<emphasis role='bold'>DirectColor</emphasis>,
10484each mask will lie within the corresponding pixel subfield.
10485By ORing together subsets of masks with pixels,
10486C*%2 sup R+G+B% distinct pixels can be produced;
10487all of these are allocated writable by the request.
10488The initial RGB values of the allocated entries are undefined.
10489In the colormap,
10490there are only C*%2 sup R% independent red entries,
10491C*%2 sup G% independent green entries,
10492and C*%2 sup B% independent blue entries.
10493This is true even for
10494<emphasis role='bold'>PseudoColor</emphasis>.
10495When the colormap entry for a pixel value is changed using
10496<link linkend="requests:StoreColors"><emphasis role='bold'>StoreColors</emphasis></link>
10497or
10498<link linkend="requests:StoreNamedColor"><emphasis role='bold'>StoreNamedColor</emphasis></link>,
10499the pixel is decomposed according to the masks and the
10500corresponding independent entries are updated.
10501<!-- .sp -->
10502</para>
10503  </section>
10504  <section id="requests:FreeColors">
10505    <title>FreeColors</title>
10506    <indexterm zone="requests:FreeColors" significance="preferred"><primary>FreeColors</primary></indexterm>
10507<informaltable frame='none'>
10508  <?dbfo keep-together="always" ?>
10509  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10510  <colspec colname='c1' colwidth='1.0*'/>
10511  <tbody>
10512    <row>
10513      <entry>
10514<!-- .in +.2i -->
10515<emphasis remap='I'>cmap</emphasis>: COLORMAP
10516      </entry>
10517    </row>
10518    <row>
10519      <entry>
10520<emphasis remap='I'>pixels</emphasis>: LISTofCARD32
10521      </entry>
10522    </row>
10523    <row>
10524      <entry>
10525<emphasis remap='I'>plane-mask</emphasis>: CARD32
10526<!-- .in -.2i -->
10527      </entry>
10528    </row>
10529    <row>
10530      <entry>
10531<!-- .in +.2i -->
10532Errors:
10533<emphasis role='bold'>Access</emphasis>,
10534<emphasis role='bold'>Colormap</emphasis>,
10535<emphasis role='bold'>Value</emphasis>
10536<!-- .in -.2i -->
10537<!-- .eM -->
10538      </entry>
10539    </row>
10540  </tbody>
10541  </tgroup>
10542</informaltable>
10543<!-- .eM -->
10544<para>
10545The plane-mask should not have any bits in common with any of the
10546pixels.
10547The set of all pixels is produced by ORing together subsets of
10548plane-mask with the pixels.
10549The request frees all of these pixels that
10550were allocated by the client (using
10551<link linkend="requests:AllocColor"><emphasis role='bold'>AllocColor</emphasis></link>,
10552<link linkend="requests:AllocNamedColor"><emphasis role='bold'>AllocNamedColor</emphasis></link>,
10553<link linkend="requests:AllocColorCells"><emphasis role='bold'>AllocColorCells</emphasis></link>,
10554and
10555<link linkend="requests:AllocColorPlanes"><emphasis role='bold'>AllocColorPlanes</emphasis></link>).
10556Note that freeing an
10557individual pixel obtained from
10558<link linkend="requests:AllocColorPlanes"><emphasis role='bold'>AllocColorPlanes</emphasis></link>
10559may not actually allow it to be reused until all of its related pixels
10560are also freed.
10561Similarly, a read-only entry is not actually freed until it has been
10562freed by all clients, and if a client allocates the same read-only entry
10563multiple times, it must free the entry that many times before the
10564entry is actually freed.
10565</para>
10566<para>
10567All specified pixels that are allocated by the client in cmap are freed,
10568even if one or more pixels produce an error.
10569A
10570<emphasis role='bold'>Value</emphasis>
10571error is generated if a specified pixel is not a valid index into cmap.
10572An
10573<emphasis role='bold'>Access</emphasis>
10574error is generated if a specified pixel is not allocated by the
10575client (that is, is unallocated or is only allocated by another client)
10576or if the colormap was created with all entries writable (using an alloc
10577value of
10578<emphasis role='bold'>All</emphasis>
10579in
10580<link linkend="requests:CreateColormap"><emphasis role='bold'>CreateColormap</emphasis></link>).
10581If more than one pixel is in error,
10582it is arbitrary as to which pixel is reported.
10583<!-- .sp -->
10584</para>
10585  </section>
10586  <section id="requests:StoreColors">
10587    <title>StoreColors</title>
10588    <indexterm zone="requests:StoreColors" significance="preferred"><primary>StoreColors</primary></indexterm>
10589
10590<informaltable frame='none'>
10591  <?dbfo keep-together="always" ?>
10592  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10593  <colspec colname='c1' colwidth='1.0*'/>
10594  <tbody>
10595    <row>
10596      <entry>
10597<emphasis remap='I'>cmap</emphasis>: COLORMAP
10598      </entry>
10599    </row>
10600    <row>
10601      <entry>
10602<emphasis remap='I'>items</emphasis>: LISTofCOLORITEM
10603      </entry>
10604    </row>
10605    <row>
10606      <entry>
10607where:
10608      </entry>
10609    </row>
10610    <row>
10611      <entry>
10612        <para>
10613        <informaltable frame='none'>
10614  <?dbfo keep-together="always" ?>
10615          <tgroup cols='2' align='left' colsep='0' rowsep='0'>
10616          <colspec colname='c1' colwidth='1.0*'/>
10617          <colspec colname='c2' colwidth='2.0*'/>
10618          <tbody>
10619          <row>
10620            <entry>COLORITEM:</entry>
10621            <entry>[pixel: CARD32</entry>
10622          </row>
10623          <row>
10624            <entry></entry>
10625            <entry>
10626do-red, do-green, do-blue: BOOL
10627            </entry>
10628          </row>
10629          <row>
10630            <entry></entry>
10631            <entry>
10632red, green, blue: CARD16]
10633            </entry>
10634          </row>
10635          </tbody>
10636          </tgroup>
10637        </informaltable>
10638        </para>
10639      </entry>
10640    </row>
10641    <row>
10642      <entry>
10643Errors:
10644<emphasis role='bold'>Access</emphasis>,
10645<emphasis role='bold'>Colormap</emphasis>,
10646<emphasis role='bold'>Value</emphasis>
10647      </entry>
10648    </row>
10649  </tbody>
10650  </tgroup>
10651</informaltable>
10652
10653<para>
10654This request changes the colormap entries of the specified pixels.
10655The do-red, do-green, and do-blue fields indicate which components
10656should actually be changed.
10657If the colormap is an installed map for its screen,
10658the changes are visible immediately.
10659</para>
10660<para>
10661All specified pixels that are allocated writable in cmap (by any client)
10662are changed, even if one or more pixels produce an error.
10663A
10664<emphasis role='bold'>Value</emphasis>
10665error is generated if a specified pixel is not a valid index into cmap, and an
10666<emphasis role='bold'>Access</emphasis>
10667error is generated if a specified pixel is unallocated or is allocated
10668read-only.
10669If more than one pixel is in error,
10670it is arbitrary as to which pixel is reported.
10671<!-- .sp -->
10672</para>
10673  </section>
10674  <section id="requests:StoreNamedColor">
10675    <title>StoreNamedColor</title>
10676    <indexterm zone="requests:StoreNamedColor" significance="preferred"><primary>StoreNamedColor</primary></indexterm>
10677<informaltable frame='none'>
10678  <?dbfo keep-together="always" ?>
10679  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10680  <colspec colname='c1' colwidth='1.0*'/>
10681  <tbody>
10682    <row>
10683      <entry>
10684<!-- .in +.2i -->
10685<emphasis remap='I'>cmap</emphasis>: COLORMAP
10686      </entry>
10687    </row>
10688    <row>
10689      <entry>
10690<emphasis remap='I'>pixel</emphasis>: CARD32
10691      </entry>
10692    </row>
10693    <row>
10694      <entry>
10695<emphasis remap='I'>name</emphasis>: STRING8
10696      </entry>
10697    </row>
10698    <row>
10699      <entry>
10700<emphasis remap='I'>do-red</emphasis>, <emphasis remap='I'>do-green</emphasis>, <emphasis remap='I'>do-blue</emphasis>: BOOL
10701<!-- .in -.2i -->
10702      </entry>
10703    </row>
10704    <row>
10705      <entry>
10706<!-- .in +.2i -->
10707Errors:
10708<emphasis role='bold'>Access</emphasis>,
10709<emphasis role='bold'>Colormap</emphasis>,
10710<emphasis role='bold'>Name</emphasis>,
10711<emphasis role='bold'>Value</emphasis>
10712<!-- .in -.2i -->
10713<!-- .eM -->
10714      </entry>
10715    </row>
10716  </tbody>
10717  </tgroup>
10718</informaltable>
10719<!-- .eM -->
10720<para>
10721This request looks up the named color with respect to the screen associated
10722with cmap and then does a
10723<link linkend="requests:StoreColors"><emphasis role='bold'>StoreColors</emphasis></link>
10724in cmap.
10725The name should use the ISO Latin-1 encoding,
10726and uppercase and lowercase do not matter.
10727The
10728<emphasis role='bold'>Access</emphasis>
10729and
10730<emphasis role='bold'>Value</emphasis>
10731errors are the same as in
10732<emphasis role='bold'>StoreColors</emphasis>.
10733<!-- .sp -->
10734</para>
10735  </section>
10736  <section id="requests:QueryColors">
10737    <title>QueryColors</title>
10738    <indexterm zone="requests:QueryColors" significance="preferred"><primary>QueryColors</primary></indexterm>
10739<informaltable frame='none'>
10740  <?dbfo keep-together="always" ?>
10741  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10742  <colspec colname='c1' colwidth='1.0*'/>
10743  <tbody>
10744    <row>
10745      <entry>
10746<!-- .in +.2i -->
10747<emphasis remap='I'>cmap</emphasis>: COLORMAP
10748      </entry>
10749    </row>
10750    <row>
10751      <entry>
10752<emphasis remap='I'>pixels</emphasis>: LISTofCARD32
10753<!-- .in -.2i -->
10754      </entry>
10755    </row>
10756    <row>
10757      <entry>
1075810759      </entry>
10760    </row>
10761    <row>
10762      <entry>
10763<!-- .in +.2i -->
10764colors: LISTofRGB
10765<!-- .in -.2i -->
10766      </entry>
10767    </row>
10768    <row>
10769      <entry>
10770<!-- .in +.2i -->
10771where:
10772<!-- .in -.2i -->
10773      </entry>
10774    </row>
10775    <row>
10776      <entry>
10777<!-- .in +.2i -->
10778RGB: [red, green, blue: CARD16]
10779<!-- .in -.2i -->
10780      </entry>
10781    </row>
10782    <row>
10783      <entry>
10784<!-- .in +.2i -->
10785Errors:
10786<emphasis role='bold'>Colormap</emphasis>,
10787<emphasis role='bold'>Value</emphasis>
10788<!-- .in -.2i -->
10789<!-- .eM -->
10790      </entry>
10791    </row>
10792  </tbody>
10793  </tgroup>
10794</informaltable>
10795<!-- .eM -->
10796<para>
10797This request returns the hardware-specific color values stored in cmap for
10798the specified pixels.
10799The values returned for an unallocated entry are undefined.
10800A
10801<emphasis role='bold'>Value</emphasis>
10802error is generated if a pixel is not a valid index into cmap.
10803If more than one pixel is in error,
10804it is arbitrary as to which pixel is reported.
10805<!-- .sp -->
10806</para>
10807  </section>
10808  <section id="requests:LookupColor">
10809    <title>LookupColor</title>
10810    <indexterm zone="requests:LookupColor" significance="preferred"><primary>LookupColor</primary></indexterm>
10811<informaltable frame='none'>
10812  <?dbfo keep-together="always" ?>
10813  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10814  <colspec colname='c1' colwidth='1.0*'/>
10815  <tbody>
10816    <row>
10817      <entry>
10818<!-- .in +.2i -->
10819<emphasis remap='I'>cmap</emphasis>: COLORMAP
10820      </entry>
10821    </row>
10822    <row>
10823      <entry>
10824<emphasis remap='I'>name</emphasis>: STRING8
10825<!-- .in -.2i -->
10826      </entry>
10827    </row>
10828    <row>
10829      <entry>
1083010831      </entry>
10832    </row>
10833    <row>
10834      <entry>
10835<!-- .in +.2i -->
10836exact-red, exact-green, exact-blue: CARD16
10837      </entry>
10838    </row>
10839    <row>
10840      <entry>
10841visual-red, visual-green, visual-blue: CARD16
10842<!-- .in -.2i -->
10843      </entry>
10844    </row>
10845    <row>
10846      <entry>
10847<!-- .in +.2i -->
10848Errors:
10849<emphasis role='bold'>Colormap</emphasis>,
10850<emphasis role='bold'>Name</emphasis>
10851<!-- .in -.2i -->
10852<!-- .eM -->
10853      </entry>
10854    </row>
10855  </tbody>
10856  </tgroup>
10857</informaltable>
10858<!-- .eM -->
10859<para>
10860This request looks up the string name of a color with respect to the screen
10861associated with cmap and returns both the exact color values and
10862the closest values provided by the hardware with respect to the visual
10863type of cmap.
10864The name should use the ISO Latin-1 encoding,
10865and uppercase and lowercase do not matter.
10866<!-- .sp -->
10867</para>
10868  </section>
10869  <section id="requests:CreateCursor">
10870    <title>CreateCursor</title>
10871    <indexterm zone="requests:CreateCursor" significance="preferred"><primary>CreateCursor</primary></indexterm>
10872    <indexterm zone="requests:CreateCursor"><primary>Cursor</primary></indexterm>
10873<informaltable frame='none'>
10874  <?dbfo keep-together="always" ?>
10875  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10876  <colspec colname='c1' colwidth='1.0*'/>
10877  <tbody>
10878    <row>
10879      <entry>
10880<!-- .in +.2i -->
10881<emphasis remap='I'>cid</emphasis>: CURSOR
10882      </entry>
10883    </row>
10884    <row>
10885      <entry>
10886<emphasis remap='I'>source</emphasis>: PIXMAP
10887      </entry>
10888    </row>
10889    <row>
10890      <entry>
10891<emphasis remap='I'>mask</emphasis>: PIXMAP or
10892<emphasis role='bold'>None</emphasis>
10893      </entry>
10894    </row>
10895    <row>
10896      <entry>
10897<emphasis remap='I'>fore-red</emphasis>, <emphasis remap='I'>fore-green</emphasis>, <emphasis remap='I'>fore-blue</emphasis>: CARD16
10898      </entry>
10899    </row>
10900    <row>
10901      <entry>
10902<emphasis remap='I'>back-red</emphasis>, <emphasis remap='I'>back-green</emphasis>, <emphasis remap='I'>back-blue</emphasis>: CARD16
10903      </entry>
10904    </row>
10905    <row>
10906      <entry>
10907<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: CARD16
10908<!-- .in -.2i -->
10909      </entry>
10910    </row>
10911    <row>
10912      <entry>
10913<!-- .in +.2i -->
10914Errors:
10915<emphasis role='bold'>Alloc</emphasis>,
10916<emphasis role='bold'>IDChoice</emphasis>,
10917<emphasis role='bold'>Match</emphasis>,
10918<emphasis role='bold'>Pixmap</emphasis>
10919<!-- .in -.2i -->
10920<!-- .eM -->
10921      </entry>
10922    </row>
10923  </tbody>
10924  </tgroup>
10925</informaltable>
10926<!-- .eM -->
10927<para>
10928This request creates a cursor and associates identifier cid with it.
10929The foreground and background RGB values must be specified,
10930even if the server only has a
10931<emphasis role='bold'>StaticGray</emphasis>
10932or
10933<emphasis role='bold'>GrayScale</emphasis>
10934screen.
10935The foreground is used for the bits set to 1 in the source,
10936and the background is used for the bits set to 0.
10937Both source and mask (if specified) must have depth one (or a
10938<emphasis role='bold'>Match</emphasis>
10939error results), but they can have any root.
10940The mask pixmap defines the shape of the cursor.
10941That is,
10942the bits set to 1 in the mask define which source pixels will be displayed,
10943and where the mask has bits set to 0,
10944the corresponding bits of the source pixmap are ignored.
10945If no mask is given,
10946all pixels of the source are displayed.
10947The mask, if present, must be the same size as the source (or a
10948<emphasis role='bold'>Match</emphasis>
10949error results).
10950The x and y coordinates define the hotspot relative to the source's origin
10951and must be a point within the source (or a
10952<emphasis role='bold'>Match</emphasis>
10953error results).
10954</para>
10955<para>
10956The components of the cursor may be transformed arbitrarily to meet
10957display limitations.
10958</para>
10959<para>
10960The pixmaps can be freed immediately if no further explicit references
10961to them are to be made.
10962</para>
10963<para>
10964Subsequent drawing in the source or mask pixmap has an undefined effect
10965on the cursor.
10966The server might or might not make a copy of the pixmap.
10967<!-- .sp -->
10968</para>
10969  </section>
10970  <section id="requests:CreateGlyphCursor">
10971    <title>CreateGlyphCursor</title>
10972    <indexterm zone="requests:CreateGlyphCursor" significance="preferred"><primary>CreateGlyphCursor</primary></indexterm>
10973<informaltable frame='none'>
10974  <?dbfo keep-together="always" ?>
10975  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
10976  <colspec colname='c1' colwidth='1.0*'/>
10977  <tbody>
10978    <row>
10979      <entry>
10980<!-- .in +.2i -->
10981<emphasis remap='I'>cid</emphasis>: CURSOR
10982      </entry>
10983    </row>
10984    <row>
10985      <entry>
10986<emphasis remap='I'>source-font</emphasis>: FONT
10987      </entry>
10988    </row>
10989    <row>
10990      <entry>
10991<emphasis remap='I'>mask-font</emphasis>: FONT or
10992<emphasis role='bold'>None</emphasis>
10993      </entry>
10994    </row>
10995    <row>
10996      <entry>
10997<emphasis remap='I'>source-char</emphasis>, <emphasis remap='I'>mask-char</emphasis>: CARD16
10998      </entry>
10999    </row>
11000    <row>
11001      <entry>
11002<emphasis remap='I'>fore-red</emphasis>, <emphasis remap='I'>fore-green</emphasis>, <emphasis remap='I'>fore-blue</emphasis>: CARD16
11003      </entry>
11004    </row>
11005    <row>
11006      <entry>
11007<emphasis remap='I'>back-red</emphasis>, <emphasis remap='I'>back-green</emphasis>, <emphasis remap='I'>back-blue</emphasis>: CARD16
11008<!-- .in -.2i -->
11009      </entry>
11010    </row>
11011    <row>
11012      <entry>
11013<!-- .in +.2i -->
11014Errors:
11015<emphasis role='bold'>Alloc</emphasis>,
11016<emphasis role='bold'>Font</emphasis>,
11017<emphasis role='bold'>IDChoice</emphasis>,
11018<emphasis role='bold'>Value</emphasis>
11019<!-- .in -.2i -->
11020<!-- .eM -->
11021      </entry>
11022    </row>
11023  </tbody>
11024  </tgroup>
11025</informaltable>
11026<!-- .eM -->
11027<para>
11028This request is similar to
11029<link linkend="requests:CreateCursor"><emphasis role='bold'>CreateCursor</emphasis></link>,
11030except the source and mask bitmaps are obtained from the specified font glyphs.
11031The source-char must be a defined glyph in source-font,
11032and if mask-font is given, mask-char must be a defined glyph in mask-font
11033(or a
11034<emphasis role='bold'>Value</emphasis>
11035error results).
11036The mask font and character are optional.
11037The origins of the source and mask (if it is defined) glyphs
11038are positioned coincidently and define the hotspot.
11039The source and mask need not have the same bounding box metrics,
11040and there is no restriction on the placement of the hotspot relative
11041to the bounding boxes.
11042If no mask is given,
11043all pixels of the source are displayed.
11044Note that source-char and mask-char are CARD16, not CHAR2B.
11045For 2-byte matrix fonts,
11046the 16-bit value should be formed with byte1 in the most significant byte
11047and byte2 in the least significant byte.
11048</para>
11049<para>
11050The components of the cursor may be transformed arbitrarily to meet
11051display limitations.
11052</para>
11053<para>
11054The fonts can be freed immediately if no further explicit references to
11055them are to be made.
11056<!-- .sp -->
11057</para>
11058  </section>
11059  <section id="requests:FreeCursor">
11060    <title>FreeCursor</title>
11061    <indexterm zone="requests:FreeCursor" significance="preferred"><primary>FreeCursor</primary></indexterm>
11062<informaltable frame='none'>
11063  <?dbfo keep-together="always" ?>
11064  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11065  <colspec colname='c1' colwidth='1.0*'/>
11066  <tbody>
11067    <row>
11068      <entry>
11069<!-- .in +.2i -->
11070<emphasis remap='I'>cursor</emphasis>: CURSOR
11071<!-- .in -.2i -->
11072      </entry>
11073    </row>
11074    <row>
11075      <entry>
11076<!-- .in +.2i -->
11077Errors:
11078<emphasis role='bold'>Cursor</emphasis>
11079<!-- .in -.2i -->
11080<!-- .eM -->
11081      </entry>
11082    </row>
11083  </tbody>
11084  </tgroup>
11085</informaltable>
11086<!-- .eM -->
11087<para>
11088This request deletes the association between the resource ID and the cursor.
11089The cursor storage will be freed when no other resource references it.
11090<!-- .sp -->
11091</para>
11092  </section>
11093  <section id="requests:RecolorCursor">
11094    <title>RecolorCursor</title>
11095    <indexterm zone="requests:RecolorCursor" significance="preferred"><primary>RecolorCursor</primary></indexterm>
11096<informaltable frame='none'>
11097  <?dbfo keep-together="always" ?>
11098  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11099  <colspec colname='c1' colwidth='1.0*'/>
11100  <tbody>
11101    <row>
11102      <entry>
11103<!-- .in +.2i -->
11104<emphasis remap='I'>cursor</emphasis>: CURSOR
11105      </entry>
11106    </row>
11107    <row>
11108      <entry>
11109<emphasis remap='I'>fore-red</emphasis>, <emphasis remap='I'>fore-green</emphasis>, <emphasis remap='I'>fore-blue</emphasis>: CARD16
11110      </entry>
11111    </row>
11112    <row>
11113      <entry>
11114<emphasis remap='I'>back-red</emphasis>, <emphasis remap='I'>back-green</emphasis>, <emphasis remap='I'>back-blue</emphasis>: CARD16
11115<!-- .in -.2i -->
11116      </entry>
11117    </row>
11118    <row>
11119      <entry>
11120<!-- .in +.2i -->
11121Errors:
11122<emphasis role='bold'>Cursor</emphasis>
11123<!-- .in -.2i -->
11124<!-- .eM -->
11125      </entry>
11126    </row>
11127  </tbody>
11128  </tgroup>
11129</informaltable>
11130<!-- .eM -->
11131<para>
11132This request changes the color of a cursor.
11133If the cursor is being displayed on a screen,
11134the change is visible immediately.
11135<!-- .sp -->
11136</para>
11137  </section>
11138  <section id="requests:QueryBestSize">
11139    <title>QueryBestSize</title>
11140    <indexterm zone="requests:QueryBestSize" significance="preferred"><primary>QueryBestSize</primary></indexterm>
11141<informaltable frame='none'>
11142  <?dbfo keep-together="always" ?>
11143  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11144  <colspec colname='c1' colwidth='1.0*'/>
11145  <tbody>
11146    <row>
11147      <entry>
11148<!-- .in +.2i -->
11149<emphasis remap='I'>class</emphasis>:
11150{ <emphasis role='bold'>Cursor</emphasis>,
11151<emphasis role='bold'>Tile</emphasis>,
11152<emphasis role='bold'>Stipple</emphasis>}
11153      </entry>
11154    </row>
11155    <row>
11156      <entry>
11157<emphasis remap='I'>drawable</emphasis>: DRAWABLE
11158      </entry>
11159    </row>
11160    <row>
11161      <entry>
11162<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
11163<!-- .in -.2i -->
11164      </entry>
11165    </row>
11166    <row>
11167      <entry>
1116811169      </entry>
11170    </row>
11171    <row>
11172      <entry>
11173<!-- .in +.2i -->
11174width, height: CARD16
11175<!-- .in -.2i -->
11176      </entry>
11177    </row>
11178    <row>
11179      <entry>
11180<!-- .in +.2i -->
11181Errors:
11182<emphasis role='bold'>Drawable</emphasis>,
11183<emphasis role='bold'>Match</emphasis>,
11184<emphasis role='bold'>Value</emphasis>
11185<!-- .in -.2i -->
11186<!-- .eM -->
11187      </entry>
11188    </row>
11189  </tbody>
11190  </tgroup>
11191</informaltable>
11192<!-- .eM -->
11193<para>
11194This request returns the best size that is closest to the argument size.
11195For
11196<emphasis role='bold'>Cursor</emphasis>,
11197this is the largest size that can be fully displayed.
11198For
11199<emphasis role='bold'>Tile</emphasis>,
11200this is the size that can be tiled fastest.
11201For
11202<emphasis role='bold'>Stipple</emphasis>,
11203this is the size that can be stippled fastest.
11204</para>
11205<para>
11206For
11207<emphasis role='bold'>Cursor</emphasis>,
11208the drawable indicates the desired screen.
11209For
11210<emphasis role='bold'>Tile</emphasis>
11211and
11212<emphasis role='bold'>Stipple</emphasis>,
11213the drawable indicates the screen and also possibly the window class and depth.
11214An
11215<emphasis role='bold'>InputOnly</emphasis>
11216window cannot be used as the drawable for
11217<emphasis role='bold'>Tile</emphasis>
11218or
11219<emphasis role='bold'>Stipple</emphasis>
11220(or a
11221<emphasis role='bold'>Match</emphasis>
11222error results).
11223<!-- .sp -->
11224</para>
11225  </section>
11226  <section id="requests:QueryExtension">
11227    <title>QueryExtension</title>
11228    <indexterm zone="requests:QueryExtension" significance="preferred"><primary>QueryExtension</primary></indexterm>
11229    <indexterm zone="requests:QueryExtension"><primary>Extension</primary><secondary>querying</secondary></indexterm>
11230<informaltable frame='none'>
11231  <?dbfo keep-together="always" ?>
11232  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11233  <colspec colname='c1' colwidth='1.0*'/>
11234  <tbody>
11235    <row>
11236      <entry>
11237<!-- .in +.2i -->
11238<emphasis remap='I'>name</emphasis>: STRING8
11239<!-- .in -.2i -->
11240      </entry>
11241    </row>
11242    <row>
11243      <entry>
1124411245      </entry>
11246    </row>
11247    <row>
11248      <entry>
11249<!-- .in +.2i -->
11250present: BOOL
11251      </entry>
11252    </row>
11253    <row>
11254      <entry>
11255major-opcode: CARD8
11256      </entry>
11257    </row>
11258    <row>
11259      <entry>
11260first-event: CARD8
11261      </entry>
11262    </row>
11263    <row>
11264      <entry>
11265first-error: CARD8
11266<!-- .in -.2i -->
11267<!-- .eM -->
11268      </entry>
11269    </row>
11270  </tbody>
11271  </tgroup>
11272</informaltable>
11273<!-- .eM -->
11274<para>
11275This request determines if the named extension is present.
11276If so,
11277the major opcode for the extension is returned, if it has one.
11278Otherwise, zero is returned.
11279Any minor opcode and the request formats are specific to the extension.
11280If the extension involves additional event types,
11281the base event type code is returned.
11282Otherwise, zero is returned.
11283The format of the events is specific to the extension.
11284If the extension involves additional error codes,
11285the base error code is returned.
11286Otherwise, zero is returned.
11287The format of additional data in the errors is specific to the extension.
11288</para>
11289<para>
11290The extension name should use the ISO Latin-1 encoding,
11291and uppercase and lowercase matter.
11292<!-- .sp -->
11293</para>
11294  </section>
11295  <section id="requests:ListExtensions">
11296    <title>ListExtensions</title>
11297    <indexterm zone="requests:ListExtensions" significance="preferred"><primary>ListExtensions</primary></indexterm>
11298    <indexterm zone="requests:ListExtensions"><primary>Extension</primary><secondary>listing</secondary></indexterm>
11299<informaltable frame='none'>
11300  <?dbfo keep-together="always" ?>
11301  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11302  <colspec colname='c1' colwidth='1.0*'/>
11303  <tbody>
11304    <row>
11305      <entry>
1130611307      </entry>
11308    </row>
11309    <row>
11310      <entry>
11311<!-- .in +.2i -->
11312names: LISTofSTRING8
11313<!-- .in -.2i -->
11314<!-- .eM -->
11315      </entry>
11316    </row>
11317  </tbody>
11318  </tgroup>
11319</informaltable>
11320<!-- .eM -->
11321<para>
11322This request returns a list of all extensions supported by the server.
11323</para>
11324  </section>
11325  <section id="requests:SetModifierMapping">
11326    <title>SetModifierMapping</title>
11327    <indexterm zone="requests:SetModifierMapping" significance="preferred"><primary>SetModifierMapping</primary></indexterm>
11328    <indexterm zone="requests:SetModifierMapping"><primary>Modifier keys</primary></indexterm>
11329<informaltable frame='none'>
11330  <?dbfo keep-together="always" ?>
11331  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11332  <colspec colname='c1' colwidth='1.0*'/>
11333  <tbody>
11334    <row>
11335      <entry>
11336<!-- .in +.2i -->
11337<emphasis remap='I'>keycodes-per-modifier</emphasis>: CARD8
11338      </entry>
11339    </row>
11340    <row>
11341      <entry>
11342<emphasis remap='I'>keycodes</emphasis>: LISTofKEYCODE
11343<!-- .in -.2i -->
11344      </entry>
11345    </row>
11346    <row>
11347      <entry>
1134811349      </entry>
11350    </row>
11351    <row>
11352      <entry>
11353<!-- .in +.2i -->
11354status:
11355{ <emphasis role='bold'>Success</emphasis>,
11356<emphasis role='bold'>Busy</emphasis>,
11357<emphasis role='bold'>Failed</emphasis>}
11358<!-- .in -.2i -->
11359      </entry>
11360    </row>
11361    <row>
11362      <entry>
11363<!-- .in +.2i -->
11364Errors:
11365<emphasis role='bold'>Alloc</emphasis>,
11366<emphasis role='bold'>Value</emphasis>
11367<!-- .in -.2i -->
11368<!-- .eM -->
11369      </entry>
11370    </row>
11371  </tbody>
11372  </tgroup>
11373</informaltable>
11374<!-- .eM -->
11375<para>
11376This request specifies the keycodes (if any) of the keys to be used as
11377modifiers.
11378The number of keycodes in the list must be 8*keycodes-per-modifier (or a
11379<emphasis role='bold'>Length</emphasis>
11380error results).
11381The keycodes are divided into eight sets,
11382with each set containing keycodes-per-modifier elements.
11383The sets are assigned to the modifiers
11384<emphasis role='bold'>Shift</emphasis>,
11385<emphasis role='bold'>Lock</emphasis>,
11386<emphasis role='bold'>Control</emphasis>,
11387<emphasis role='bold'>Mod1</emphasis>,
11388<emphasis role='bold'>Mod2</emphasis>,
11389<emphasis role='bold'>Mod3</emphasis>,
11390<emphasis role='bold'>Mod4</emphasis>,
11391and
11392<emphasis role='bold'>Mod5</emphasis>,
11393in order.
11394Only nonzero keycode values are used within each set;
11395zero values are ignored.
11396All of the nonzero keycodes must be in the range specified by min-keycode
11397and max-keycode in the connection setup (or a
11398<emphasis role='bold'>Value</emphasis>
11399error results).
11400The order of keycodes within a set does not matter.
11401If no nonzero values are specified in a set,
11402the use of the corresponding modifier is disabled,
11403and the modifier bit will always be zero.
11404Otherwise, the modifier bit will be one whenever
11405at least one of the keys in the corresponding set is in the down
11406position.
11407</para>
11408<para>
11409A server can impose restrictions on how modifiers can be changed (for example,
11410if certain keys do not generate up transitions in hardware,
11411if auto-repeat cannot be disabled on certain keys,
11412or if multiple keys per modifier are not supported).
11413The status reply is
11414<emphasis role='bold'>Failed</emphasis>
11415if some such restriction is violated,
11416and none of the modifiers is changed.
11417</para>
11418<para>
11419If the new nonzero keycodes specified for a modifier differ from those
11420currently defined and any (current or new) keys for that modifier are
11421logically in the down state, then the status reply is
11422<emphasis role='bold'>Busy</emphasis>,
11423and none of the modifiers is changed.
11424</para>
11425<para>
11426This request generates a
11427<link linkend="events:MappingNotify"><emphasis role='bold'>MappingNotify</emphasis></link>
11428event on a
11429<emphasis role='bold'>Success</emphasis>
11430status.
11431<!-- .sp -->
11432</para>
11433  </section>
11434  <section id="requests:GetModifierMapping">
11435    <title>GetModifierMapping</title>
11436    <indexterm zone="requests:GetModifierMapping" significance="preferred"><primary>GetModifierMapping</primary></indexterm>
11437    <indexterm zone="requests:GetModifierMapping"><primary>Modifier keys</primary></indexterm>
11438<informaltable frame='none'>
11439  <?dbfo keep-together="always" ?>
11440  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11441  <colspec colname='c1' colwidth='1.0*'/>
11442  <tbody>
11443    <row>
11444      <entry>
1144511446      </entry>
11447    </row>
11448    <row>
11449      <entry>
11450<!-- .in +.2i -->
11451keycodes-per-modifier: CARD8
11452      </entry>
11453    </row>
11454    <row>
11455      <entry>
11456keycodes: LISTofKEYCODE
11457<!-- .in -.2i -->
11458<!-- .eM -->
11459      </entry>
11460    </row>
11461  </tbody>
11462  </tgroup>
11463</informaltable>
11464<!-- .eM -->
11465<para>
11466This request returns the keycodes of the keys being used as modifiers.
11467The number of keycodes in the list is 8*keycodes-per-modifier.
11468The keycodes are divided into eight sets,
11469with each set containing keycodes-per-modifier elements.
11470The sets are assigned to the modifiers
11471<emphasis role='bold'>Shift</emphasis>,
11472<emphasis role='bold'>Lock</emphasis>,
11473<emphasis role='bold'>Control</emphasis>,
11474<emphasis role='bold'>Mod1</emphasis>,
11475<emphasis role='bold'>Mod2</emphasis>,
11476<emphasis role='bold'>Mod3</emphasis>,
11477<emphasis role='bold'>Mod4</emphasis>,
11478and
11479<emphasis role='bold'>Mod5</emphasis>,
11480in order.
11481The keycodes-per-modifier value is chosen arbitrarily by the server;
11482zeroes are used to fill in unused elements within each set.
11483If only zero values are given in a set,
11484the use of the corresponding modifier has been disabled.
11485The order of keycodes within each set is chosen arbitrarily by the server.
11486<!-- .sp -->
11487</para>
11488  </section>
11489  <section id="requests:ChangeKeyboardMapping">
11490    <title>ChangeKeyboardMapping</title>
11491    <indexterm zone="requests:ChangeKeyboardMapping" significance="preferred"><primary>ChangeKeyboardMapping</primary></indexterm>
11492    <indexterm zone="requests:ChangeKeyboardMapping"><primary>Keysym</primary></indexterm>
11493<informaltable frame='none'>
11494  <?dbfo keep-together="always" ?>
11495  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11496  <colspec colname='c1' colwidth='1.0*'/>
11497  <tbody>
11498    <row>
11499      <entry>
11500<!-- .in +.2i -->
11501<emphasis remap='I'>first-keycode</emphasis>: KEYCODE
11502      </entry>
11503    </row>
11504    <row>
11505      <entry>
11506<emphasis remap='I'>keysyms-per-keycode</emphasis>: CARD8
11507      </entry>
11508    </row>
11509    <row>
11510      <entry>
11511<emphasis remap='I'>keysyms</emphasis>: LISTofKEYSYM
11512<!-- .in -.2i -->
11513      </entry>
11514    </row>
11515    <row>
11516      <entry>
11517<!-- .in +.2i -->
11518Errors:
11519<emphasis role='bold'>Alloc</emphasis>,
11520<emphasis role='bold'>Value</emphasis>
11521<!-- .in -.2i -->
11522<!-- .eM -->
11523      </entry>
11524    </row>
11525  </tbody>
11526  </tgroup>
11527</informaltable>
11528<!-- .eM -->
11529<para>
11530This request defines the symbols for the specified number of keycodes,
11531starting with the specified keycode.
11532The symbols for keycodes outside this range remained unchanged.
11533The number of elements in the keysyms list must be a multiple of
11534keysyms-per-keycode (or a
11535<emphasis role='bold'>Length</emphasis>
11536error results).
11537The first-keycode must be greater than or equal to min-keycode as returned
11538in the connection setup (or a
11539<emphasis role='bold'>Value</emphasis>
11540error results) and:
11541<literallayout class="monospaced">
11542	first-keycode + (keysyms-length / keysyms-per-keycode) - 1
11543</literallayout>
11544</para>
11545<para>
11546must be less than or equal to max-keycode as returned in the connection
11547setup (or a
11548<emphasis role='bold'>Value</emphasis>
11549error results).
11550KEYSYM number N (counting from zero) for keycode K has an index
11551(counting from zero) of:
11552<literallayout class="monospaced">
11553	(K - first-keycode) * keysyms-per-keycode + N
11554</literallayout>
11555</para>
11556<para>
11557in keysyms.
11558The keysyms-per-keycode can be chosen arbitrarily by the client
11559to be large enough to hold all desired symbols.
11560A special KEYSYM value of
11561<keysym>NoSymbol</keysym>
11562should be used to fill in unused elements for individual keycodes.
11563It is legal for
11564<keysym>NoSymbol</keysym>
11565to appear in nontrailing positions of the effective list for a keycode.
11566</para>
11567<para>
11568This request generates a
11569<link linkend="events:MappingNotify"><emphasis role='bold'>MappingNotify</emphasis></link>
11570event.
11571</para>
11572<para>
11573There is no requirement that the server interpret this mapping;
11574it is merely stored for reading and writing by clients
11575(see <link linkend='Keyboards'>section 5</link>).
11576<!-- .sp -->
11577</para>
11578  </section>
11579  <section id="requests:GetKeyboardMapping">
11580    <title>GetKeyboardMapping</title>
11581    <indexterm zone="requests:GetKeyboardMapping" significance="preferred"><primary>GetKeyboardMapping</primary></indexterm>
11582    <indexterm zone="requests:GetKeyboardMapping"><primary>Keysym</primary></indexterm>
11583<informaltable frame='none'>
11584  <?dbfo keep-together="always" ?>
11585  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11586  <colspec colname='c1' colwidth='1.0*'/>
11587  <tbody>
11588    <row>
11589      <entry>
11590<!-- .in +.2i -->
11591<emphasis remap='I'>first-keycode</emphasis>: KEYCODE
11592      </entry>
11593    </row>
11594    <row>
11595      <entry>
11596<emphasis remap='I'>count</emphasis>: CARD8
11597<!-- .in -.2i -->
11598      </entry>
11599    </row>
11600    <row>
11601      <entry>
1160211603      </entry>
11604    </row>
11605    <row>
11606      <entry>
11607<!-- .in +.2i -->
11608keysyms-per-keycode: CARD8
11609      </entry>
11610    </row>
11611    <row>
11612      <entry>
11613keysyms: LISTofKEYSYM
11614<!-- .in -.2i -->
11615      </entry>
11616    </row>
11617    <row>
11618      <entry>
11619<!-- .in +.2i -->
11620Errors:
11621<emphasis role='bold'>Value</emphasis>
11622<!-- .in -.2i -->
11623<!-- .eM -->
11624      </entry>
11625    </row>
11626  </tbody>
11627  </tgroup>
11628</informaltable>
11629<!-- .eM -->
11630<para>
11631This request returns the symbols for the specified number of keycodes,
11632starting with the specified keycode.
11633The first-keycode must be greater than or equal to
11634min-keycode as returned in the connection setup (or a
11635<emphasis role='bold'>Value</emphasis>
11636error results), and:
11637<literallayout class="monospaced">
11638	first-keycode + count - 1
11639</literallayout>
11640</para>
11641<para>
11642must be less than or equal to max-keycode as returned in the connection setup
11643(or a
11644<emphasis role='bold'>Value</emphasis>
11645error results).
11646The number of elements in the keysyms list is:
11647<literallayout class="monospaced">
11648	count * keysyms-per-keycode
11649</literallayout>
11650</para>
11651<para>
11652and KEYSYM number N (counting from zero) for keycode K has an index
11653(counting from zero) of:
11654<literallayout class="monospaced">
11655	(K - first-keycode) * keysyms-per-keycode + N
11656</literallayout>
11657</para>
11658<para>
11659in keysyms.
11660The keysyms-per-keycode value is chosen arbitrarily by the server
11661to be large enough to report all requested symbols.
11662A special KEYSYM value of
11663<keysym>NoSymbol</keysym>
11664is used to fill in unused elements for individual keycodes.
11665<!-- .sp -->
11666</para>
11667  </section>
11668  <section id="requests:ChangeKeyboardControl">
11669    <title>ChangeKeyboardControl</title>
11670    <indexterm zone="requests:ChangeKeyboardControl" significance="preferred"><primary>ChangeKeyboardControl</primary></indexterm>
11671<informaltable frame='none'>
11672  <?dbfo keep-together="always" ?>
11673  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11674  <colspec colname='c1' colwidth='1.0*'/>
11675  <tbody>
11676    <row>
11677      <entry>
11678<!-- .in +.2i -->
11679<emphasis remap='I'>value-mask</emphasis>: BITMASK
11680      </entry>
11681    </row>
11682    <row>
11683      <entry>
11684<emphasis remap='I'>value-list</emphasis>: LISTofVALUE
11685<!-- .in -.2i -->
11686      </entry>
11687    </row>
11688    <row>
11689      <entry>
11690Errors:
11691<emphasis role='bold'>Match</emphasis>,
11692<emphasis role='bold'>Value</emphasis>
11693      </entry>
11694    </row>
11695  </tbody>
11696  </tgroup>
11697</informaltable>
11698
11699<para>
11700This request controls various aspects of the keyboard.
11701The value-mask and value-list specify which controls are to be changed.
11702The possible values are:
11703</para>
11704
11705<informaltable frame='topbot'>
11706  <?dbfo keep-together="always" ?>
11707  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
11708  <colspec colname='c1' colwidth='1.0*'/>
11709  <colspec colname='c2' colwidth='2.0*'/>
11710  <thead>
11711    <row rowsep='1'>
11712      <entry>Control</entry>
11713      <entry>Type</entry>
11714    </row>
11715  </thead>
11716  <tbody>
11717    <row>
11718      <entry>key-click-percent</entry>
11719      <entry>INT8</entry>
11720    </row>
11721    <row>
11722      <entry>bell-percent</entry>
11723      <entry>INT8</entry>
11724    </row>
11725    <row>
11726      <entry>bell-pitch</entry>
11727      <entry>INT16</entry>
11728    </row>
11729    <row>
11730      <entry>bell-duration</entry>
11731      <entry>INT16</entry>
11732    </row>
11733    <row>
11734      <entry>led</entry>
11735      <entry>CARD8</entry>
11736    </row>
11737    <row>
11738      <entry>led-mode</entry>
11739      <entry>
11740{ <emphasis role='bold'>On</emphasis>,
11741<emphasis role='bold'>Off</emphasis> }
11742      </entry>
11743    </row>
11744    <row>
11745      <entry>key </entry>
11746      <entry>KEYCODE</entry>
11747    </row>
11748    <row>
11749      <entry>auto-repeat-mode</entry>
11750      <entry>
11751{ <emphasis role='bold'>On</emphasis>,
11752<emphasis role='bold'>Off</emphasis>,
11753<emphasis role='bold'>Default</emphasis> }
11754      </entry>
11755    </row>
11756  </tbody>
11757  </tgroup>
11758</informaltable>
11759
11760<para>
11761The key-click-percent sets the volume for key clicks between 0 (off) and
11762100 (loud) inclusive, if possible.
11763Setting to -1 restores the default.
11764Other negative values generate a
11765<emphasis role='bold'>Value</emphasis>
11766error.
11767</para>
11768<para>
11769The bell-percent sets the base volume for the bell between 0 (off) and 100
11770(loud) inclusive, if possible.
11771Setting to -1 restores the default.
11772Other negative values generate a
11773<emphasis role='bold'>Value</emphasis>
11774error.
11775</para>
11776<para>
11777The bell-pitch sets the pitch (specified in Hz) of the bell, if possible.
11778Setting to -1 restores the default.
11779Other negative values generate a
11780<emphasis role='bold'>Value</emphasis>
11781error.
11782</para>
11783<para>
11784The bell-duration sets the duration of the bell (specified in milliseconds),
11785if possible.
11786Setting to -1 restores the default.
11787Other negative values generate a
11788<emphasis role='bold'>Value</emphasis>
11789error.
11790</para>
11791<para>
11792If both led-mode and led are specified,
11793then the state of that LED is changed, if possible.
11794If only led-mode is specified,
11795then the state of all LEDs are changed, if possible.
11796At most 32 LEDs, numbered from one, are supported.
11797No standard interpretation of LEDs is defined.
11798It is a
11799<emphasis role='bold'>Match</emphasis>
11800error if an led is specified without an led-mode.
11801</para>
11802<para>
11803If both auto-repeat-mode and key are specified,
11804then the auto-repeat mode of that key is changed, if possible.
11805If only auto-repeat-mode is specified,
11806then the global auto-repeat mode for the entire keyboard is changed,
11807if possible, without affecting the per-key settings.
11808It is a
11809<emphasis role='bold'>Match</emphasis>
11810error if a key is specified without an auto-repeat-mode.
11811Each key has an individual mode of whether or not it should auto-repeat
11812and a default setting for that mode.
11813In addition, there is a global mode of whether auto-repeat should be
11814enabled or not and a default setting for that mode.
11815When the global mode is
11816<emphasis role='bold'>On</emphasis>,
11817keys should obey their individual auto-repeat modes.
11818When the global mode is
11819<emphasis role='bold'>Off</emphasis>,
11820no keys should auto-repeat.
11821An auto-repeating key generates alternating
11822<link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>
11823and
11824<link linkend="events:KeyRelease"><emphasis role='bold'>KeyRelease</emphasis></link>
11825events.
11826When a key is used as a modifier,
11827it is desirable for the key not to auto-repeat,
11828regardless of the auto-repeat setting for that key.
11829</para>
11830<para>
11831A bell generator connected with the console but not directly on the
11832keyboard is treated as if it were part of the keyboard.
11833</para>
11834<para>
11835The order in which controls are verified and altered is server-dependent.
11836If an error is generated,
11837a subset of the controls may have been altered.
11838<!-- .sp -->
11839</para>
11840  </section>
11841  <section id="requests:GetKeyboardControl">
11842    <title>GetKeyboardControl</title>
11843    <indexterm zone="requests:GetKeyboardControl" significance="preferred"><primary>GetKeyboardControl</primary></indexterm>
11844<informaltable frame='none'>
11845  <?dbfo keep-together="always" ?>
11846  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11847  <colspec colname='c1' colwidth='1.0*'/>
11848  <tbody>
11849    <row>
11850      <entry>
1185111852      </entry>
11853    </row>
11854    <row>
11855      <entry>
11856<!-- .in +.2i -->
11857key-click-percent: CARD8
11858      </entry>
11859    </row>
11860    <row>
11861      <entry>
11862bell-percent: CARD8
11863      </entry>
11864    </row>
11865    <row>
11866      <entry>
11867bell-pitch: CARD16
11868      </entry>
11869    </row>
11870    <row>
11871      <entry>
11872bell-duration: CARD16
11873      </entry>
11874    </row>
11875    <row>
11876      <entry>
11877led-mask: CARD32
11878      </entry>
11879    </row>
11880    <row>
11881      <entry>
11882global-auto-repeat:
11883{ <emphasis role='bold'>On</emphasis>,
11884<emphasis role='bold'>Off</emphasis>}
11885      </entry>
11886    </row>
11887    <row>
11888      <entry>
11889auto-repeats: LISTofCARD8
11890<!-- .in -.2i -->
11891<!-- .eM -->
11892      </entry>
11893    </row>
11894  </tbody>
11895  </tgroup>
11896</informaltable>
11897<!-- .eM -->
11898<para>
11899This request returns the current control values for the keyboard.
11900For the LEDs,
11901the least significant bit of led-mask corresponds to LED one,
11902and each one bit in led-mask indicates an LED that is lit.
11903The auto-repeats is a bit vector;
11904each one bit indicates that auto-repeat is enabled for the corresponding key.
11905The vector is represented as 32 bytes.
11906Byte N (from 0) contains the bits for keys 8N to 8N + 7,
11907with the least significant bit in the byte representing key 8N.
11908<!-- .sp -->
11909</para>
11910  </section>
11911  <section id="requests:Bell">
11912    <title>Bell</title>
11913    <indexterm zone="requests:Bell" significance="preferred"><primary>Bell</primary></indexterm>
11914<informaltable frame='none'>
11915  <?dbfo keep-together="always" ?>
11916  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11917  <colspec colname='c1' colwidth='1.0*'/>
11918  <tbody>
11919    <row>
11920      <entry>
11921<!-- .in +.2i -->
11922<emphasis remap='I'>percent</emphasis>: INT8
11923<!-- .in -.2i -->
11924      </entry>
11925    </row>
11926    <row>
11927      <entry>
11928<!-- .in +.2i -->
11929Errors:
11930<emphasis role='bold'>Value</emphasis>
11931<!-- .in -.2i -->
11932<!-- .eM -->
11933      </entry>
11934    </row>
11935  </tbody>
11936  </tgroup>
11937</informaltable>
11938<!-- .eM -->
11939<para>
11940This request rings the bell on the keyboard at a volume relative to the
11941base volume for the keyboard, if possible.
11942Percent can range from -100 to 100 inclusive (or a
11943<emphasis role='bold'>Value</emphasis>
11944error results).
11945The volume at which the bell is rung when percent is nonnegative is:
11946<literallayout class="monospaced">
11947	base - [(base * percent) / 100] + percent
11948</literallayout>
11949</para>
11950<para>
11951When percent is negative, it is:
11952<literallayout class="monospaced">
11953	base + [(base * percent) / 100]
11954</literallayout>
11955<!-- .sp -->
11956</para>
11957  </section>
11958  <section id="requests:SetPointerMapping">
11959    <title>SetPointerMapping</title>
11960    <indexterm zone="requests:SetPointerMapping" significance="preferred"><primary>SetPointerMapping</primary></indexterm>
11961<informaltable frame='none'>
11962  <?dbfo keep-together="always" ?>
11963  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
11964  <colspec colname='c1' colwidth='1.0*'/>
11965  <tbody>
11966    <row>
11967      <entry>
11968<!-- .in +.2i -->
11969<emphasis remap='I'>map</emphasis>: LISTofCARD8
11970<!-- .in -.2i -->
11971      </entry>
11972    </row>
11973    <row>
11974      <entry>
1197511976      </entry>
11977    </row>
11978    <row>
11979      <entry>
11980<!-- .in +.2i -->
11981status:
11982{ <emphasis role='bold'>Success</emphasis>,
11983<emphasis role='bold'>Busy</emphasis>}
11984<!-- .in -.2i -->
11985      </entry>
11986    </row>
11987    <row>
11988      <entry>
11989<!-- .in +.2i -->
11990Errors:
11991<emphasis role='bold'>Value</emphasis>
11992<!-- .in -.2i -->
11993<!-- .eM -->
11994      </entry>
11995    </row>
11996  </tbody>
11997  </tgroup>
11998</informaltable>
11999<!-- .eM -->
12000<para>
12001This request sets the mapping of the pointer.
12002Elements of the list are indexed starting from one.
12003The length of the list must be the same as
12004<link linkend="requests:GetPointerMapping"><emphasis role='bold'>GetPointerMapping</emphasis></link>
12005would return (or a
12006<emphasis role='bold'>Value</emphasis>
12007error results).
12008The index is a core button number,
12009and the element of the list defines the effective number.
12010</para>
12011<para>
12012A zero element disables a button.
12013Elements are not restricted in value by the number of physical buttons,
12014but no two elements can have the same nonzero value (or a
12015<emphasis role='bold'>Value</emphasis>
12016error results).
12017</para>
12018<para>
12019If any of the buttons to be altered are logically in the down state,
12020the status reply is
12021<emphasis role='bold'>Busy</emphasis>,
12022and the mapping is not changed.
12023</para>
12024<para>
12025This request generates a
12026<link linkend="events:MappingNotify"><emphasis role='bold'>MappingNotify</emphasis></link>
12027event on a
12028<emphasis role='bold'>Success</emphasis>
12029status.
12030<!-- .sp -->
12031</para>
12032  </section>
12033  <section id="requests:GetPointerMapping">
12034    <title>GetPointerMapping</title>
12035    <indexterm zone="requests:GetPointerMapping" significance="preferred"><primary>GetPointerMapping</primary></indexterm>
12036<informaltable frame='none'>
12037  <?dbfo keep-together="always" ?>
12038  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12039  <colspec colname='c1' colwidth='1.0*'/>
12040  <tbody>
12041    <row>
12042      <entry>
1204312044      </entry>
12045    </row>
12046    <row>
12047      <entry>
12048<!-- .in +.2i -->
12049map: LISTofCARD8
12050<!-- .in -.2i -->
12051<!-- .eM -->
12052      </entry>
12053    </row>
12054  </tbody>
12055  </tgroup>
12056</informaltable>
12057<!-- .eM -->
12058<para>
12059This request returns the current mapping of the pointer.
12060Elements of the list are indexed starting from one.
12061The length of the list indicates the number of physical buttons.
12062</para>
12063<para>
12064The nominal mapping for a pointer is the identity mapping: map[i]=i.
12065<!-- .sp -->
12066</para>
12067  </section>
12068  <section id="requests:ChangePointerControl">
12069    <title>ChangePointerControl</title>
12070    <indexterm zone="requests:ChangePointerControl" significance="preferred"><primary>ChangePointerControl</primary></indexterm>
12071<informaltable frame='none'>
12072  <?dbfo keep-together="always" ?>
12073  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12074  <colspec colname='c1' colwidth='1.0*'/>
12075  <tbody>
12076    <row>
12077      <entry>
12078<!-- .in +.2i -->
12079<emphasis remap='I'>do-acceleration</emphasis>, <emphasis remap='I'>do-threshold</emphasis>: BOOL
12080      </entry>
12081    </row>
12082    <row>
12083      <entry>
12084<emphasis remap='I'>acceleration-numerator</emphasis>, <emphasis remap='I'>acceleration-denominator</emphasis>: INT16
12085      </entry>
12086    </row>
12087    <row>
12088      <entry>
12089<emphasis remap='I'>threshold</emphasis>: INT16
12090<!-- .in -.2i -->
12091      </entry>
12092    </row>
12093    <row>
12094      <entry>
12095<!-- .in +.2i -->
12096Errors:
12097<emphasis role='bold'>Value</emphasis>
12098<!-- .in -.2i -->
12099<!-- .eM -->
12100      </entry>
12101    </row>
12102  </tbody>
12103  </tgroup>
12104</informaltable>
12105<!-- .eM -->
12106<para>
12107This request defines how the pointer moves.
12108The acceleration is a multiplier for movement expressed as a fraction.
12109For example,
12110specifying 3/1 means the pointer moves three times as fast as normal.
12111The fraction can be rounded arbitrarily by the server.
12112Acceleration only takes effect if the pointer moves more than threshold
12113number of pixels at once and only applies to the amount beyond the threshold.
12114Setting a value to -1 restores the default.
12115Other negative values generate a
12116<emphasis role='bold'>Value</emphasis>
12117error, as does a zero value for acceleration-denominator.
12118<!-- .sp -->
12119</para>
12120  </section>
12121  <section id="requests:GetPointerControl">
12122    <title>GetPointerControl</title>
12123    <indexterm zone="requests:GetPointerControl" significance="preferred"><primary>GetPointerControl</primary></indexterm>
12124<informaltable frame='none'>
12125  <?dbfo keep-together="always" ?>
12126  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12127  <colspec colname='c1' colwidth='1.0*'/>
12128  <tbody>
12129    <row>
12130      <entry>
1213112132      </entry>
12133    </row>
12134    <row>
12135      <entry>
12136<!-- .in +.2i -->
12137acceleration-numerator, acceleration-denominator: CARD16
12138      </entry>
12139    </row>
12140    <row>
12141      <entry>
12142threshold: CARD16
12143<!-- .in -.2i -->
12144<!-- .eM -->
12145      </entry>
12146    </row>
12147  </tbody>
12148  </tgroup>
12149</informaltable>
12150<!-- .eM -->
12151<para>
12152This request returns the current acceleration and threshold for the pointer.
12153<!-- .sp -->
12154</para>
12155  </section>
12156  <section id="requests:SetScreenSaver">
12157    <title>SetScreenSaver</title>
12158    <indexterm zone="requests:SetScreenSaver" significance="preferred"><primary>SetScreenSaver</primary></indexterm>
12159<informaltable frame='none'>
12160  <?dbfo keep-together="always" ?>
12161  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12162  <colspec colname='c1' colwidth='1.0*'/>
12163  <tbody>
12164    <row>
12165      <entry>
12166<!-- .in +.2i -->
12167<emphasis remap='I'>timeout</emphasis>, <emphasis remap='I'>interval</emphasis>: INT16
12168      </entry>
12169    </row>
12170    <row>
12171      <entry>
12172<emphasis remap='I'>prefer-blanking</emphasis>:
12173{ <emphasis role='bold'>Yes</emphasis>,
12174<emphasis role='bold'>No</emphasis>,
12175<emphasis role='bold'>Default</emphasis>}
12176      </entry>
12177    </row>
12178    <row>
12179      <entry>
12180<emphasis remap='I'>allow-exposures</emphasis>:
12181{ <emphasis role='bold'>Yes</emphasis>,
12182<emphasis role='bold'>No</emphasis>,
12183<emphasis role='bold'>Default</emphasis>}
12184<!-- .in -.2i -->
12185      </entry>
12186    </row>
12187    <row>
12188      <entry>
12189<!-- .in +.2i -->
12190Errors:
12191<emphasis role='bold'>Value</emphasis>
12192<!-- .in -.2i -->
12193<!-- .eM -->
12194      </entry>
12195    </row>
12196  </tbody>
12197  </tgroup>
12198</informaltable>
12199<!-- .eM -->
12200<para>
12201The timeout and interval are specified in seconds;
12202setting a value to -1 restores the default.
12203Other negative values generate a
12204<emphasis role='bold'>Value</emphasis>
12205error.
12206If the timeout value is zero,
12207screen-saver is disabled (but an activated screen-saver is not deactivated).
12208If the timeout value is nonzero,
12209screen-saver is enabled.
12210Once screen-saver is enabled,
12211if no input from the keyboard or pointer is generated for timeout seconds,
12212screen-saver is activated.
12213For each screen,
12214if blanking is preferred and the hardware supports video blanking,
12215the screen will simply go blank.
12216Otherwise,
12217if either exposures are allowed or the screen can be regenerated without
12218sending exposure events to clients,
12219the screen is changed in a server-dependent fashion to avoid phosphor burn.
12220Otherwise,
12221the state of the screens does not change, and screen-saver is not activated.
12222At the next keyboard or pointer input or at the next
12223<link linkend="requests:ForceScreenSaver"><emphasis role='bold'>ForceScreenSaver</emphasis></link>
12224with mode
12225<emphasis role='bold'>Reset</emphasis>,
12226screen-saver is deactivated, and all screen states are restored.
12227</para>
12228<para>
12229If the server-dependent screen-saver method is amenable to periodic change,
12230interval serves as a hint about how long the change period should be,
12231with zero hinting that no periodic change should be made.
12232Examples of ways to change the screen include scrambling the color map
12233periodically, moving an icon image about the screen periodically, or
12234tiling the screen with the root window background tile,
12235randomly reorigined periodically.
12236<!-- .sp -->
12237</para>
12238  </section>
12239  <section id="requests:GetScreenSaver">
12240    <title>GetScreenSaver</title>
12241    <indexterm zone="requests:GetScreenSaver" significance="preferred"><primary>GetScreenSaver</primary></indexterm>
12242<informaltable frame='none'>
12243  <?dbfo keep-together="always" ?>
12244  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12245  <colspec colname='c1' colwidth='1.0*'/>
12246  <tbody>
12247    <row>
12248      <entry>
1224912250      </entry>
12251    </row>
12252    <row>
12253      <entry>
12254<!-- .in +.2i -->
12255timeout, interval: CARD16
12256      </entry>
12257    </row>
12258    <row>
12259      <entry>
12260prefer-blanking:
12261{ <emphasis role='bold'>Yes</emphasis>,
12262<emphasis role='bold'>No</emphasis>}
12263      </entry>
12264    </row>
12265    <row>
12266      <entry>
12267allow-exposures:
12268{ <emphasis role='bold'>Yes</emphasis>,
12269<emphasis role='bold'>No</emphasis>}
12270<!-- .in -.2i -->
12271<!-- .eM -->
12272      </entry>
12273    </row>
12274  </tbody>
12275  </tgroup>
12276</informaltable>
12277<!-- .eM -->
12278<para>
12279This request returns the current screen-saver control values.
12280<!-- .sp -->
12281</para>
12282  </section>
12283  <section id="requests:ForceScreenSaver">
12284    <title>ForceScreenSaver</title>
12285    <indexterm zone="requests:ForceScreenSaver" significance="preferred"><primary>ForceScreenSaver</primary></indexterm>
12286<informaltable frame='none'>
12287  <?dbfo keep-together="always" ?>
12288  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12289  <colspec colname='c1' colwidth='1.0*'/>
12290  <tbody>
12291    <row>
12292      <entry>
12293<!-- .in +.2i -->
12294<emphasis remap='I'>mode</emphasis>:
12295{ <emphasis role='bold'>Activate</emphasis>,
12296<emphasis role='bold'>Reset</emphasis>}
12297<!-- .in -.2i -->
12298      </entry>
12299    </row>
12300    <row>
12301      <entry>
12302<!-- .in +.2i -->
12303Errors:
12304<emphasis role='bold'>Value</emphasis>
12305<!-- .in -.2i -->
12306<!-- .eM -->
12307      </entry>
12308    </row>
12309  </tbody>
12310  </tgroup>
12311</informaltable>
12312<!-- .eM -->
12313<para>
12314If the mode is
12315<emphasis role='bold'>Activate</emphasis>
12316and screen-saver is currently deactivated,
12317then screen-saver is activated (even if screen-saver has been disabled with
12318a timeout value of zero).
12319If the mode is
12320<emphasis role='bold'>Reset</emphasis>
12321and screen-saver is currently enabled,
12322then screen-saver is deactivated (if it was activated),
12323and the activation timer is reset to its initial state
12324as if device input had just been received.
12325<!-- .sp -->
12326</para>
12327  </section>
12328  <section id="requests:ChangeHosts">
12329    <title>ChangeHosts</title>
12330    <indexterm zone="requests:ChangeHosts" significance="preferred"><primary>ChangeHosts</primary></indexterm>
12331<informaltable frame='none'>
12332  <?dbfo keep-together="always" ?>
12333  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12334  <colspec colname='c1' colwidth='1.0*'/>
12335  <tbody>
12336    <row>
12337      <entry>
12338<!-- .in +.2i -->
12339<emphasis remap='I'>mode</emphasis>:
12340{ <emphasis role='bold'>Insert</emphasis>,
12341<emphasis role='bold'>Delete</emphasis>}
12342      </entry>
12343    </row>
12344    <row>
12345      <entry>
12346<emphasis remap='I'>host</emphasis>: HOST
12347<!-- .in -.2i -->
12348      </entry>
12349    </row>
12350    <row>
12351      <entry>
12352<!-- .in +.2i -->
12353Errors:
12354<emphasis role='bold'>Access</emphasis>,
12355<emphasis role='bold'>Value</emphasis>
12356<!-- .in -.2i -->
12357<!-- .eM -->
12358      </entry>
12359    </row>
12360  </tbody>
12361  </tgroup>
12362</informaltable>
12363<!-- .eM -->
12364<para>
12365This request adds or removes the specified host from the access control list.
12366<indexterm zone="requests:ChangeHosts"><primary>Access control list</primary></indexterm>
12367When the access control mechanism is enabled and a client attempts to
12368establish a connection to the server,
12369the host on which the client resides must be in the access control list,
12370or the client must have been granted permission by a server-dependent
12371method, or the server will refuse the connection.
12372</para>
12373<para>
12374The client must reside on the same host as the server and/or have been granted
12375permission by a server-dependent method to execute this request (or an
12376<emphasis role='bold'>Access</emphasis>
12377error results).
12378</para>
12379<para>
12380An initial access control list can usually be specified,
12381typically by naming a file that the server reads at startup and reset.
12382</para>
12383<para id="address_families">
12384The following address families are defined.
12385<indexterm zone="address_families"><primary>Types</primary><secondary>HOST</secondary></indexterm>
12386A server is not required to support these families
12387and may support families not listed here.
12388Use of an unsupported family, an improper address format,
12389or an improper address length within a supported family results in a
12390<emphasis role='bold'>Value</emphasis>
12391error.
12392</para>
12393<para>
12394For the Internet family,
12395the address must be four bytes long.
12396The address bytes are in standard IP order;
12397the server performs no automatic swapping on the address bytes.
12398The Internet family supports IP version 4 addresses only.
12399</para>
12400<para>
12401For the InternetV6 family, the address must be sixteen bytes
12402long.  The address bytes are in standard IP order; the
12403server performs no automatic swapping on the address bytes.
12404The InternetV6 family supports IP version 6 addresses only.
12405</para>
12406<para>
12407For the DECnet family,
12408the server performs no automatic swapping on the address bytes.
12409A Phase IV address is two bytes long:
12410the first byte contains the least significant eight bits of the node number,
12411and the second byte contains the most significant two bits of the node number in
12412the least significant two bits of the byte and the area in the most
12413significant six bits of the byte.
12414</para>
12415<para>
12416For the Chaos family,
12417the address must be two bytes long.
12418The host number is always the first byte in the address,
12419and the subnet number is always the second byte.
12420The server performs no automatic swapping on the address bytes.
12421</para>
12422<para>
12423For the ServerInterpreted family, the address may be of any
12424length up to 65535 bytes.  The address consists of two strings
12425of ASCII characters, separated by a byte with a value of 0.
12426The first string represents the type of address, and the second
12427string contains the address value.  Address types and the syntax
12428for their associated values will be registered via the X.Org Registry.
12429Implementors who wish to add implementation specific types may register
12430a unique prefix with the X.Org registry to prevent namespace
12431collisions.
12432</para>
12433<para>
12434Use of a host address in the ChangeHosts request is deprecated.  It is
12435only useful when a host has a unique, constant address, a requirement
12436that is increasingly unmet as sites adopt dynamically assigned
12437addresses, network address translation gateways, IPv6 link local
12438addresses, and various other technologies.  It also assumes all users of
12439a host share equivalent access rights, and as such has never been
12440suitable for many multi-user machine environments.  Instead, more
12441secure forms of authentication, such as those based on shared secrets
12442or public key encryption, are recommended.
12443<!-- .sp -->
12444</para>
12445  </section>
12446  <section id="requests:ListHosts">
12447    <title>ListHosts</title>
12448    <indexterm zone="requests:ListHosts" significance="preferred"><primary>ListHosts</primary></indexterm>
12449<informaltable frame='none'>
12450  <?dbfo keep-together="always" ?>
12451  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12452  <colspec colname='c1' colwidth='1.0*'/>
12453  <tbody>
12454    <row>
12455      <entry>
1245612457      </entry>
12458    </row>
12459    <row>
12460      <entry>
12461<!-- .in +.2i -->
12462mode:
12463{ <emphasis role='bold'>Enabled</emphasis>,
12464<emphasis role='bold'>Disabled</emphasis>}
12465      </entry>
12466    </row>
12467    <row>
12468      <entry>
12469hosts: LISTofHOST
12470<!-- .in -.2i -->
12471<!-- .eM -->
12472      </entry>
12473    </row>
12474  </tbody>
12475  </tgroup>
12476</informaltable>
12477<!-- .eM -->
12478<para>
12479This request returns the hosts on the access control list
12480and whether use of the list at connection setup is currently
12481enabled or disabled.
12482</para>
12483<para>
12484Each HOST is padded to a multiple of four bytes.
12485<!-- .sp -->
12486</para>
12487  </section>
12488  <section id="requests:SetAccessControl">
12489    <title>SetAccessControl</title>
12490    <indexterm zone="requests:SetAccessControl" significance="preferred"><primary>SetAccessControl</primary></indexterm>
12491<informaltable frame='none'>
12492  <?dbfo keep-together="always" ?>
12493  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12494  <colspec colname='c1' colwidth='1.0*'/>
12495  <tbody>
12496    <row>
12497      <entry>
12498<!-- .in +.2i -->
12499<emphasis remap='I'>mode</emphasis>:
12500{ <emphasis role='bold'>Enable</emphasis>,
12501<emphasis role='bold'>Disable</emphasis>}
12502<!-- .in -.2i -->
12503      </entry>
12504    </row>
12505    <row>
12506      <entry>
12507<!-- .in +.2i -->
12508Errors:
12509<emphasis role='bold'>Access</emphasis>,
12510<emphasis role='bold'>Value</emphasis>
12511<!-- .in -.2i -->
12512<!-- .eM -->
12513      </entry>
12514    </row>
12515  </tbody>
12516  </tgroup>
12517</informaltable>
12518<!-- .eM -->
12519<para>
12520This request enables or disables the use of the access control list
12521at connection setups.
12522</para>
12523<para>
12524The client must reside on the same host as the server
12525and/or have been granted permission by a server-dependent method
12526to execute this request (or an
12527<emphasis role='bold'>Access</emphasis>
12528error results).
12529<!-- .sp -->
12530</para>
12531  </section>
12532  <section id="requests:SetCloseDownMode">
12533    <title>SetCloseDownMode</title>
12534    <indexterm zone="requests:SetCloseDownMode" significance="preferred"><primary>SetCloseDownMode</primary></indexterm>
12535<informaltable frame='none'>
12536  <?dbfo keep-together="always" ?>
12537  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12538  <colspec colname='c1' colwidth='1.0*'/>
12539  <tbody>
12540    <row>
12541      <entry>
12542<!-- .in +.2i -->
12543<emphasis remap='I'>mode</emphasis>:
12544{ <emphasis role='bold'>Destroy</emphasis>,
12545<emphasis role='bold'>RetainPermanent</emphasis>,
12546<emphasis role='bold'>RetainTemporary</emphasis>}
12547<!-- .in -.2i -->
12548      </entry>
12549    </row>
12550    <row>
12551      <entry>
12552<!-- .in +.2i -->
12553Errors:
12554<emphasis role='bold'>Value</emphasis>
12555<!-- .in -.2i -->
12556<!-- .eM -->
12557      </entry>
12558    </row>
12559  </tbody>
12560  </tgroup>
12561</informaltable>
12562<!-- .eM -->
12563<para>
12564This request defines what will happen to the client's resources
12565at connection close.
12566A connection starts in
12567<emphasis role='bold'>Destroy</emphasis>
12568mode.
12569The meaning of the close-down mode is described
12570in <link linkend='Connection_Close'>section 10</link>.
12571<!-- .sp -->
12572</para>
12573  </section>
12574  <section id="requests:KillClient">
12575    <title>KillClient</title>
12576    <indexterm zone="requests:KillClient" significance="preferred"><primary>KillClient</primary></indexterm>
12577<informaltable frame='none'>
12578  <?dbfo keep-together="always" ?>
12579  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12580  <colspec colname='c1' colwidth='1.0*'/>
12581  <tbody>
12582    <row>
12583      <entry>
12584<!-- .in +.2i -->
12585<emphasis remap='I'>resource</emphasis>: CARD32 or
12586<emphasis role='bold'>AllTemporary</emphasis>
12587<!-- .in -.2i -->
12588      </entry>
12589    </row>
12590    <row>
12591      <entry>
12592<!-- .in +.2i -->
12593Errors:
12594<emphasis role='bold'>Value</emphasis>
12595<!-- .in -.2i -->
12596<!-- .eM -->
12597      </entry>
12598    </row>
12599  </tbody>
12600  </tgroup>
12601</informaltable>
12602<!-- .eM -->
12603<para>
12604If a valid resource is specified,
12605<link linkend="requests:KillClient"><emphasis role='bold'>KillClient</emphasis></link>
12606forces a close-down of the client that created the resource.
12607If the client has already terminated in either
12608<emphasis role='bold'>RetainPermanent</emphasis>
12609or
12610<emphasis role='bold'>RetainTemporary</emphasis>
12611mode, all of the client's resources are destroyed
12612(see <link linkend='Connection_Close'>section 10</link>).
12613If
12614<emphasis role='bold'>AllTemporary</emphasis>
12615is specified,
12616then the resources of all clients that have terminated in
12617<emphasis role='bold'>RetainTemporary</emphasis>
12618are destroyed.
12619<!-- .sp -->
12620</para>
12621  </section>
12622  <section id="requests:NoOperation">
12623    <title>NoOperation</title>
12624    <indexterm zone="requests:NoOperation" significance="preferred"><primary>NoOperation</primary></indexterm>
12625<para>
12626This request has no arguments and no results,
12627but the request length field
12628allows the request to be any multiple of four bytes in length.
12629The bytes contained in the request are uninterpreted by the server.
12630</para>
12631<para>
12632This request can be used in its minimum four byte form as padding where
12633necessary by client libraries that find it convenient to force requests
12634to begin on 64-bit boundaries.
12635</para>
12636  </section>
12637</chapter>
12638
12639<chapter id='Connection_Close'>
12640<title>Connection Close</title>
12641  <indexterm zone="Connection_Close"><primary>Connection</primary><secondary>closing</secondary></indexterm>
12642<!-- .XS -->
12643<!-- \*(SN Connection Close -->
12644<!-- .XE -->
12645<para>
12646At connection close,
12647all event selections made by the client are discarded.
12648If the client has the pointer actively grabbed, an
12649<link linkend="requests:UngrabPointer"><emphasis role='bold'>UngrabPointer</emphasis></link>
12650is performed.
12651If the client has the keyboard actively grabbed, an
12652<link linkend="requests:UngrabKeyboard"><emphasis role='bold'>UngrabKeyboard</emphasis></link>
12653is performed.
12654All passive grabs by the client are released.
12655If the client has the server grabbed, an
12656<link linkend="requests:UngrabServer"><emphasis role='bold'>UngrabServer</emphasis></link>
12657is performed.
12658All selections (see
12659<link linkend="requests:SetSelectionOwner"><emphasis role='bold'>SetSelectionOwner</emphasis></link>
12660request)
12661owned by the client are disowned.
12662If close-down mode (see
12663<link linkend="requests:SetCloseDownMode"><emphasis role='bold'>SetCloseDownMode</emphasis></link>
12664request) is
12665<emphasis role='bold'>RetainPermanent</emphasis>
12666or
12667<emphasis role='bold'>RetainTemporary</emphasis>,
12668then all resources (including colormap entries)
12669allocated by the client are marked as permanent or temporary,
12670respectively (but this does not prevent other clients from explicitly
12671destroying them).
12672If the mode is
12673<emphasis role='bold'>Destroy</emphasis>,
12674all of the client's resources are destroyed.
12675</para>
12676<para>
12677When a client's resources are destroyed,
12678for each window in the client's save-set,
12679if the window is an inferior of a window created by the client,
12680the save-set window is reparented to the closest ancestor such that
12681the save-set window is not an inferior of a window created by the client.
12682If the save-set window is unmapped, a
12683<link linkend="requests:MapWindow"><emphasis role='bold'>MapWindow</emphasis></link>
12684request is performed on it (even if it was not an inferior
12685of a window created by the client).
12686The reparenting leaves unchanged the absolute coordinates
12687(with respect to the root window) of the upper-left outer corner of the
12688save-set window.
12689After save-set processing,
12690all windows created by the client are destroyed.
12691For each nonwindow resource created by the client,
12692the appropriate
12693<emphasis role='bold'>Free</emphasis>
12694request is performed.
12695All colors and colormap entries allocated by the client are freed.
12696</para>
12697<para>
12698A server goes through a cycle of having no connections and having some
12699connections.
12700At every transition to the state of having no connections
12701as a result of a connection closing with a
12702<emphasis role='bold'>Destroy</emphasis>
12703close-down mode,
12704the server resets its state as if it had just been started.
12705This starts by destroying all lingering resources from clients
12706that have terminated in
12707<emphasis role='bold'>RetainPermanent</emphasis>
12708or
12709<emphasis role='bold'>RetainTemporary</emphasis>
12710mode.
12711It additionally includes deleting all but the predefined atom identifiers,
12712deleting all properties on all root windows, resetting all device maps and
12713attributes (key click, bell volume, acceleration), resetting the access
12714control list, restoring the standard root tiles and cursors, restoring
12715the default font path, and restoring the input focus to state
12716<emphasis role='bold'>PointerRoot</emphasis>.
12717</para>
12718<para>
12719Note that closing a connection with a close-down mode of
12720<emphasis role='bold'>RetainPermanent</emphasis>
12721or
12722<emphasis role='bold'>RetainTemporary</emphasis>
12723will not cause the server to reset.
12724</para>
12725</chapter>
12726<!-- .NH 1 -->
12727<chapter id='Events'>
12728<title>Events</title>
12729<!-- .XS -->
12730<!-- \*(SN Events -->
12731<!-- .XE -->
12732<para>
12733<indexterm zone="Events"><primary>Event</primary></indexterm>
12734When a button press is processed with the pointer in some window W
12735and no active pointer grab is in progress,
12736the ancestors of W are searched from the root down,
12737looking for a passive grab to activate.
12738If no matching passive grab on the button exists,
12739then an active grab is started automatically for the client receiving the event,
12740and the last-pointer-grab time is set to the current server time.
12741The effect is essentially equivalent to a
12742<link linkend="requests:GrabButton"><emphasis role='bold'>GrabButton</emphasis></link>
12743with arguments:
12744</para>
12745
12746<informaltable frame='topbot'>
12747  <?dbfo keep-together="always" ?>
12748  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
12749  <colspec colname='c1' colwidth='1.0*'/>
12750  <colspec colname='c2' colwidth='2.0*'/>
12751  <thead>
12752    <row rowsep='1'>
12753      <entry>Argument</entry>
12754      <entry>Value</entry>
12755    </row>
12756  </thead>
12757  <tbody>
12758    <row>
12759      <entry>event-window</entry>
12760      <entry>Event window</entry>
12761    </row>
12762    <row>
12763      <entry>event-mask</entry>
12764      <entry>
12765Client's selected pointer events on the event window
12766      </entry>
12767    </row>
12768    <row>
12769      <entry>pointer-mode and keyboard-mode</entry>
12770      <entry>
12771<emphasis role='bold'>Asynchronous</emphasis>
12772      </entry>
12773    </row>
12774    <row>
12775      <entry>owner-events</entry>
12776      <entry>
12777<emphasis role='bold'>True</emphasis>
12778if the client has
12779<emphasis role='bold'>OwnerGrabButton</emphasis>
12780selected on the event window, otherwise
12781<emphasis role='bold'>False</emphasis>
12782      </entry>
12783    </row>
12784    <row>
12785      <entry>confine-to</entry>
12786      <entry>
12787<emphasis role='bold'>None</emphasis>
12788      </entry>
12789    </row>
12790    <row>
12791      <entry>cursor</entry>
12792      <entry>
12793<emphasis role='bold'>None</emphasis>
12794      </entry>
12795    </row>
12796  </tbody>
12797  </tgroup>
12798</informaltable>
12799
12800
12801
12802<para>
12803The grab is terminated automatically when the logical state of the pointer
12804has all buttons released.
12805<link linkend="requests:UngrabPointer"><emphasis role='bold'>UngrabPointer</emphasis></link>
12806and
12807<link linkend="requests:ChangeActivePointerGrab"><emphasis role='bold'>ChangeActivePointerGrab</emphasis></link>
12808can both be used to modify the active grab.
12809<!-- .sp -->
12810</para>
12811
12812  <section id="events:input">
12813    <title>Input Device events</title>
12814    <indexterm zone="events:input" significance="preferred"><primary>Input device</primary><secondary>events</secondary></indexterm>
12815
12816<informaltable frame='none'>
12817  <?dbfo keep-together="always" ?>
12818  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
12819  <colspec colname='c1' colwidth='1.0*'/>
12820  <tbody>
12821    <row>
12822      <entry id="events:KeyPress">
12823<indexterm zone="events:KeyPress" significance="preferred"><primary>KeyPress</primary></indexterm>
12824<emphasis role='bold'>KeyPress</emphasis>
12825      </entry>
12826    </row>
12827    <row>
12828      <entry id="events:KeyRelease">
12829<indexterm zone="events:KeyRelease" significance="preferred"><primary>KeyRelease</primary></indexterm>
12830<emphasis role='bold'>KeyRelease</emphasis>
12831      </entry>
12832    </row>
12833    <row>
12834      <entry id="events:ButtonPress">
12835<indexterm zone="events:ButtonPress" significance="preferred"><primary>ButtonPress</primary></indexterm>
12836<emphasis role='bold'>ButtonPress</emphasis>
12837      </entry>
12838    </row>
12839    <row>
12840      <entry id="events:ButtonRelease">
12841<indexterm zone="events:ButtonRelease" significance="preferred"><primary>ButtonRelease</primary></indexterm>
12842<emphasis role='bold'>ButtonRelease</emphasis>
12843      </entry>
12844    </row>
12845    <row>
12846      <entry id="events:MotionNotify">
12847<indexterm zone="events:MotionNotify" significance="preferred"><primary>MotionNotify</primary></indexterm>
12848<emphasis role='bold'>MotionNotify</emphasis>
12849      </entry>
12850    </row>
12851    <row>
12852      <entry>
12853<!-- .in +.2i -->
12854<emphasis remap='I'>root</emphasis>, <emphasis remap='I'>event</emphasis>: WINDOW
12855      </entry>
12856    </row>
12857    <row>
12858      <entry>
12859<emphasis remap='I'>child</emphasis>: WINDOW or
12860<emphasis role='bold'>None</emphasis>
12861      </entry>
12862    </row>
12863    <row>
12864      <entry>
12865<emphasis remap='I'>same-screen</emphasis>: BOOL
12866      </entry>
12867    </row>
12868    <row>
12869      <entry>
12870<emphasis remap='I'>root-x</emphasis>, <emphasis remap='I'>root-y</emphasis>, <emphasis remap='I'>event-x</emphasis>, <emphasis remap='I'>event-y</emphasis>: INT16
12871      </entry>
12872    </row>
12873    <row>
12874      <entry>
12875<emphasis remap='I'>detail</emphasis>: &lt;see below&gt;
12876      </entry>
12877    </row>
12878    <row>
12879      <entry>
12880<emphasis remap='I'>state</emphasis>: SETofKEYBUTMASK
12881      </entry>
12882    </row>
12883    <row>
12884      <entry>
12885<emphasis remap='I'>time</emphasis>: TIMESTAMP
12886<!-- .in -.2i -->
12887<!-- .eM -->
12888      </entry>
12889    </row>
12890  </tbody>
12891  </tgroup>
12892</informaltable>
12893
12894<para>
12895These events are generated either when a key or button logically changes state
12896or when the pointer logically moves.
12897The generation of these logical changes may lag the physical changes
12898if device event processing is frozen.
12899Note that
12900<emphasis role='bold'>KeyPress</emphasis>
12901and
12902<emphasis role='bold'>KeyRelease</emphasis>
12903are generated for all keys, even those mapped to modifier bits.
12904<phrase id="events:input:source">
12905The source of the event is the window the pointer is in.
12906</phrase>
12907<indexterm zone="events:input:source"><primary>Event</primary><secondary>source</secondary></indexterm>
12908The window the event is reported with respect to is called the event window.
12909The event window is found by starting with the source window and
12910looking up the hierarchy for the first window on which any client has selected
12911interest in the event (provided no intervening window prohibits event
12912generation by including the event type in its do-not-propagate-mask).
12913The actual window used for reporting can be modified by active grabs and,
12914in the case of keyboard events, can be modified by the focus window.
12915</para>
12916<para>
12917The root is the root window of the source window,
12918and root-x and root-y are the pointer coordinates relative to root's origin
12919at the time of the event.
12920Event is the event window.
12921If the event window is on the same screen as root,
12922then event-x and event-y are the pointer coordinates relative to the
12923event window's origin.
12924Otherwise, event-x and event-y are zero.
12925If the source window is an inferior of the event window,
12926then child is set to the child of the event window that is an
12927ancestor of (or is) the source window.
12928Otherwise, it is set to
12929<emphasis role='bold'>None</emphasis>.
12930The state component gives the logical state of the buttons and modifier keys
12931just before the event.
12932The detail component type varies with the event type:
12933</para>
12934
12935<informaltable frame='topbot'>
12936  <?dbfo keep-together="always" ?>
12937  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
12938  <colspec colname='c1' colwidth='1.0*'/>
12939  <colspec colname='c2' colwidth='2.0*'/>
12940  <thead>
12941    <row rowsep='1'>
12942      <entry>Event</entry>
12943      <entry>Component</entry>
12944    </row>
12945  </thead>
12946  <tbody>
12947    <row>
12948      <entry>
12949<emphasis role='bold'>KeyPress</emphasis>,
12950<emphasis role='bold'>KeyRelease</emphasis>
12951      </entry>
12952      <entry>KEYCODE</entry>
12953    </row>
12954    <row>
12955      <entry>
12956<emphasis role='bold'>ButtonPress</emphasis>,
12957<emphasis role='bold'>ButtonRelease</emphasis>
12958      </entry>
12959      <entry>BUTTON</entry>
12960    </row>
12961    <row>
12962      <entry>
12963<emphasis role='bold'>MotionNotify</emphasis>
12964      </entry>
12965      <entry>
12966{ <emphasis role='bold'>Normal</emphasis>
12967<emphasis role='bold'>Hint</emphasis> }
12968      </entry>
12969    </row>
12970  </tbody>
12971  </tgroup>
12972</informaltable>
12973
12974<para>
12975<emphasis role='bold'>MotionNotify</emphasis>
12976events are only generated when the motion begins and ends in the window.
12977The granularity of motion events is not guaranteed,
12978but a client selecting for motion events is guaranteed to get at least one
12979event when the pointer moves and comes to rest.
12980Selecting
12981<emphasis role='bold'>PointerMotion</emphasis>
12982receives events independent of the state of the pointer buttons.
12983By selecting some subset of
12984<emphasis role='bold'>Button[1-5]Motion</emphasis>
12985instead,
12986<emphasis role='bold'>MotionNotify</emphasis>
12987events will only be received when one or more of the
12988specified buttons are pressed.
12989By selecting
12990<emphasis role='bold'>ButtonMotion</emphasis>,
12991<emphasis role='bold'>MotionNotify</emphasis>
12992events will be received only when at least one button is pressed.
12993The events are always of type
12994<emphasis role='bold'>MotionNotify</emphasis>,
12995independent of the selection.
12996If
12997<emphasis role='bold'>PointerMotionHint</emphasis>
12998is selected,
12999the server is free to send only one
13000<emphasis role='bold'>MotionNotify</emphasis>
13001event (with detail
13002<emphasis role='bold'>Hint</emphasis>)
13003to the client for the event window until
13004either the key or button state changes,
13005the pointer leaves the event window,
13006or the client issues a
13007<link linkend="requests:QueryPointer"><emphasis role='bold'>QueryPointer</emphasis></link>
13008or
13009<link linkend="requests:GetMotionEvents"><emphasis role='bold'>GetMotionEvents</emphasis></link>
13010request.
13011<!-- .sp -->
13012</para>
13013  </section>
13014  <section id="events:pointer_window">
13015    <title>Pointer Window events</title>
13016<informaltable frame='none'>
13017  <?dbfo keep-together="always" ?>
13018  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
13019  <colspec colname='c1' colwidth='1.0*'/>
13020  <tbody>
13021    <row>
13022      <entry id="events:EnterNotify">
13023<indexterm zone="events:EnterNotify" significance="preferred"><primary>EnterNotify</primary></indexterm>
13024<emphasis role='bold'>EnterNotify</emphasis>
13025      </entry>
13026    </row>
13027    <row>
13028      <entry id="events:LeaveNotify">
13029<indexterm zone="events:LeaveNotify" significance="preferred"><primary>LeaveNotify</primary></indexterm>
13030<emphasis role='bold'>LeaveNotify</emphasis>
13031      </entry>
13032    </row>
13033    <row>
13034      <entry>
13035<!-- .in +.2i -->
13036<emphasis remap='I'>root</emphasis>, <emphasis remap='I'>event</emphasis>: WINDOW
13037      </entry>
13038    </row>
13039    <row>
13040      <entry>
13041<emphasis remap='I'>child</emphasis>: WINDOW or
13042<emphasis role='bold'>None</emphasis>
13043      </entry>
13044    </row>
13045    <row>
13046      <entry>
13047<emphasis remap='I'>same-screen</emphasis>: BOOL
13048      </entry>
13049    </row>
13050    <row>
13051      <entry>
13052<emphasis remap='I'>root-x</emphasis>, <emphasis remap='I'>root-y</emphasis>, <emphasis remap='I'>event-x</emphasis>, <emphasis remap='I'>event-y</emphasis>: INT16
13053      </entry>
13054    </row>
13055    <row>
13056      <entry>
13057<emphasis remap='I'>mode</emphasis>:
13058{ <emphasis role='bold'>Normal</emphasis>,
13059<emphasis role='bold'>Grab</emphasis>,
13060<emphasis role='bold'>Ungrab</emphasis>}
13061      </entry>
13062    </row>
13063    <row>
13064      <entry>
13065<emphasis remap='I'>detail</emphasis>:
13066{ <emphasis role='bold'>Ancestor</emphasis>,
13067<emphasis role='bold'>Virtual</emphasis>,
13068<emphasis role='bold'>Inferior</emphasis>,
13069<emphasis role='bold'>Nonlinear</emphasis>,
13070<emphasis role='bold'>NonlinearVirtual</emphasis>}
13071      </entry>
13072    </row>
13073    <row>
13074      <entry>
13075<emphasis remap='I'>focus</emphasis>: BOOL
13076      </entry>
13077    </row>
13078    <row>
13079      <entry>
13080<emphasis remap='I'>state</emphasis>: SETofKEYBUTMASK
13081      </entry>
13082    </row>
13083    <row>
13084      <entry>
13085<emphasis remap='I'>time</emphasis>: TIMESTAMP
13086<!-- .in -.2i -->
13087<!-- .eM -->
13088      </entry>
13089    </row>
13090  </tbody>
13091  </tgroup>
13092</informaltable>
13093<!-- .eM -->
13094<para>
13095If pointer motion or window hierarchy change causes the pointer to be
13096in a different window than before,
13097<emphasis role='bold'>EnterNotify</emphasis>
13098and
13099<emphasis role='bold'>LeaveNotify</emphasis>
13100events are generated instead of a
13101<link linkend="events:MotionNotify"><emphasis role='bold'>MotionNotify</emphasis></link>
13102event.
13103Only clients selecting
13104<emphasis role='bold'>EnterWindow</emphasis>
13105on a window receive
13106<emphasis role='bold'>EnterNotify</emphasis>
13107events, and only clients selecting
13108<emphasis role='bold'>LeaveWindow</emphasis>
13109receive
13110<emphasis role='bold'>LeaveNotify</emphasis>
13111events.
13112The pointer position reported in the event is always the final position,
13113not the initial position of the pointer.
13114The root is the root window for this position,
13115and root-x and root-y are the pointer coordinates relative to root's
13116origin at the time of the event.
13117Event is the event window.
13118If the event window is on the same screen as root,
13119then event-x and event-y are the pointer coordinates relative
13120to the event window's origin.
13121Otherwise, event-x and event-y are zero.
13122In a
13123<emphasis role='bold'>LeaveNotify</emphasis>
13124event, if a child of the event window contains the initial position of the
13125pointer, then the child component is set to that child.
13126Otherwise, it is
13127<emphasis role='bold'>None</emphasis>.
13128For an
13129<emphasis role='bold'>EnterNotify</emphasis>
13130event, if a child of the event window contains the final pointer position,
13131then the child component is set to that child.
13132Otherwise, it is
13133<emphasis role='bold'>None</emphasis>.
13134If the event window is the focus window or an inferior of the focus window,
13135then focus is
13136<emphasis role='bold'>True</emphasis>.
13137Otherwise, focus is
13138<emphasis role='bold'>False</emphasis>.
13139</para>
13140<para>
13141Normal pointer motion events have mode
13142<emphasis role='bold'>Normal</emphasis>.
13143Pseudo-motion events when a grab activates have mode
13144<emphasis role='bold'>Grab</emphasis>,
13145and pseudo-motion events when a grab deactivates have mode
13146<emphasis role='bold'>Ungrab</emphasis>.
13147</para>
13148<para>
13149All
13150<emphasis role='bold'>EnterNotify</emphasis>
13151and
13152<emphasis role='bold'>LeaveNotify</emphasis>
13153events caused by a hierarchy change are generated after any hierarchy event
13154caused by that change (that is,
13155<link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>,
13156<link linkend="events:MapNotify"><emphasis role='bold'>MapNotify</emphasis></link>,
13157<link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>,
13158<link linkend="events:GravityNotify"><emphasis role='bold'>GravityNotify</emphasis></link>,
13159<link linkend="events:CirculateNotify"><emphasis role='bold'>CirculateNotify</emphasis></link>),
13160but the ordering of
13161<emphasis role='bold'>EnterNotify</emphasis>
13162and
13163<emphasis role='bold'>LeaveNotify</emphasis>
13164events with respect to
13165<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>,
13166<link linkend="events:VisibilityNotify"><emphasis role='bold'>VisibilityNotify</emphasis></link>,
13167and
13168<link linkend="events:Expose"><emphasis role='bold'>Expose</emphasis></link>
13169events is not constrained.
13170</para>
13171<para>
13172Normal events are generated as follows:
13173</para>
13174
13175<para>
13176When the pointer moves from window A to window B and A is an inferior
13177of B:
13178</para>
13179
13180<itemizedlist>
13181  <listitem>
13182    <para>
13183<emphasis role='bold'>LeaveNotify</emphasis>
13184with detail
13185<emphasis role='bold'>Ancestor</emphasis>
13186is generated on A.
13187    </para>
13188  </listitem>
13189  <listitem>
13190    <para>
13191<emphasis role='bold'>LeaveNotify</emphasis>
13192with detail
13193<emphasis role='bold'>Virtual</emphasis>
13194is generated on each window between A and B exclusive (in that order).
13195    </para>
13196  </listitem>
13197  <listitem>
13198    <para>
13199<emphasis role='bold'>EnterNotify</emphasis>
13200with detail
13201<emphasis role='bold'>Inferior</emphasis>
13202is generated on B.
13203    </para>
13204  </listitem>
13205</itemizedlist>
13206
13207<para>
13208When the pointer moves from window A to window B and B is an inferior
13209of A:
13210</para>
13211
13212<itemizedlist>
13213  <listitem>
13214    <para>
13215<!-- .IP bu 5 -->
13216<emphasis role='bold'>LeaveNotify</emphasis>
13217with detail
13218<emphasis role='bold'>Inferior</emphasis>
13219is generated on A.
13220    </para>
13221  </listitem>
13222  <listitem>
13223    <para>
13224<emphasis role='bold'>EnterNotify</emphasis>
13225with detail
13226<emphasis role='bold'>Virtual</emphasis>
13227is generated on each window between A and B exclusive (in that order).
13228    </para>
13229  </listitem>
13230  <listitem>
13231    <para>
13232<emphasis role='bold'>EnterNotify</emphasis>
13233with detail
13234<emphasis role='bold'>Ancestor</emphasis>
13235is generated on B.
13236    </para>
13237  </listitem>
13238</itemizedlist>
13239
13240<para>
13241When the pointer moves from window A to window B and window C is
13242their least common ancestor:
13243</para>
13244
13245<itemizedlist>
13246  <listitem>
13247    <para>
13248<emphasis role='bold'>LeaveNotify</emphasis>
13249with detail
13250<emphasis role='bold'>Nonlinear</emphasis>
13251is generated on A.
13252    </para>
13253  </listitem>
13254  <listitem>
13255    <para>
13256<emphasis role='bold'>LeaveNotify</emphasis>
13257with detail
13258<emphasis role='bold'>NonlinearVirtual</emphasis>
13259is generated on each window between A and C exclusive (in that order).
13260    </para>
13261  </listitem>
13262  <listitem>
13263    <para>
13264<emphasis role='bold'>EnterNotify</emphasis>
13265with detail
13266<emphasis role='bold'>NonlinearVirtual</emphasis>
13267is generated on each window between C and B exclusive (in that order).
13268    </para>
13269  </listitem>
13270  <listitem>
13271    <para>
13272<emphasis role='bold'>EnterNotify</emphasis>
13273with detail
13274<emphasis role='bold'>Nonlinear</emphasis>
13275is generated on B.
13276    </para>
13277  </listitem>
13278</itemizedlist>
13279
13280<para>
13281When the pointer moves from window A to window B on different screens:
13282</para>
13283
13284<itemizedlist>
13285  <listitem>
13286    <para>
13287<emphasis role='bold'>LeaveNotify</emphasis>
13288with detail
13289<emphasis role='bold'>Nonlinear</emphasis>
13290is generated on A.
13291    </para>
13292  </listitem>
13293  <listitem>
13294    <para>
13295If A is not a root window,
13296<emphasis role='bold'>LeaveNotify</emphasis>
13297with detail
13298<emphasis role='bold'>NonlinearVirtual</emphasis>
13299is generated on each window above A up to and including its root (in order).
13300    </para>
13301  </listitem>
13302  <listitem>
13303    <para>
13304If B is not a root window,
13305<emphasis role='bold'>EnterNotify</emphasis>
13306with detail
13307<emphasis role='bold'>NonlinearVirtual</emphasis>
13308is generated on each window from B's root down to but not including B
13309(in order).
13310    </para>
13311  </listitem>
13312  <listitem>
13313    <para>
13314<emphasis role='bold'>EnterNotify</emphasis>
13315with detail
13316<emphasis role='bold'>Nonlinear</emphasis>
13317is generated on B.
13318    </para>
13319  </listitem>
13320</itemizedlist>
13321
13322<para>
13323When a pointer grab activates (but after any initial warp into a confine-to
13324window and before generating any actual
13325<link linkend="events:ButtonPress"><emphasis role='bold'>ButtonPress</emphasis></link>
13326event that activates the grab),
13327G is the grab-window for the grab, and P is the window the pointer is in:
13328</para>
13329
13330<itemizedlist>
13331  <listitem>
13332    <para>
13333<emphasis role='bold'>EnterNotify</emphasis>
13334and
13335<emphasis role='bold'>LeaveNotify</emphasis>
13336events with mode
13337<emphasis role='bold'>Grab</emphasis>
13338are generated (as for
13339<emphasis role='bold'>Normal</emphasis>
13340above) as if the pointer were to suddenly warp from its current
13341position in P to some position in G.
13342However, the pointer does not warp,
13343and the pointer position is used as both the initial
13344and final positions for the events.
13345    </para>
13346  </listitem>
13347</itemizedlist>
13348
13349<para>
13350When a pointer grab deactivates (but after generating any actual
13351<link linkend="events:ButtonRelease"><emphasis role='bold'>ButtonRelease</emphasis></link>
13352event that deactivates the grab), G is the grab-window for
13353the grab, and P is the window the pointer is in:
13354</para>
13355
13356<itemizedlist>
13357  <listitem>
13358    <para>
13359<emphasis role='bold'>EnterNotify</emphasis>
13360and
13361<emphasis role='bold'>LeaveNotify</emphasis>
13362events with mode
13363<emphasis role='bold'>Ungrab</emphasis>
13364are generated (as for
13365<emphasis role='bold'>Normal</emphasis>
13366above) as if the pointer were to suddenly warp from
13367some position in G to its current position in P.
13368However, the pointer does not warp,
13369and the current pointer position is used as both the initial
13370and final positions for the events.
13371    </para>
13372  </listitem>
13373</itemizedlist>
13374
13375  </section>
13376  <section id="events:input_focus">
13377    <title>Input Focus events</title>
13378    <indexterm zone="events:input_focus" significance="preferred"><primary>Input focus</primary><secondary>events</secondary></indexterm>
13379
13380<informaltable frame='none'>
13381  <?dbfo keep-together="always" ?>
13382  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
13383  <colspec colname='c1' colwidth='1.0*'/>
13384  <tbody>
13385    <row>
13386      <entry id="events:FocusIn">
13387<indexterm zone="events:FocusIn" significance="preferred"><primary>FocusIn</primary></indexterm>
13388<emphasis role='bold'>FocusIn</emphasis>
13389      </entry>
13390    </row>
13391    <row>
13392      <entry id="events:FocusOut">
13393<indexterm zone="events:FocusOut" significance="preferred"><primary>FocusOut</primary></indexterm>
13394<emphasis role='bold'>FocusOut</emphasis>
13395      </entry>
13396    </row>
13397    <row>
13398      <entry>
13399<!-- .in +.2i -->
13400<emphasis remap='I'>event</emphasis>: WINDOW
13401      </entry>
13402    </row>
13403    <row>
13404      <entry>
13405<emphasis remap='I'>mode</emphasis>:
13406{ <emphasis role='bold'>Normal</emphasis>,
13407<emphasis role='bold'>WhileGrabbed</emphasis>,
13408<emphasis role='bold'>Grab</emphasis>,
13409<emphasis role='bold'>Ungrab</emphasis>}
13410      </entry>
13411    </row>
13412    <row>
13413      <entry>
13414<emphasis remap='I'>detail</emphasis>:
13415{ <emphasis role='bold'>Ancestor</emphasis>,
13416<emphasis role='bold'>Virtual</emphasis>,
13417<emphasis role='bold'>Inferior</emphasis>,
13418<emphasis role='bold'>Nonlinear</emphasis>,
13419<emphasis role='bold'>NonlinearVirtual</emphasis>,
13420<emphasis role='bold'>Pointer</emphasis>,
13421      </entry>
13422    </row>
13423    <row>
13424      <entry>
13425<emphasis role='bold'>PointerRoot</emphasis>,
13426<emphasis role='bold'>None</emphasis> }
13427<!-- .in -.2i -->
13428<!-- .eM -->
13429      </entry>
13430    </row>
13431  </tbody>
13432  </tgroup>
13433</informaltable>
13434
13435<para>
13436These events are generated when the input focus changes
13437and are reported to clients selecting
13438<emphasis role='bold'>FocusChange</emphasis>
13439on the window.
13440Events generated by
13441<link linkend="requests:SetInputFocus"><emphasis role='bold'>SetInputFocus</emphasis></link>
13442when the keyboard is not grabbed have mode
13443<emphasis role='bold'>Normal</emphasis>.
13444Events generated by
13445<emphasis role='bold'>SetInputFocus</emphasis>
13446when the keyboard is grabbed have mode
13447<emphasis role='bold'>WhileGrabbed</emphasis>.
13448Events generated when a keyboard grab activates have mode
13449<emphasis role='bold'>Grab</emphasis>,
13450and events generated when a keyboard grab deactivates have mode
13451<emphasis role='bold'>Ungrab</emphasis>.
13452</para>
13453<para>
13454All
13455<emphasis role='bold'>FocusOut</emphasis>
13456events caused by a window unmap are generated after any
13457<link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>
13458event, but the ordering of
13459<emphasis role='bold'>FocusOut</emphasis>
13460with respect to generated
13461<link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>,
13462<link linkend="events:LeaveNotify"><emphasis role='bold'>LeaveNotify</emphasis></link>,
13463<link linkend="events:VisibilityNotify"><emphasis role='bold'>VisibilityNotify</emphasis></link>,
13464and
13465<link linkend="events:Expose"><emphasis role='bold'>Expose</emphasis></link>
13466events is not constrained.
13467</para>
13468<para>
13469<emphasis role='bold'>Normal</emphasis>
13470and
13471<emphasis role='bold'>WhileGrabbed</emphasis>
13472events are generated as follows:
13473</para>
13474<para>
13475When the focus moves from window A to window B, A is an inferior of B,
13476and the pointer is in window P:
13477</para>
13478
13479<itemizedlist>
13480  <listitem>
13481    <para>
13482<emphasis role='bold'>FocusOut</emphasis>
13483with detail
13484<emphasis role='bold'>Ancestor</emphasis>
13485is generated on A.
13486    </para>
13487  </listitem>
13488  <listitem>
13489    <para>
13490<emphasis role='bold'>FocusOut</emphasis>
13491with detail
13492<emphasis role='bold'>Virtual</emphasis>
13493is generated on each window between A and B exclusive (in order).
13494    </para>
13495  </listitem>
13496  <listitem>
13497    <para>
13498<emphasis role='bold'>FocusIn</emphasis>
13499with detail
13500<emphasis role='bold'>Inferior</emphasis>
13501is generated on B.
13502    </para>
13503  </listitem>
13504  <listitem>
13505    <para>
13506If P is an inferior of B
13507but P is not A or an inferior of A or an ancestor of A,
13508<emphasis role='bold'>FocusIn</emphasis>
13509with detail
13510<emphasis role='bold'>Pointer</emphasis>
13511is generated on each window below B down to and including P (in order).
13512    </para>
13513  </listitem>
13514</itemizedlist>
13515
13516
13517<para>
13518When the focus moves from window A to window B, B is an inferior of A,
13519and the pointer is in window P:
13520</para>
13521
13522<itemizedlist>
13523  <listitem>
13524    <para>
13525If P is an inferior of A
13526but P is not an inferior of B or an ancestor of B,
13527<emphasis role='bold'>FocusOut</emphasis>
13528with detail
13529<emphasis role='bold'>Pointer</emphasis>
13530is generated on each window from P up to but not including A (in order).
13531    </para>
13532  </listitem>
13533  <listitem>
13534    <para>
13535<emphasis role='bold'>FocusOut</emphasis>
13536with detail
13537<emphasis role='bold'>Inferior</emphasis>
13538is generated on A.
13539    </para>
13540  </listitem>
13541  <listitem>
13542    <para>
13543<emphasis role='bold'>FocusIn</emphasis>
13544with detail
13545<emphasis role='bold'>Virtual</emphasis>
13546is generated on each window between A and B exclusive (in order).
13547    </para>
13548  </listitem>
13549  <listitem>
13550    <para>
13551<emphasis role='bold'>FocusIn</emphasis>
13552with detail
13553<emphasis role='bold'>Ancestor</emphasis>
13554is generated on B.
13555    </para>
13556  </listitem>
13557</itemizedlist>
13558
13559<para>
13560When the focus moves from window A to window B, window C is their
13561least common ancestor, and the pointer is in window P:
13562</para>
13563
13564<itemizedlist>
13565  <listitem>
13566    <para>
13567If P is an inferior of A,
13568<emphasis role='bold'>FocusOut</emphasis>
13569with detail
13570<emphasis role='bold'>Pointer</emphasis>
13571is generated on each window from P up to but not including A (in order).
13572    </para>
13573  </listitem>
13574  <listitem>
13575    <para>
13576<emphasis role='bold'>FocusOut</emphasis>
13577with detail
13578<emphasis role='bold'>Nonlinear</emphasis>
13579is generated on A.
13580    </para>
13581  </listitem>
13582  <listitem>
13583    <para>
13584<emphasis role='bold'>FocusOut</emphasis>
13585with detail
13586<emphasis role='bold'>NonlinearVirtual</emphasis>
13587is generated on each window between A and C exclusive (in order).
13588    </para>
13589  </listitem>
13590  <listitem>
13591    <para>
13592<emphasis role='bold'>FocusIn</emphasis>
13593with detail
13594<emphasis role='bold'>NonlinearVirtual</emphasis>
13595is generated on each window between C and B exclusive (in order).
13596    </para>
13597  </listitem>
13598  <listitem>
13599    <para>
13600<emphasis role='bold'>FocusIn</emphasis>
13601with detail
13602<emphasis role='bold'>Nonlinear</emphasis>
13603is generated on B.
13604    </para>
13605  </listitem>
13606  <listitem>
13607    <para>
13608If P is an inferior of B,
13609<emphasis role='bold'>FocusIn</emphasis>
13610with detail
13611<emphasis role='bold'>Pointer</emphasis>
13612is generated on each window below B down to and including P (in order).
13613    </para>
13614  </listitem>
13615</itemizedlist>
13616
13617<para>
13618When the focus moves from window A to window B on different screens
13619and the pointer is in window P:
13620</para>
13621
13622
13623<itemizedlist>
13624  <listitem>
13625    <para>
13626If P is an inferior of A,
13627<emphasis role='bold'>FocusOut</emphasis>
13628with detail
13629<emphasis role='bold'>Pointer</emphasis>
13630is generated on each window from P up to but not including A (in order).
13631    </para>
13632  </listitem>
13633  <listitem>
13634    <para>
13635<emphasis role='bold'>FocusOut</emphasis>
13636with detail
13637<emphasis role='bold'>Nonlinear</emphasis>
13638is generated on A.
13639    </para>
13640  </listitem>
13641  <listitem>
13642    <para>
13643If A is not a root window,
13644<emphasis role='bold'>FocusOut</emphasis>
13645with detail
13646<emphasis role='bold'>NonlinearVirtual</emphasis>
13647is generated on each window above A up to and including its root (in order).
13648    </para>
13649  </listitem>
13650  <listitem>
13651    <para>
13652If B is not a root window,
13653<emphasis role='bold'>FocusIn</emphasis>
13654with detail
13655<emphasis role='bold'>NonlinearVirtual</emphasis>
13656is generated on each window from B's root down to but not including B
13657(in order).
13658    </para>
13659  </listitem>
13660  <listitem>
13661    <para>
13662<emphasis role='bold'>FocusIn</emphasis>
13663with detail
13664<emphasis role='bold'>Nonlinear</emphasis>
13665is generated on B.
13666    </para>
13667  </listitem>
13668  <listitem>
13669    <para>
13670If P is an inferior of B,
13671<emphasis role='bold'>FocusIn</emphasis>
13672with detail
13673<emphasis role='bold'>Pointer</emphasis>
13674is generated on each window below B down to and including P (in order).
13675    </para>
13676  </listitem>
13677</itemizedlist>
13678
13679<para>
13680When the focus moves from window A to
13681<emphasis role='bold'>PointerRoot</emphasis>
13682(or
13683<emphasis role='bold'>None</emphasis>)
13684and the pointer is in window P:
13685</para>
13686
13687
13688<itemizedlist>
13689  <listitem>
13690    <para>
13691If P is an inferior of A,
13692<emphasis role='bold'>FocusOut</emphasis>
13693with detail
13694<emphasis role='bold'>Pointer</emphasis>
13695is generated on each window from P up to but not including A (in order).
13696    </para>
13697  </listitem>
13698  <listitem>
13699    <para>
13700<emphasis role='bold'>FocusOut</emphasis>
13701with detail
13702<emphasis role='bold'>Nonlinear</emphasis>
13703is generated on A.
13704    </para>
13705  </listitem>
13706  <listitem>
13707    <para>
13708If A is not a root window,
13709<emphasis role='bold'>FocusOut</emphasis>
13710with detail
13711<emphasis role='bold'>NonlinearVirtual</emphasis>
13712is generated on each window above A up to and including its root (in order).
13713    </para>
13714  </listitem>
13715  <listitem>
13716    <para>
13717<emphasis role='bold'>FocusIn</emphasis>
13718with detail
13719<emphasis role='bold'>PointerRoot</emphasis>
13720(or
13721<emphasis role='bold'>None</emphasis>)
13722is generated on all root windows.
13723    </para>
13724  </listitem>
13725  <listitem>
13726    <para>
13727If the new focus is
13728<emphasis role='bold'>PointerRoot</emphasis>,
13729<emphasis role='bold'>FocusIn</emphasis>
13730with detail
13731<emphasis role='bold'>Pointer</emphasis>
13732is generated on each window from P's root down to and including P (in order).
13733    </para>
13734  </listitem>
13735</itemizedlist>
13736
13737<para>
13738When the focus moves from
13739<emphasis role='bold'>PointerRoot</emphasis>
13740(or
13741<emphasis role='bold'>None</emphasis>)
13742to window A and the pointer is in window P:
13743</para>
13744
13745
13746<itemizedlist>
13747  <listitem>
13748    <para>
13749If the old focus is
13750<emphasis role='bold'>PointerRoot</emphasis>,
13751<emphasis role='bold'>FocusOut</emphasis>
13752with detail
13753<emphasis role='bold'>Pointer</emphasis>
13754is generated on each window from P up to and including P's root (in order).
13755    </para>
13756  </listitem>
13757  <listitem>
13758    <para>
13759<emphasis role='bold'>FocusOut</emphasis>
13760with detail
13761<emphasis role='bold'>PointerRoot</emphasis>
13762(or
13763<emphasis role='bold'>None</emphasis>)
13764is generated on all root windows.
13765    </para>
13766  </listitem>
13767  <listitem>
13768    <para>
13769If A is not a root window,
13770<emphasis role='bold'>FocusIn</emphasis>
13771with detail
13772<emphasis role='bold'>NonlinearVirtual</emphasis>
13773is generated on each window from A's root down to but not including A
13774(in order).
13775    </para>
13776  </listitem>
13777  <listitem>
13778    <para>
13779<emphasis role='bold'>FocusIn</emphasis>
13780with detail
13781<emphasis role='bold'>Nonlinear</emphasis>
13782is generated on A.
13783    </para>
13784  </listitem>
13785  <listitem>
13786    <para>
13787If P is an inferior of A,
13788<emphasis role='bold'>FocusIn</emphasis>
13789with detail
13790<emphasis role='bold'>Pointer</emphasis>
13791is generated on each window below A down to and including P (in order).
13792    </para>
13793  </listitem>
13794</itemizedlist>
13795
13796<para>
13797When the focus moves from
13798<emphasis role='bold'>PointerRoot</emphasis>
13799to
13800<emphasis role='bold'>None</emphasis>
13801(or vice versa) and the pointer is in window P:
13802</para>
13803
13804<itemizedlist>
13805  <listitem>
13806    <para>
13807If the old focus is
13808<emphasis role='bold'>PointerRoot</emphasis>,
13809<emphasis role='bold'>FocusOut</emphasis>
13810with detail
13811<emphasis role='bold'>Pointer</emphasis>
13812is generated on each window from P up to and including P's root (in order).
13813    </para>
13814  </listitem>
13815  <listitem>
13816    <para>
13817<emphasis role='bold'>FocusOut</emphasis>
13818with detail
13819<emphasis role='bold'>PointerRoot</emphasis>
13820(or
13821<emphasis role='bold'>None</emphasis>)
13822is generated on all root windows.
13823    </para>
13824  </listitem>
13825  <listitem>
13826    <para>
13827<emphasis role='bold'>FocusIn</emphasis>
13828with detail
13829<emphasis role='bold'>None</emphasis>
13830(or
13831<emphasis role='bold'>PointerRoot</emphasis>)
13832is generated on all root windows.
13833    </para>
13834  </listitem>
13835  <listitem>
13836    <para>
13837If the new focus is
13838<emphasis role='bold'>PointerRoot</emphasis>,
13839<emphasis role='bold'>FocusIn</emphasis>
13840with detail
13841<emphasis role='bold'>Pointer</emphasis>
13842is generated on each window from P's root down to and including P (in order).
13843    </para>
13844  </listitem>
13845</itemizedlist>
13846
13847
13848<para>
13849When a keyboard grab activates (but before generating any actual
13850<emphasis role='bold'>KeyPress</emphasis>
13851event that activates the grab), G is the grab-window for the grab,
13852and F is the current focus:
13853</para>
13854
13855<itemizedlist>
13856  <listitem>
13857    <para>
13858<emphasis role='bold'>FocusIn</emphasis>
13859and
13860<emphasis role='bold'>FocusOut</emphasis>
13861events with mode
13862<emphasis role='bold'>Grab</emphasis>
13863are generated (as for
13864<emphasis role='bold'>Normal</emphasis>
13865above) as if the focus were to change from F to G.
13866    </para>
13867  </listitem>
13868</itemizedlist>
13869
13870<para>
13871When a keyboard grab deactivates (but after generating any actual
13872<emphasis role='bold'>KeyRelease</emphasis>
13873event that deactivates the grab), G is the grab-window for the grab,
13874and F is the current focus:
13875</para>
13876
13877<itemizedlist>
13878  <listitem>
13879    <para>
13880<emphasis role='bold'>FocusIn</emphasis>
13881and
13882<emphasis role='bold'>FocusOut</emphasis>
13883events with mode
13884<emphasis role='bold'>Ungrab</emphasis>
13885are generated (as for
13886<emphasis role='bold'>Normal</emphasis>
13887above) as if the focus were to change from G to F.
13888    </para>
13889  </listitem>
13890</itemizedlist>
13891
13892  </section>
13893  <section id="events:KeymapNotify">
13894    <title>KeymapNotify</title>
13895    <indexterm zone="events:KeymapNotify" significance="preferred"><primary>KeymapNotify</primary></indexterm>
13896
13897<informaltable frame='none'>
13898  <?dbfo keep-together="always" ?>
13899  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
13900  <colspec colname='c1' colwidth='1.0*'/>
13901  <tbody>
13902    <row>
13903      <entry>
13904	<emphasis role='bold'>KeymapNotify</emphasis>
13905      </entry>
13906    </row>
13907    <row>
13908      <entry>
13909<emphasis remap='I'>keys</emphasis>: LISTofCARD8
13910      </entry>
13911    </row>
13912  </tbody>
13913  </tgroup>
13914</informaltable>
13915
13916<para>
13917The value is a bit vector as described in
13918<link linkend="requests:QueryKeymap"><emphasis role='bold'>QueryKeymap</emphasis></link>.
13919This event is reported to clients selecting
13920<emphasis role='bold'>KeymapState</emphasis>
13921on a window and is generated immediately after every
13922<link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>
13923and
13924<link linkend="events:FocusIn"><emphasis role='bold'>FocusIn</emphasis></link>.
13925<!-- .sp -->
13926</para>
13927  </section>
13928  <section id="events:Expose">
13929    <title>Expose</title>
13930    <indexterm zone="events:Expose" significance="preferred"><primary>Expose</primary></indexterm>
13931    <indexterm zone="events:Expose"><primary>Event</primary><secondary>Exposure</secondary></indexterm>
13932<informaltable frame='none'>
13933  <?dbfo keep-together="always" ?>
13934  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
13935  <colspec colname='c1' colwidth='1.0*'/>
13936  <tbody>
13937    <row>
13938      <entry>
13939	<emphasis role='bold'>Expose</emphasis>
13940      </entry>
13941    </row>
13942    <row>
13943      <entry>
13944<!-- .in +.2i -->
13945<emphasis remap='I'>window</emphasis>: WINDOW
13946      </entry>
13947    </row>
13948    <row>
13949      <entry>
13950<emphasis remap='I'>x</emphasis>,
13951<emphasis remap='I'>y</emphasis>,
13952<emphasis remap='I'>width</emphasis>,
13953<emphasis remap='I'>height</emphasis>: CARD16
13954      </entry>
13955    </row>
13956    <row>
13957      <entry>
13958<emphasis remap='I'>count</emphasis>: CARD16
13959<!-- .in -.2i -->
13960<!-- .eM -->
13961      </entry>
13962    </row>
13963  </tbody>
13964  </tgroup>
13965</informaltable>
13966<para>
13967This event is reported to clients selecting
13968<emphasis role='bold'>Exposure</emphasis>
13969on the window.
13970It is generated when no valid contents are available for regions of a window,
13971and either the regions are visible, the regions are viewable
13972and the server is (perhaps newly) maintaining backing store on the window,
13973or the window is not viewable but the server is (perhaps newly) honoring
13974window's backing-store attribute of
13975<emphasis role='bold'>Always</emphasis>
13976or
13977<emphasis role='bold'>WhenMapped</emphasis>.
13978The regions are decomposed into an arbitrary set of rectangles,
13979and an
13980<emphasis role='bold'>Expose</emphasis>
13981event is generated for each rectangle.
13982</para>
13983<para>
13984For a given action causing exposure events,
13985the set of events for a given window are guaranteed to be reported contiguously.
13986If count is zero,
13987then no more
13988<emphasis role='bold'>Expose</emphasis>
13989events for this window follow.
13990If count is nonzero,
13991then at least that many more
13992<emphasis role='bold'>Expose</emphasis>
13993events for this window follow (and possibly more).
13994</para>
13995<para>
13996The x and y coordinates are relative to window's origin
13997and specify the upper-left corner of a rectangle.
13998The width and height specify the extent of the rectangle.
13999</para>
14000<para>
14001<emphasis role='bold'>Expose</emphasis>
14002events are never generated on
14003<emphasis role='bold'>InputOnly</emphasis>
14004windows.
14005</para>
14006<para>
14007All
14008<emphasis role='bold'>Expose</emphasis>
14009events caused by a hierarchy change are generated after any
14010hierarchy event caused by that change (for example,
14011<link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>,
14012<link linkend="events:MapNotify"><emphasis role='bold'>MapNotify</emphasis></link>,
14013<link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>,
14014<link linkend="events:GravityNotify"><emphasis role='bold'>GravityNotify</emphasis></link>,
14015<link linkend="events:CirculateNotify"><emphasis role='bold'>CirculateNotify</emphasis></link>).
14016All
14017<emphasis role='bold'>Expose</emphasis>
14018events on a given window are generated after any
14019<link linkend="events:VisibilityNotify"><emphasis role='bold'>VisibilityNotify</emphasis></link>
14020event on that window,
14021but it is not required that all
14022<emphasis role='bold'>Expose</emphasis>
14023events on all windows be generated after all
14024<emphasis role='bold'>Visibilitity</emphasis>
14025events on all windows.
14026The ordering of
14027<emphasis role='bold'>Expose</emphasis>
14028events with respect to
14029<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>,
14030<link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>,
14031and
14032<link linkend="events:LeaveNotify"><emphasis role='bold'>LeaveNotify</emphasis></link>
14033events is not constrained.
14034<!-- .sp -->
14035</para>
14036  </section>
14037  <section id="events:GraphicsExposure">
14038    <title>GraphicsExposure</title>
14039    <indexterm zone="events:GraphicsExposure" significance="preferred"><primary>GraphicsExposure</primary></indexterm>
14040<informaltable frame='none'>
14041  <?dbfo keep-together="always" ?>
14042  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14043  <colspec colname='c1' colwidth='1.0*'/>
14044  <tbody>
14045    <row>
14046      <entry>
14047	<emphasis role='bold'>GraphicsExposure</emphasis>
14048      </entry>
14049    </row>
14050    <row>
14051      <entry>
14052<!-- .in +.2i -->
14053<emphasis remap='I'>drawable</emphasis>: DRAWABLE
14054      </entry>
14055    </row>
14056    <row>
14057      <entry>
14058<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>, <emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
14059      </entry>
14060    </row>
14061    <row>
14062      <entry>
14063<emphasis remap='I'>count</emphasis>: CARD16
14064      </entry>
14065    </row>
14066    <row>
14067      <entry>
14068<emphasis remap='I'>major-opcode</emphasis>: CARD8
14069      </entry>
14070    </row>
14071    <row>
14072      <entry>
14073<emphasis remap='I'>minor-opcode</emphasis>: CARD16
14074<!-- .in -.2i -->
14075<!-- .eM -->
14076      </entry>
14077    </row>
14078  </tbody>
14079  </tgroup>
14080</informaltable>
14081<!-- .eM -->
14082<para>
14083This event is reported to a client using a graphics context
14084with graphics-exposures selected
14085and is generated when a destination region could not be computed due
14086to an obscured or out-of-bounds source region.
14087All of the regions exposed by a given graphics request
14088are guaranteed to be reported contiguously.
14089If count is zero then no more
14090<emphasis role='bold'>GraphicsExposure</emphasis>
14091events for this window follow.
14092If count is nonzero,
14093then at least that many more
14094<emphasis role='bold'>GraphicsExposure</emphasis>
14095events for this window follow (and possibly more).
14096</para>
14097<para>
14098The x and y coordinates are relative to drawable's origin
14099and specify the upper-left corner of a rectangle.
14100The width and height specify the extent of the rectangle.
14101</para>
14102<para>
14103The major and minor opcodes identify the graphics request used.
14104For the core protocol,
14105major-opcode is always
14106<link linkend="requests:CopyArea"><emphasis role='bold'>CopyArea</emphasis></link>
14107or
14108<link linkend="requests:CopyPlane"><emphasis role='bold'>CopyPlane</emphasis></link>,
14109and minor-opcode is always zero.
14110<!-- .sp -->
14111</para>
14112  </section>
14113  <section id="events:NoExposure">
14114    <title>NoExposure</title>
14115    <indexterm zone="events:NoExposure" significance="preferred"><primary>NoExposure</primary></indexterm>
14116<informaltable frame='none'>
14117  <?dbfo keep-together="always" ?>
14118  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14119  <colspec colname='c1' colwidth='1.0*'/>
14120  <tbody>
14121     <row>
14122      <entry>
14123	<emphasis role='bold'>NoExposure</emphasis>
14124      </entry>
14125    </row>
14126   <row>
14127      <entry>
14128<!-- .in +.2i -->
14129<emphasis remap='I'>drawable</emphasis>: DRAWABLE
14130      </entry>
14131    </row>
14132    <row>
14133      <entry>
14134<emphasis remap='I'>major-opcode</emphasis>: CARD8
14135      </entry>
14136    </row>
14137    <row>
14138      <entry>
14139<emphasis remap='I'>minor-opcode:</emphasis> CARD16
14140<!-- .in -.2i -->
14141<!-- .eM -->
14142      </entry>
14143    </row>
14144  </tbody>
14145  </tgroup>
14146</informaltable>
14147<!-- .eM -->
14148<para>
14149This event is reported to a client using a graphics context
14150with graphics-exposures selected
14151and is generated when a graphics request
14152that might produce
14153<link linkend="events:GraphicsExposure"><emphasis role='bold'>GraphicsExposure</emphasis></link>
14154events does not produce any.
14155The drawable specifies the destination used for the graphics request.
14156</para>
14157<para>
14158The major and minor opcodes identify the graphics request used.
14159For the core protocol,
14160major-opcode is always
14161<link linkend="requests:CopyArea"><emphasis role='bold'>CopyArea</emphasis></link>
14162or
14163<link linkend="requests:CopyPlane"><emphasis role='bold'>CopyPlane</emphasis></link>,
14164and the minor-opcode is always zero.
14165<!-- .sp -->
14166</para>
14167  </section>
14168  <section id="events:VisibilityNotify">
14169    <title>VisibilityNotify</title>
14170    <indexterm zone="events:VisibilityNotify" significance="preferred"><primary>VisibilityNotify</primary></indexterm>
14171<informaltable frame='none'>
14172  <?dbfo keep-together="always" ?>
14173  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14174  <colspec colname='c1' colwidth='1.0*'/>
14175  <tbody>
14176    <row>
14177      <entry>
14178	<emphasis role='bold'>VisibilityNotify</emphasis>
14179      </entry>
14180    </row>
14181    <row>
14182      <entry>
14183<!-- .in +.2i -->
14184<emphasis remap='I'>window</emphasis>: WINDOW
14185      </entry>
14186    </row>
14187    <row>
14188      <entry>
14189<emphasis remap='I'>state</emphasis>:
14190{ <emphasis role='bold'>Unobscured</emphasis>,
14191<emphasis role='bold'>PartiallyObscured</emphasis>,
14192<emphasis role='bold'>FullyObscured</emphasis>}
14193<!-- .in -.2i -->
14194<!-- .eM -->
14195      </entry>
14196    </row>
14197  </tbody>
14198  </tgroup>
14199</informaltable>
14200<!-- .eM -->
14201<para>
14202This event is reported to clients selecting
14203<emphasis role='bold'>VisibilityChange</emphasis>
14204on the window.
14205In the following,
14206the state of the window is calculated ignoring all of the window's subwindows.
14207When a window changes state from partially or fully obscured or
14208not viewable to viewable and completely unobscured,
14209an event with
14210<emphasis role='bold'>Unobscured</emphasis>
14211is generated.
14212When a window changes state from viewable and completely unobscured,
14213from viewable and completely obscured,
14214or from not viewable, to viewable and partially obscured,
14215an event with
14216<emphasis role='bold'>PartiallyObscured</emphasis>
14217is generated.
14218When a window changes state from viewable and completely unobscured,
14219from viewable and partially obscured,
14220or from not viewable to viewable and fully obscured,
14221an event with
14222<emphasis role='bold'>FullyObscured</emphasis>
14223is generated.
14224</para>
14225<para>
14226<emphasis role='bold'>VisibilityNotify</emphasis>
14227events are never generated on
14228<emphasis role='bold'>InputOnly</emphasis>
14229windows.
14230</para>
14231<para>
14232All
14233<emphasis role='bold'>VisibilityNotify</emphasis>
14234events caused by a hierarchy change are generated after any hierarchy event
14235caused by that change (for example,
14236<link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>,
14237<link linkend="events:MapNotify"><emphasis role='bold'>MapNotify</emphasis></link>,
14238<link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>,
14239<link linkend="events:GravityNotify"><emphasis role='bold'>GravityNotify</emphasis></link>,
14240<link linkend="events:CirculateNotify"><emphasis role='bold'>CirculateNotify</emphasis></link>).
14241Any
14242<emphasis role='bold'>VisibilityNotify</emphasis>
14243event on a given window is generated before any
14244<link linkend="events:Expose"><emphasis role='bold'>Expose</emphasis></link>
14245events on that window,
14246but it is not required that all
14247<emphasis role='bold'>VisibilityNotify</emphasis>
14248events on all windows be generated before all
14249<emphasis role='bold'>Expose</emphasis>
14250events on all windows.
14251The ordering of
14252<emphasis role='bold'>VisibilityNotify</emphasis>
14253events with respect to
14254<link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>,
14255<link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>,
14256and
14257<link linkend="events:LeaveNotify"><emphasis role='bold'>LeaveNotify</emphasis></link>
14258events is not constrained.
14259<!-- .sp -->
14260</para>
14261  </section>
14262  <section id="events:CreateNotify">
14263    <title>CreateNotify</title>
14264    <indexterm zone="events:CreateNotify" significance="preferred"><primary>CreateNotify</primary></indexterm>
14265<informaltable frame='none'>
14266  <?dbfo keep-together="always" ?>
14267  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14268  <colspec colname='c1' colwidth='1.0*'/>
14269  <tbody>
14270    <row>
14271      <entry>
14272	<emphasis role='bold'>CreateNotify</emphasis>
14273      </entry>
14274    </row>
14275    <row>
14276      <entry>
14277<!-- .in +.2i -->
14278<emphasis remap='I'>parent</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14279      </entry>
14280    </row>
14281    <row>
14282      <entry>
14283<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
14284      </entry>
14285    </row>
14286    <row>
14287      <entry>
14288<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>, <emphasis remap='I'>border-width</emphasis>: CARD16
14289      </entry>
14290    </row>
14291    <row>
14292      <entry>
14293<emphasis remap='I'>override-redirect</emphasis>: BOOL
14294<!-- .in -.2i -->
14295<!-- .eM -->
14296      </entry>
14297    </row>
14298  </tbody>
14299  </tgroup>
14300</informaltable>
14301<!-- .eM -->
14302<para>
14303This event is reported to clients selecting
14304<emphasis role='bold'>SubstructureNotify</emphasis>
14305on the parent
14306and is generated when the window is created.
14307The arguments are as in the
14308<link linkend="requests:CreateWindow"><emphasis role='bold'>CreateWindow</emphasis></link>
14309request.
14310<!-- .sp -->
14311</para>
14312  </section>
14313  <section id="events:DestroyNotify">
14314    <title>DestroyNotify</title>
14315    <indexterm zone="events:DestroyNotify" significance="preferred"><primary>DestroyNotify</primary></indexterm>
14316<informaltable frame='none'>
14317  <?dbfo keep-together="always" ?>
14318  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14319  <colspec colname='c1' colwidth='1.0*'/>
14320  <tbody>
14321    <row>
14322      <entry>
14323	<emphasis role='bold'>DestroyNotify</emphasis>
14324      </entry>
14325    </row>
14326    <row>
14327      <entry>
14328<!-- .in +.2i -->
14329<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14330<!-- .in -.2i -->
14331<!-- .eM -->
14332      </entry>
14333    </row>
14334  </tbody>
14335  </tgroup>
14336</informaltable>
14337<!-- .eM -->
14338<para>
14339This event is reported to clients selecting
14340<emphasis role='bold'>StructureNotify</emphasis>
14341on the window and to clients selecting
14342<emphasis role='bold'>SubstructureNotify</emphasis>
14343on the parent.
14344It is generated when the window is destroyed.
14345The event is the window on which the event was generated,
14346and the window is the window that is destroyed.
14347</para>
14348<para>
14349The ordering of the
14350<emphasis role='bold'>DestroyNotify</emphasis>
14351events is such that for any given window,
14352<emphasis role='bold'>DestroyNotify</emphasis>
14353is generated on all inferiors of the window
14354before being generated on the window itself.
14355The ordering among siblings and across subhierarchies is not
14356otherwise constrained.
14357<!-- .sp -->
14358</para>
14359  </section>
14360  <section id="events:UnmapNotify">
14361    <title>UnmapNotify</title>
14362    <indexterm zone="events:UnmapNotify" significance="preferred"><primary>UnmapNotify</primary></indexterm>
14363<informaltable frame='none'>
14364  <?dbfo keep-together="always" ?>
14365  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14366  <colspec colname='c1' colwidth='1.0*'/>
14367  <tbody>
14368    <row>
14369      <entry>
14370	<emphasis role='bold'>UnmapNotify</emphasis>
14371      </entry>
14372    </row>
14373    <row>
14374      <entry>
14375<!-- .in +.2i -->
14376<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14377      </entry>
14378    </row>
14379    <row>
14380      <entry>
14381<emphasis remap='I'>from-configure</emphasis>: BOOL
14382<!-- .in -.2i -->
14383<!-- .eM -->
14384      </entry>
14385    </row>
14386  </tbody>
14387  </tgroup>
14388</informaltable>
14389<!-- .eM -->
14390<para>
14391This event is reported to clients selecting
14392<emphasis role='bold'>StructureNotify</emphasis>
14393on the window and to clients selecting
14394<emphasis role='bold'>SubstructureNotify</emphasis>
14395on the parent.
14396It is generated when the window changes state from mapped to unmapped.
14397The event is the window on which the event was generated,
14398and the window is the window that is unmapped.
14399The from-configure flag is
14400<emphasis role='bold'>True</emphasis>
14401if the event was generated as a result of the window's parent being resized
14402when the window itself had a win-gravity of
14403<emphasis role='bold'>Unmap</emphasis>.
14404<!-- .sp -->
14405</para>
14406  </section>
14407  <section id="events:MapNotify">
14408    <title>MapNotify</title>
14409    <indexterm zone="events:MapNotify" significance="preferred"><primary>MapNotify</primary></indexterm>
14410    <indexterm zone="events:MapNotify"><primary>Mapped window</primary></indexterm>
14411<informaltable frame='none'>
14412  <?dbfo keep-together="always" ?>
14413  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14414  <colspec colname='c1' colwidth='1.0*'/>
14415  <tbody>
14416    <row>
14417      <entry>
14418	<emphasis role='bold'>MapNotify</emphasis>
14419      </entry>
14420    </row>
14421    <row>
14422      <entry>
14423<!-- .in +.2i -->
14424<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14425      </entry>
14426    </row>
14427    <row>
14428      <entry>
14429<emphasis remap='I'>override-redirect</emphasis>: BOOL
14430<!-- .in -.2i -->
14431<!-- .eM -->
14432      </entry>
14433    </row>
14434  </tbody>
14435  </tgroup>
14436</informaltable>
14437<!-- .eM -->
14438<para>
14439This event is reported to clients selecting
14440<emphasis role='bold'>StructureNotify</emphasis>
14441on the window and to clients selecting
14442<emphasis role='bold'>SubstructureNotify</emphasis>
14443on the parent.
14444It is generated when the window changes state from unmapped to mapped.
14445The event is the window on which the event was generated,
14446and the window is the window that is mapped.
14447The override-redirect flag is from the window's attribute.
14448<!-- .sp -->
14449</para>
14450  </section>
14451  <section id="events:MapRequest">
14452    <title>MapRequest</title>
14453    <indexterm zone="events:MapRequest" significance="preferred"><primary>MapRequest</primary></indexterm>
14454<informaltable frame='none'>
14455  <?dbfo keep-together="always" ?>
14456  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14457  <colspec colname='c1' colwidth='1.0*'/>
14458  <tbody>
14459    <row>
14460      <entry>
14461	<emphasis role='bold'>MapRequest</emphasis>
14462      </entry>
14463    </row>
14464    <row>
14465      <entry>
14466<!-- .in +.2i -->
14467<emphasis remap='I'>parent</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14468<!-- .in -.2i -->
14469<!-- .eM -->
14470      </entry>
14471    </row>
14472  </tbody>
14473  </tgroup>
14474</informaltable>
14475<!-- .eM -->
14476<para>
14477This event is reported to the client selecting
14478<emphasis role='bold'>SubstructureRedirect</emphasis>
14479on the parent and is generated when a
14480<link linkend="requests:MapWindow"><emphasis role='bold'>MapWindow</emphasis></link>
14481request is issued on an unmapped window with an override-redirect attribute of
14482<emphasis role='bold'>False</emphasis>.
14483<!-- .sp -->
14484</para>
14485  </section>
14486  <section id="events:ReparentNotify">
14487    <title>ReparentNotify</title>
14488    <indexterm zone="events:ReparentNotify" significance="preferred"><primary>ReparentNotify</primary></indexterm>
14489<informaltable frame='none'>
14490  <?dbfo keep-together="always" ?>
14491  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14492  <colspec colname='c1' colwidth='1.0*'/>
14493  <tbody>
14494    <row>
14495      <entry>
14496	<emphasis role='bold'>ReparentNotify</emphasis>
14497      </entry>
14498    </row>
14499    <row>
14500      <entry>
14501<!-- .in +.2i -->
14502<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>, <emphasis remap='I'>parent</emphasis>: WINDOW
14503      </entry>
14504    </row>
14505    <row>
14506      <entry>
14507<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
14508      </entry>
14509    </row>
14510    <row>
14511      <entry>
14512<emphasis remap='I'>override-redirect</emphasis>: BOOL
14513<!-- .in -.2i -->
14514<!-- .eM -->
14515      </entry>
14516    </row>
14517  </tbody>
14518  </tgroup>
14519</informaltable>
14520<!-- .eM -->
14521<para>
14522This event is reported to clients selecting
14523<emphasis role='bold'>SubstructureNotify</emphasis>
14524on either the old or the new parent and to clients selecting
14525<emphasis role='bold'>StructureNotify</emphasis>
14526on the window.
14527It is generated when the window is reparented.
14528The event is the window on which the event was generated.
14529The window is the window that has been rerooted.
14530The parent specifies the new parent.
14531The x and y coordinates are relative to the new parent's origin
14532and specify the position of the upper-left outer corner of the window.
14533The override-redirect flag is from the window's attribute.
14534<!-- .sp -->
14535</para>
14536  </section>
14537  <section id="events:ConfigureNotify">
14538    <title>ConfigureNotify</title>
14539    <indexterm zone="events:ConfigureNotify" significance="preferred"><primary>ConfigureNotify</primary></indexterm>
14540<informaltable frame='none'>
14541  <?dbfo keep-together="always" ?>
14542  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14543  <colspec colname='c1' colwidth='1.0*'/>
14544  <tbody>
14545    <row>
14546      <entry>
14547	<emphasis role='bold'>ConfigureNotify</emphasis>
14548      </entry>
14549    </row>
14550    <row>
14551      <entry>
14552<!-- .in +.2i -->
14553<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14554      </entry>
14555    </row>
14556    <row>
14557      <entry>
14558<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
14559      </entry>
14560    </row>
14561    <row>
14562      <entry>
14563<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>, <emphasis remap='I'>border-width</emphasis>: CARD16
14564      </entry>
14565    </row>
14566    <row>
14567      <entry>
14568<emphasis remap='I'>above-sibling</emphasis>: WINDOW or
14569<emphasis role='bold'>None</emphasis>
14570      </entry>
14571    </row>
14572    <row>
14573      <entry>
14574<emphasis remap='I'>override-redirect</emphasis>: BOOL
14575<!-- .in -.2i -->
14576<!-- .eM -->
14577      </entry>
14578    </row>
14579  </tbody>
14580  </tgroup>
14581</informaltable>
14582<!-- .eM -->
14583<para>
14584This event is reported to clients selecting
14585<emphasis role='bold'>StructureNotify</emphasis>
14586on the window and to clients selecting
14587<emphasis role='bold'>SubstructureNotify</emphasis>
14588on the parent.
14589It is generated when a
14590<link linkend="requests:ConfigureWindow"><emphasis role='bold'>ConfigureWindow</emphasis></link>
14591request actually changes the state of the window.
14592The event is the window on which the event was generated,
14593and the window is the window that is changed.
14594The x and y coordinates are relative to the new parent's origin
14595and specify the position of the upper-left outer corner of the window.
14596The width and height specify the inside size, not including the border.
14597If above-sibling is
14598<emphasis role='bold'>None</emphasis>,
14599then the window is on the bottom of the stack with respect to siblings.
14600Otherwise, the window is immediately on top of the specified sibling.
14601The override-redirect flag is from the window's attribute.
14602<!-- .sp -->
14603</para>
14604  </section>
14605  <section id="events:GravityNotify">
14606    <title>GravityNotify</title>
14607    <indexterm zone="events:GravityNotify" significance="preferred"><primary>GravityNotify</primary></indexterm>
14608<informaltable frame='none'>
14609  <?dbfo keep-together="always" ?>
14610  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14611  <colspec colname='c1' colwidth='1.0*'/>
14612  <tbody>
14613    <row>
14614      <entry>
14615	<emphasis role='bold'>GravityNotify</emphasis>
14616      </entry>
14617    </row>
14618    <row>
14619      <entry>
14620<!-- .in +.2i -->
14621<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14622      </entry>
14623    </row>
14624    <row>
14625      <entry>
14626<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
14627<!-- .in -.2i -->
14628<!-- .eM -->
14629      </entry>
14630    </row>
14631  </tbody>
14632  </tgroup>
14633</informaltable>
14634<!-- .eM -->
14635<para>
14636This event is reported to clients selecting
14637<emphasis role='bold'>SubstructureNotify</emphasis>
14638on the parent and to clients selecting
14639<emphasis role='bold'>StructureNotify</emphasis>
14640on the window.
14641It is generated when a window is moved because of a change in size
14642of the parent.
14643The event is the window on which the event was generated,
14644and the window is the window that is moved.
14645The x and y coordinates are relative to the new parent's origin
14646and specify the position of the upper-left outer corner of the window.
14647<!-- .sp -->
14648</para>
14649  </section>
14650  <section id="events:ResizeRequest">
14651    <title>ResizeRequest</title>
14652    <indexterm zone="events:ResizeRequest" significance="preferred"><primary>ResizeRequest</primary></indexterm>
14653<informaltable frame='none'>
14654  <?dbfo keep-together="always" ?>
14655  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14656  <colspec colname='c1' colwidth='1.0*'/>
14657  <tbody>
14658    <row>
14659      <entry>
14660	<emphasis role='bold'>ResizeRequest</emphasis>
14661      </entry>
14662    </row>
14663    <row>
14664      <entry>
14665<!-- .in +.2i -->
14666<emphasis remap='I'>window</emphasis>: WINDOW
14667      </entry>
14668    </row>
14669    <row>
14670      <entry>
14671<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>: CARD16
14672<!-- .in -.2i -->
14673<!-- .eM -->
14674      </entry>
14675    </row>
14676  </tbody>
14677  </tgroup>
14678</informaltable>
14679<!-- .eM -->
14680<para>
14681This event is reported to the client selecting
14682<emphasis role='bold'>ResizeRedirect</emphasis>
14683on the window and is generated when a
14684<link linkend="requests:ConfigureWindow"><emphasis role='bold'>ConfigureWindow</emphasis></link>
14685request by some other client on the window attempts to change the size
14686of the window.
14687The width and height are the requested inside size, not including the border.
14688<!-- .sp -->
14689</para>
14690  </section>
14691  <section id="events:ConfigureRequest">
14692    <title>ConfigureRequest</title>
14693    <indexterm zone="events:ConfigureRequest" significance="preferred"><primary>ConfigureRequest</primary></indexterm>
14694<informaltable frame='none'>
14695  <?dbfo keep-together="always" ?>
14696  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14697  <colspec colname='c1' colwidth='1.0*'/>
14698  <tbody>
14699    <row>
14700      <entry>
14701	<emphasis role='bold'>ConfigureRequest</emphasis>
14702      </entry>
14703    </row>
14704    <row>
14705      <entry>
14706<!-- .in +.2i -->
14707<emphasis remap='I'>parent</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14708      </entry>
14709    </row>
14710    <row>
14711      <entry>
14712<emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>: INT16
14713      </entry>
14714    </row>
14715    <row>
14716      <entry>
14717<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>, <emphasis remap='I'>border-width</emphasis>: CARD16
14718      </entry>
14719    </row>
14720    <row>
14721      <entry>
14722<emphasis remap='I'>sibling</emphasis>: WINDOW or
14723<emphasis role='bold'>None</emphasis>
14724      </entry>
14725    </row>
14726    <row>
14727      <entry>
14728<emphasis remap='I'>stack-mode</emphasis>:
14729{ <emphasis role='bold'>Above</emphasis>,
14730<emphasis role='bold'>Below</emphasis>,
14731<emphasis role='bold'>TopIf</emphasis>,
14732<emphasis role='bold'>BottomIf</emphasis>,
14733<emphasis role='bold'>Opposite</emphasis>}
14734      </entry>
14735    </row>
14736    <row>
14737      <entry>
14738<emphasis remap='I'>value-mask</emphasis>: BITMASK
14739<!-- .in -.2i -->
14740<!-- .eM -->
14741      </entry>
14742    </row>
14743  </tbody>
14744  </tgroup>
14745</informaltable>
14746<!-- .eM -->
14747<para>
14748This event is reported to the client selecting
14749<emphasis role='bold'>SubstructureRedirect</emphasis>
14750on the parent and is generated when a
14751<link linkend="requests:ConfigureWindow"><emphasis role='bold'>ConfigureWindow</emphasis></link>
14752request is issued on the window by some other client.
14753The value-mask indicates which components were specified in the request.
14754The value-mask and the corresponding values are reported as given
14755in the request.
14756The remaining values are filled in from the current geometry of the window,
14757except in the case of sibling and stack-mode,
14758which are reported as
14759<emphasis role='bold'>None</emphasis>
14760and
14761<emphasis role='bold'>Above</emphasis>
14762(respectively) if not given in the request.
14763<!-- .sp -->
14764</para>
14765  </section>
14766  <section id="events:CirculateNotify">
14767    <title>CirculateNotify</title>
14768    <indexterm zone="events:CirculateNotify" significance="preferred"><primary>CirculateNotify</primary></indexterm>
14769<informaltable frame='none'>
14770  <?dbfo keep-together="always" ?>
14771  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14772  <colspec colname='c1' colwidth='1.0*'/>
14773  <tbody>
14774    <row>
14775      <entry>
14776	<emphasis role='bold'>CirculateNotify</emphasis>
14777      </entry>
14778    </row>
14779    <row>
14780      <entry>
14781<!-- .in +.2i -->
14782<emphasis remap='I'>event</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14783      </entry>
14784    </row>
14785    <row>
14786      <entry>
14787<emphasis remap='I'>place</emphasis>:
14788{ <emphasis role='bold'>Top</emphasis>,
14789<emphasis role='bold'>Bottom</emphasis>}
14790<!-- .in -.2i -->
14791<!-- .eM -->
14792      </entry>
14793    </row>
14794  </tbody>
14795  </tgroup>
14796</informaltable>
14797<!-- .eM -->
14798<para>
14799This event is reported to clients selecting
14800<emphasis role='bold'>StructureNotify</emphasis>
14801on the window and to clients selecting
14802<emphasis role='bold'>SubstructureNotify</emphasis>
14803on the parent.
14804It is generated when the window is actually restacked from a
14805<link linkend="requests:CirculateWindow"><emphasis role='bold'>CirculateWindow</emphasis></link>
14806request.
14807The event is the window on which the event was generated,
14808and the window is the window that is restacked.
14809If place is
14810<emphasis role='bold'>Top</emphasis>,
14811the window is now on top of all siblings.
14812Otherwise, it is below all siblings.
14813<!-- .sp -->
14814</para>
14815  </section>
14816  <section id="events:CirculateRequest">
14817    <title>CirculateRequest</title>
14818    <indexterm zone="events:CirculateRequest" significance="preferred"><primary>CirculateRequest</primary></indexterm>
14819<informaltable frame='none'>
14820  <?dbfo keep-together="always" ?>
14821  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14822  <colspec colname='c1' colwidth='1.0*'/>
14823  <tbody>
14824    <row>
14825      <entry>
14826	<emphasis role='bold'>CirculateRequest</emphasis>
14827      </entry>
14828    </row>
14829    <row>
14830      <entry>
14831<!-- .in +.2i -->
14832<emphasis remap='I'>parent</emphasis>, <emphasis remap='I'>window</emphasis>: WINDOW
14833      </entry>
14834    </row>
14835    <row>
14836      <entry>
14837<emphasis remap='I'>place</emphasis>:
14838{ <emphasis role='bold'>Top</emphasis>,
14839<emphasis role='bold'>Bottom</emphasis>}
14840<!-- .in -.2i -->
14841<!-- .eM -->
14842      </entry>
14843    </row>
14844  </tbody>
14845  </tgroup>
14846</informaltable>
14847<!-- .eM -->
14848<para>
14849This event is reported to the client selecting
14850<emphasis role='bold'>SubstructureRedirect</emphasis>
14851on the parent and is generated when a
14852<link linkend="requests:CirculateWindow"><emphasis role='bold'>CirculateWindow</emphasis></link>
14853request is issued on the parent and a window actually needs to be restacked.
14854The window specifies the window to be restacked,
14855and the place specifies what the new position in the stacking order should be.
14856<!-- .sp -->
14857</para>
14858  </section>
14859  <section id="events:PropertyNotify">
14860    <title>PropertyNotify</title>
14861    <indexterm zone="events:PropertyNotify" significance="preferred"><primary>PropertyNotify</primary></indexterm>
14862<informaltable frame='none'>
14863  <?dbfo keep-together="always" ?>
14864  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14865  <colspec colname='c1' colwidth='1.0*'/>
14866  <tbody>
14867    <row>
14868      <entry>
14869	<emphasis role='bold'>PropertyNotify</emphasis>
14870      </entry>
14871    </row>
14872    <row>
14873      <entry>
14874<!-- .in +.2i -->
14875<emphasis remap='I'>window</emphasis>: WINDOW
14876      </entry>
14877    </row>
14878    <row>
14879      <entry>
14880<emphasis remap='I'>atom</emphasis>: ATOM
14881      </entry>
14882    </row>
14883    <row>
14884      <entry>
14885<emphasis remap='I'>state</emphasis>:
14886{ <emphasis role='bold'>NewValue</emphasis>,
14887<emphasis role='bold'>Deleted</emphasis>}
14888      </entry>
14889    </row>
14890    <row>
14891      <entry>
14892<emphasis remap='I'>time</emphasis>: TIMESTAMP
14893<!-- .in -.2i -->
14894<!-- .eM -->
14895      </entry>
14896    </row>
14897  </tbody>
14898  </tgroup>
14899</informaltable>
14900<!-- .eM -->
14901<para>
14902This event is reported to clients selecting
14903<emphasis role='bold'>PropertyChange</emphasis>
14904on the window and is generated with state
14905<emphasis role='bold'>NewValue</emphasis>
14906when a property of the window is changed using
14907<link linkend="requests:ChangeProperty"><emphasis role='bold'>ChangeProperty</emphasis></link>
14908or
14909<link linkend="requests:RotateProperties"><emphasis role='bold'>RotateProperties</emphasis></link>,
14910even when adding zero-length data using
14911<emphasis role='bold'>ChangeProperty</emphasis>
14912and when replacing all or part of a property with identical data using
14913<emphasis role='bold'>ChangeProperty</emphasis>
14914or
14915<emphasis role='bold'>RotateProperties</emphasis>.
14916It is generated with state
14917<emphasis role='bold'>Deleted</emphasis>
14918when a property of the
14919window is deleted using request
14920<link linkend="requests:DeleteProperty"><emphasis role='bold'>DeleteProperty</emphasis></link>
14921or
14922<link linkend="requests:GetProperty"><emphasis role='bold'>GetProperty</emphasis></link>.
14923The timestamp indicates the server time when the property was changed.
14924<!-- .sp -->
14925</para>
14926  </section>
14927  <section id="events:SelectionClear">
14928    <title>SelectionClear</title>
14929    <indexterm zone="events:SelectionClear" significance="preferred"><primary>SelectionClear</primary></indexterm>
14930<informaltable frame='none'>
14931  <?dbfo keep-together="always" ?>
14932  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14933  <colspec colname='c1' colwidth='1.0*'/>
14934  <tbody>
14935    <row>
14936      <entry>
14937	<emphasis role='bold'>SelectionClear</emphasis>
14938      </entry>
14939    </row>
14940    <row>
14941      <entry>
14942<!-- .in +.2i -->
14943<emphasis remap='I'>owner</emphasis>: WINDOW
14944      </entry>
14945    </row>
14946    <row>
14947      <entry>
14948<emphasis remap='I'>selection</emphasis>: ATOM
14949      </entry>
14950    </row>
14951    <row>
14952      <entry>
14953<emphasis remap='I'>time</emphasis>: TIMESTAMP
14954<!-- .in -.2i -->
14955<!-- .eM -->
14956      </entry>
14957    </row>
14958  </tbody>
14959  </tgroup>
14960</informaltable>
14961<!-- .eM -->
14962<para>
14963This event is reported to the current owner of a selection
14964and is generated when a new owner is being defined by means of
14965<link linkend="requests:SetSelectionOwner"><emphasis role='bold'>SetSelectionOwner</emphasis></link>.
14966The timestamp is the last-change time recorded for the selection.
14967The owner argument is the window that was specified by the current owner in its
14968<emphasis role='bold'>SetSelectionOwner</emphasis>
14969request.
14970<!-- .sp -->
14971</para>
14972  </section>
14973  <section id="events:SelectionRequest">
14974    <title>SelectionRequest</title>
14975    <indexterm zone="events:SelectionRequest" significance="preferred"><primary>SelectionRequest</primary></indexterm>
14976<informaltable frame='none'>
14977  <?dbfo keep-together="always" ?>
14978  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
14979  <colspec colname='c1' colwidth='1.0*'/>
14980  <tbody>
14981    <row>
14982      <entry>
14983	<emphasis role='bold'>SelectionRequest</emphasis>
14984      </entry>
14985    </row>
14986    <row>
14987      <entry>
14988<!-- .in +.2i -->
14989<emphasis remap='I'>owner</emphasis>: WINDOW
14990      </entry>
14991    </row>
14992    <row>
14993      <entry>
14994<emphasis remap='I'>selection</emphasis>: ATOM
14995      </entry>
14996    </row>
14997    <row>
14998      <entry>
14999<emphasis remap='I'>target</emphasis>: ATOM
15000      </entry>
15001    </row>
15002    <row>
15003      <entry>
15004<emphasis remap='I'>property</emphasis>: ATOM or
15005<emphasis role='bold'>None</emphasis>
15006      </entry>
15007    </row>
15008    <row>
15009      <entry>
15010<emphasis remap='I'>requestor</emphasis>: WINDOW
15011      </entry>
15012    </row>
15013    <row>
15014      <entry>
15015<emphasis remap='I'>time</emphasis>: TIMESTAMP or
15016<emphasis role='bold'>CurrentTime</emphasis>
15017<!-- .in -.2i -->
15018<!-- .eM -->
15019      </entry>
15020    </row>
15021  </tbody>
15022  </tgroup>
15023</informaltable>
15024<!-- .eM -->
15025<para>
15026This event is reported to the owner of a selection
15027and is generated when a client issues a
15028<link linkend="requests:ConvertSelection"><emphasis role='bold'>ConvertSelection</emphasis></link>
15029request.
15030The owner argument is the window that was specified in the
15031<link linkend="requests:SetSelectionOwner"><emphasis role='bold'>SetSelectionOwner</emphasis></link>
15032request.
15033The remaining arguments are as in the
15034<emphasis role='bold'>ConvertSelection</emphasis>
15035request.
15036</para>
15037<para>
15038The owner should convert the selection based on the specified target type
15039and send a
15040<emphasis role='bold'>SelectionNotify</emphasis>
15041back to the requestor.
15042A complete specification for using selections is given in the X.Org
15043standard <citetitle>Inter-Client Communication Conventions Manual</citetitle>.
15044<!-- .sp -->
15045</para>
15046  </section>
15047  <section id="events:SelectionNotify">
15048    <title>SelectionNotify</title>
15049    <indexterm zone="events:SelectionNotify" significance="preferred"><primary>SelectionNotify</primary></indexterm>
15050<informaltable frame='none'>
15051  <?dbfo keep-together="always" ?>
15052  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
15053  <colspec colname='c1' colwidth='1.0*'/>
15054  <tbody>
15055    <row>
15056      <entry>
15057	<emphasis role='bold'>SelectionNotify</emphasis>
15058      </entry>
15059    </row>
15060    <row>
15061      <entry>
15062<!-- .in +.2i -->
15063<emphasis remap='I'>requestor</emphasis>: WINDOW
15064      </entry>
15065    </row>
15066    <row>
15067      <entry>
15068<emphasis remap='I'>selection</emphasis>, <emphasis remap='I'>target</emphasis>: ATOM
15069      </entry>
15070    </row>
15071    <row>
15072      <entry>
15073<emphasis remap='I'>property</emphasis>: ATOM or
15074<emphasis role='bold'>None</emphasis>
15075      </entry>
15076    </row>
15077    <row>
15078      <entry>
15079<emphasis remap='I'>time</emphasis>: TIMESTAMP or
15080<emphasis role='bold'>CurrentTime</emphasis>
15081<!-- .in -.2i -->
15082<!-- .eM -->
15083      </entry>
15084    </row>
15085  </tbody>
15086  </tgroup>
15087</informaltable>
15088<!-- .eM -->
15089<para>
15090This event is generated by the server in response to a
15091<link linkend="requests:ConvertSelection"><emphasis role='bold'>ConvertSelection</emphasis></link>
15092request when there is no owner for the selection.
15093When there is an owner,
15094it should be generated by the owner using
15095<link linkend="requests:SendEvent"><emphasis role='bold'>SendEvent</emphasis></link>.
15096The owner of a selection should send this event to a requestor either
15097when a selection has been converted and stored as a property
15098or when a selection conversion could not be performed (indicated with property
15099<emphasis role='bold'>None</emphasis>).
15100<!-- .sp -->
15101</para>
15102  </section>
15103  <section id="events:ColormapNotify">
15104    <title>ColormapNotify</title>
15105    <indexterm zone="events:ColormapNotify" significance="preferred"><primary>ColormapNotify</primary></indexterm>
15106<informaltable frame='none'>
15107  <?dbfo keep-together="always" ?>
15108  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
15109  <colspec colname='c1' colwidth='1.0*'/>
15110  <tbody>
15111    <row>
15112      <entry>
15113	<emphasis role='bold'>ColormapNotify</emphasis>
15114      </entry>
15115    </row>
15116    <row>
15117      <entry>
15118<!-- .in +.2i -->
15119<emphasis remap='I'>window</emphasis>: WINDOW
15120      </entry>
15121    </row>
15122    <row>
15123      <entry>
15124<emphasis remap='I'>colormap</emphasis>: COLORMAP or
15125<emphasis role='bold'>None</emphasis>
15126      </entry>
15127    </row>
15128    <row>
15129      <entry>
15130<emphasis remap='I'>new</emphasis>: BOOL
15131      </entry>
15132    </row>
15133    <row>
15134      <entry>
15135<emphasis remap='I'>state</emphasis>:
15136{ <emphasis role='bold'>Installed</emphasis>,
15137<emphasis role='bold'>Uninstalled</emphasis>}
15138<!-- .in -.2i -->
15139<!-- .eM -->
15140      </entry>
15141    </row>
15142  </tbody>
15143  </tgroup>
15144</informaltable>
15145<!-- .eM -->
15146<para>
15147This event is reported to clients selecting
15148<emphasis role='bold'>ColormapChange</emphasis>
15149on the window.
15150It is generated with value
15151<emphasis role='bold'>True</emphasis>
15152for new when the colormap attribute of the window is changed
15153and is generated with value
15154<emphasis role='bold'>False</emphasis>
15155for new when the colormap of a window is installed or uninstalled.
15156In either case,
15157the state indicates whether the colormap is currently installed.
15158<!-- .sp -->
15159</para>
15160  </section>
15161  <section id="events:MappingNotify">
15162    <title>MappingNotify</title>
15163    <indexterm zone="events:MappingNotify" significance="preferred"><primary>MappingNotify</primary></indexterm>
15164<informaltable frame='none'>
15165  <?dbfo keep-together="always" ?>
15166  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
15167  <colspec colname='c1' colwidth='1.0*'/>
15168  <tbody>
15169    <row>
15170      <entry>
15171	<emphasis role='bold'>MappingNotify</emphasis>
15172      </entry>
15173    </row>
15174    <row>
15175      <entry>
15176<!-- .in +.2i -->
15177<emphasis remap='I'>request</emphasis>:
15178{ <emphasis role='bold'>Modifier</emphasis>,
15179<emphasis role='bold'>Keyboard</emphasis>,
15180<emphasis role='bold'>Pointer</emphasis>}
15181      </entry>
15182    </row>
15183    <row>
15184      <entry>
15185<emphasis remap='I'>first-keycode</emphasis>, <emphasis remap='I'>count</emphasis>: CARD8
15186<!-- .in -.2i -->
15187<!-- .eM -->
15188      </entry>
15189    </row>
15190  </tbody>
15191  </tgroup>
15192</informaltable>
15193<!-- .eM -->
15194<para>
15195This event is sent to all clients.
15196There is no mechanism to express disinterest in this event.
15197The detail indicates the kind of change that occurred:
15198<emphasis role='bold'>Modifiers</emphasis>
15199for a successful
15200<link linkend="requests:SetModifierMapping"><emphasis role='bold'>SetModifierMapping</emphasis></link>,
15201<emphasis role='bold'>Keyboard</emphasis>
15202for a successful
15203<link linkend="requests:ChangeKeyboardMapping"><emphasis role='bold'>ChangeKeyboardMapping</emphasis></link>,
15204and
15205<emphasis role='bold'>Pointer</emphasis>
15206for a successful
15207<link linkend="requests:SetPointerMapping"><emphasis role='bold'>SetPointerMapping</emphasis></link>.
15208If the detail is
15209<emphasis role='bold'>Keyboard</emphasis>,
15210then first-keycode and count indicate the range of altered keycodes.
15211<!-- .sp -->
15212</para>
15213  </section>
15214  <section id="events:ClientMessage">
15215    <title>ClientMessage</title>
15216    <indexterm zone="events:ClientMessage" significance="preferred"><primary>ClientMessage</primary></indexterm>
15217<informaltable frame='none'>
15218  <?dbfo keep-together="always" ?>
15219  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
15220  <colspec colname='c1' colwidth='1.0*'/>
15221  <tbody>
15222    <row>
15223      <entry>
15224	<emphasis role='bold'>ClientMessage</emphasis>
15225      </entry>
15226    </row>
15227    <row>
15228      <entry>
15229<!-- .in +.2i -->
15230<emphasis remap='I'>window</emphasis>: WINDOW
15231      </entry>
15232    </row>
15233    <row>
15234      <entry>
15235<emphasis remap='I'>type</emphasis>: ATOM
15236      </entry>
15237    </row>
15238    <row>
15239      <entry>
15240<emphasis remap='I'>format</emphasis>: {8, 16, 32}
15241      </entry>
15242    </row>
15243    <row>
15244      <entry>
15245<emphasis remap='I'>data</emphasis>: LISTofINT8 or LISTofINT16 or LISTofINT32
15246<!-- .in -.2i -->
15247<!-- .eM -->
15248      </entry>
15249    </row>
15250  </tbody>
15251  </tgroup>
15252</informaltable>
15253<!-- .eM -->
15254<para>
15255This event is only generated by clients using
15256<link linkend="requests:SendEvent"><emphasis role='bold'>SendEvent</emphasis></link>.
15257The type specifies how the data is to be interpreted by the receiving client;
15258the server places no interpretation on the type or the data.
15259The format specifies whether the data should be viewed as a list of 8-bit,
1526016-bit, or 32-bit quantities, so that the server can correctly
15261byte-swap, as necessary.
15262The data always consists of either 20 8-bit values or 10 16-bit values
15263or 5 32-bit values, although particular message types might not make use
15264of all of these values.
15265</para>
15266  </section>
15267</chapter>
15268<chapter id='Flow_Control_and_Concurrency'>
15269<title>Flow Control and Concurrency</title>
15270<!-- .XS -->
15271<!-- \*(SN Flow Control and Concurrency -->
15272<!-- .XE -->
15273<para>
15274Whenever the server is writing to a given connection,
15275it is permissible for the server to stop reading from that connection
15276(but if the writing would block, it must continue to service other connections).
15277The server is not required to buffer more than a single request per connection
15278at one time.
15279For a given connection to the server,
15280a client can block while reading from the connection
15281but should undertake to read (events and errors) when writing would block.
15282Failure on the part of a client to obey this rule could result
15283in a deadlocked connection,
15284although deadlock is probably unlikely unless either
15285the transport layer has very little buffering or the client attempts to
15286send large numbers of requests without ever reading replies or checking for
15287errors and events.
15288</para>
15289<para>
15290Whether or not a server is implemented with internal concurrency,
15291the overall effect must be as if individual requests are executed to completion
15292in some serial order,
15293and requests from a given connection must be executed in delivery order
15294(that is, the total execution order is a shuffle of the individual streams).
15295The execution of a request includes validating all arguments,
15296collecting all data for any reply,
15297and generating and queueing all required events.
15298However,
15299it does not include the actual transmission of the reply and the events.
15300In addition, the effect of any other cause that can generate multiple events
15301(for example, activation of a grab or pointer motion) must effectively generate
15302and queue all required events indivisibly with respect to all other causes
15303and requests.
15304For a request from a given client,
15305any events destined for that client that are caused by executing the request
15306must be sent to the client before any reply or error is sent.
15307</para>
15308</chapter>
15309</part>
15310