encoding.xml 130 KB
Newer Older
1 2 3 4 5 6
<appendix id="protocol_encoding">
<title>Protocol Encoding</title>
<!--
     The sections in this appendix correspond to their
     number counterparts in the protocol document.
-->
7
<sect1 id='Syntactic_Conventions_b'>
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
<title>Syntactic Conventions</title>

<para>
All numbers are in decimal,
unless prefixed with #x, in which case they are in hexadecimal (base 16).
</para>

<para>
The general syntax used to describe requests, replies, errors, events, and
compound types is:
</para>

<literallayout class="monospaced">
   <emphasis role='bold'>NameofThing</emphasis>
   encode-form
   ...
   encode-form
</literallayout>

<para>
Each encode-form describes a single component.
</para>
<para>
For components described in the protocol as:
</para>
<literallayout class="monospaced">
   name: TYPE
</literallayout>

<para>
the encode-form is:
</para>

<literallayout class="monospaced">
   N     TYPE     name
</literallayout>

<para>
N is the number of bytes occupied in the data stream,
and TYPE is the interpretation of those bytes.
For example,
</para>

<literallayout class="monospaced">
   depth: CARD8
</literallayout>

<para>
becomes:
</para>

<literallayout class="monospaced">
   1     CARD8     depth
</literallayout>

<para>
For components with a static numeric value the encode-form is:
</para>

<literallayout class="monospaced">
   N     value     name
</literallayout>

<para>
The value is always interpreted as an N-byte unsigned integer.
For example,
the first two bytes of a
75
<emphasis role='bold'>Window</emphasis>
76 77
error are always zero (indicating an
error in general) and three (indicating the
78
<emphasis role='bold'>Window</emphasis>
79 80 81 82 83 84 85 86 87 88 89 90 91 92
error in particular):
</para>

<literallayout class="monospaced">
   1      0      Error
   1      3      code
</literallayout>

<para>
For components described in the protocol as:
</para>

<para>
name:
93
{ <emphasis role='bold'>Name1</emphasis>,...,
94
<emphasis role='bold'>NameI</emphasis>}
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
</para>

<para>
the encode-form is:
</para>

<literallayout class="monospaced">
   N          name
        value1 Name1
        ...
        valueI NameI
</literallayout>

<para>
The value is always interpreted as an N-byte unsigned integer.
Note that the size of N is sometimes larger than that strictly required
to encode the values.
For example:
</para>

<para>
class:
{ <emphasis role='bold'>InputOutput</emphasis>,
<emphasis role='bold'>InputOnly</emphasis>,
<emphasis role='bold'>CopyFromParent</emphasis> }
</para>

<para>
becomes:
</para>

<literallayout class="monospaced">
2               class
     0     CopyFromParent
     1     InputOutput
     2     InputOnly
</literallayout>

<para>
For components described in the protocol as:
</para>

<para>
NAME: TYPE or
<emphasis role='bold'>Alternative1 ...or</emphasis>
<emphasis role='bold'>AlternativeI</emphasis>
</para>

<para>
the encode-form is:
</para>

<literallayout class="monospaced">
N     TYPE               NAME
     value1     Alternative1
     ...
     valueI     AlternativeI
</literallayout>

<para>
The alternative values are guaranteed not to conflict with the encoding
of TYPE.
For example:
</para>

<para>
destination: WINDOW or
162
<emphasis role='bold'>PointerWindow</emphasis>
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
or
<emphasis role='bold'>InputFocus</emphasis>
</para>

<para>
becomes:
</para>

<literallayout class="monospaced">
4     WINDOW          destination
     0     PointerWindow
     1     InputFocus
</literallayout>

<para>
For components described in the protocol as:
</para>

<literallayout class="monospaced">
   value-mask: BITMASK
</literallayout>

<para>
the encode-form is:
</para>

<literallayout class="monospaced">
N     BITMASK               value-mask
     mask1     mask-name1
     ...
     maskI     mask-nameI
</literallayout>

<para>
The individual bits in the mask are specified and named,
and N is 2 or 4.
The most-significant bit in a BITMASK is reserved for use in defining
chained (multiword) bitmasks, as extensions augment existing core requests.
The precise interpretation of this bit is not yet defined here,
although a probable mechanism is that a 1-bit indicates that another N bytes
of bitmask follows, with bits within the overall mask still interpreted
from least-significant to most-significant with an N-byte unit,
with N-byte units
interpreted in stream order, and with the overall mask being byte-swapped
in individual N-byte units.
</para>

<para>
For LISTofVALUE encodings, the request is followed by a section of the form:
</para>

<literallayout class="monospaced">
   VALUEs
   encode-form
   ...
   encode-form
</literallayout>

<para>
listing an encode-form for each VALUE.
The NAME in each encode-form keys to the corresponding BITMASK bit.
The encoding of a VALUE always occupies four bytes,
but the number of bytes specified in the encoding-form indicates how
many of the least-significant bytes are actually used;
the remaining bytes are unused and their values do not matter.
</para>

<para>
In various cases, the number of bytes occupied by a component will be
specified
by a lowercase single-letter variable name instead of a specific numeric
value, and often some other component will have its value specified as a
simple numeric expression involving these variables.
Components specified with such expressions are always interpreted
as unsigned integers.
The scope of such variables is always just the enclosing request, reply,
error, event, or compound type structure.
For example:
</para>

<literallayout class="monospaced">
2      3+n                  request length
4n     LISTofPOINT          points
</literallayout>

<para>
For unused bytes (the values of the bytes are undefined and do no matter),
the encode-form is:
</para>

<literallayout class="monospaced">
   N               unused
</literallayout>

<para>
<!-- .LP -->
If the number of unused bytes is variable, the encode-form typically is:
</para>

<literallayout class="monospaced">
   p               unused, p=pad(E)
</literallayout>

<para>
where E is some expression,
268 269
<phrase id="encoding:pad">
<indexterm zone="encoding:pad" significance="preferred"><primary>Padding</primary></indexterm>
270
and pad(E) is the number of bytes needed to round E up to a multiple of four.
271
</phrase>
272 273 274 275 276 277 278
</para>

<literallayout class="monospaced">
   pad(E) = (4 - (E mod 4)) mod 4
</literallayout>
</sect1>

279
<sect1 id='Encoding::Common_Types'>
280
<title>Common Types</title>
281
<indexterm zone="Encoding::Common_Types"><primary>Types</primary><secondary>encoding</secondary></indexterm>
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305

<variablelist>
  <varlistentry>
    <term>LISTofFOO</term>
    <listitem>
      <para>
In this document the LISTof notation strictly means some number of repetitions
of the FOO encoding;
the actual length of the list is encoded elsewhere.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>SETofFOO</term>
    <listitem>
      <para>
A set is always represented by a bitmask, with a 1-bit indicating presence in
the set.
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
306 307
  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
  <colspec colname='c1' colwidth='1.0*'/>
308
  <tbody>
Matt Dew's avatar
Matt Dew committed
309
    <row>
310 311 312 313
      <entry>
BITMASK: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
314
    <row>
315 316 317 318
      <entry>
WINDOW: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
319
    <row>
320 321 322 323
      <entry>
PIXMAP: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
324
    <row>
325 326 327 328
      <entry>
CURSOR: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
329
    <row>
330 331 332 333
      <entry>
FONT: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
334
    <row>
335 336 337 338
      <entry>
GCONTEXT: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
339
    <row>
340 341 342 343
      <entry>
COLORMAP: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
344
    <row>
345 346 347 348
      <entry>
DRAWABLE: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
349
    <row>
350 351 352 353
      <entry>
FONTABLE: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
354
    <row>
355 356 357 358
      <entry>
ATOM: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
359
    <row>
360 361 362 363
      <entry>
VISUALID: CARD32
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
364
    <row>
365 366 367 368
      <entry>
BYTE: 8-bit value
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
369
    <row>
370 371 372 373
      <entry>
INT8: 8-bit signed integer
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
374
    <row>
375 376 377 378
      <entry>
INT16: 16-bit signed integer
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
379
    <row>
380 381 382 383
      <entry>
INT32: 32-bit signed integer
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
384
    <row>
385 386 387 388
      <entry>
CARD8: 8-bit unsigned integer
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
389
    <row>
390 391 392 393
      <entry>
CARD16: 16-bit unsigned integer
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
394
    <row>
395 396 397 398
      <entry>
CARD32: 32-bit unsigned integer
      </entry>
    </row>
Matt Dew's avatar
Matt Dew committed
399
    <row>
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
      <entry>
TIMESTAMP: CARD32
      </entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>


<literallayout class="monospaced">
BITGRAVITY
     0     Forget
     1     NorthWest
     2     North
     3     NorthEast
     4     West
     5     Center
     6     East
     7     SouthWest
     8     South
     9     SouthEast
     10     Static

WINGRAVITY
     0     Unmap
     1     NorthWest
     2     North
     3     NorthEast
     4     West
     5     Center
     6     East
     7     SouthWest
     8     South
     9     SouthEast
     10     Static

BOOL
     0     False
     1     True

SETofEVENT
     #x00000001     KeyPress
     #x00000002     KeyRelease
     #x00000004     ButtonPress
     #x00000008     ButtonRelease
     #x00000010     EnterWindow
     #x00000020     LeaveWindow
     #x00000040     PointerMotion
     #x00000080     PointerMotionHint
     #x00000100     Button1Motion
     #x00000200     Button2Motion
     #x00000400     Button3Motion
     #x00000800     Button4Motion
     #x00001000     Button5Motion
     #x00002000     ButtonMotion
     #x00004000     KeymapState
     #x00008000     Exposure
     #x00010000     VisibilityChange
     #x00020000     StructureNotify
     #x00040000     ResizeRedirect
     #x00080000     SubstructureNotify
     #x00100000     SubstructureRedirect
     #x00200000     FocusChange
     #x00400000     PropertyChange
     #x00800000     ColormapChange
     #x01000000     OwnerGrabButton
     #xFE000000     unused but must be zero

SETofPOINTEREVENT
     encodings are the same as for SETofEVENT, except with
     #xFFFF8003     unused but must be zero

SETofDEVICEEVENT
     encodings are the same as for SETofEVENT, except with
     #xFFFFC0B0     unused but must be zero

KEYSYM: CARD32
KEYCODE: CARD8
BUTTON: CARD8

SETofKEYBUTMASK
     #x0001     Shift
     #x0002     Lock
     #x0004     Control
     #x0008     Mod1
     #x0010     Mod2
     #x0020     Mod3
     #x0040     Mod4
     #x0080     Mod5
     #x0100     Button1
     #x0200     Button2
     #x0400     Button3
     #x0800     Button4
     #x1000     Button5
     #xE000     unused but must be zero

SETofKEYMASK
     encodings are the same as for SETofKEYBUTMASK, except with
     #xFF00          unused but must be zero
STRING8: LISTofCARD8
STRING16: LISTofCHAR2B

CHAR2B
     1     CARD8     byte1
     1     CARD8     byte2

POINT
     2     INT16     x
     2     INT16     y

RECTANGLE
     2     INT16     x
     2     INT16     y
     2     CARD16    width
     2     CARD16    height

ARC
     2     INT16     x
     2     INT16     y
     2     CARD16    width
     2     CARD16    height
     2     INT16     angle1
     2     INT16     angle2

HOST
     1                         family
           0         Internet
           1         DECnet
           2         Chaos
           5         ServerInterpreted
           6         InternetV6
     1                         unused
     2      n                  length of address
     n      LISTofBYTE         address
     p                         unused, p=pad(n)

STR
     1      n                  length of name in bytes
     n      STRING8            name

</literallayout>
</sect1>

543
<sect1 id='Encoding::Errors'>
544
<title>Errors</title>
545
<indexterm zone="Encoding::Errors"><primary>Error report</primary><secondary>encoding</secondary></indexterm>
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702

<literallayout class="monospaced">
<emphasis role='bold'>Request</emphasis>
     1     0                               Error
     1     1                               code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Value</emphasis>
     1     0                               Error
     1     2                               code
     2     CARD16                          sequence number
     4     &lt;32-bits&gt;                 bad value
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Window</emphasis>
     1     0                               Error
     1     3                               code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Pixmap</emphasis>
     1     0                               Error
     1     4                               code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Atom</emphasis>
     1     0                               Error
     1     5                               code
     2     CARD16                          sequence number
     4     CARD32                          bad atom id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Cursor</emphasis>
     1     0                               Error
     1     6                               code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Font</emphasis>
     1     0                               Error
     1     7                               code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Match</emphasis>
     1     0                               Error
     1     8                               code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Drawable</emphasis>
     1     0                               Error
     1     9                               code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Access</emphasis>
     1     0                               Error
     1     10                              code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Alloc</emphasis>
     1     0                               Error
     1     11                              code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Colormap</emphasis>
     1     0                               Error
     1     12                              code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>GContext</emphasis>
     1     0                               Error
     1     13                              code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>IDChoice</emphasis>
     1     0                               Error
     1     14                              code
     2     CARD16                          sequence number
     4     CARD32                          bad resource id
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Name</emphasis>
     1     0                               Error
     1     15                              code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Length</emphasis>
     1     0                               Error
     1     16                              code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused

<emphasis role='bold'>Implementation</emphasis>
     1     0                               Error
     1     17                              code
     2     CARD16                          sequence number
     4                                     unused
     2     CARD16                          minor opcode
     1     CARD8                           major opcode
     21                                    unused
</literallayout>
</sect1>

703
<sect1 id='Encoding::Keyboards'>
704 705 706 707 708 709 710 711 712 713 714 715
<title>Keyboards</title>

<para>
KEYCODE values are always greater than 7 (and less than 256).
</para>

<para>
KEYSYM values with the bit #x10000000 set are reserved as vendor-specific.
</para>

<para>
The names and encodings of the standard KEYSYM values are contained in
716
<link linkend="keysym_encoding">Appendix A, Keysym Encoding</link>.
717 718 719
</para>
</sect1>

720
<sect1 id='Encoding::Pointers'>
721 722 723 724 725 726 727
<title>Pointers</title>

<para>
BUTTON values are numbered starting with one.
</para>

</sect1>
728
<sect1 id='Encoding::Predefined_Atoms'>
729
<title>Predefined Atoms</title>
730
<indexterm zone="Encoding::Predefined_Atoms"><primary>Atom</primary><secondary>predefined</secondary></indexterm>
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774

<literallayout class="monospaced">
PRIMARY           1      WM_NORMAL_HINTS     40
SECONDARY         2      WM_SIZE_HINTS       41
ARC               3      WM_ZOOM_HINTS       42
ATOM              4      MIN_SPACE           43
BITMAP            5      NORM_SPACE          44
CARDINAL          6      MAX_SPACE           45
COLORMAP          7      END_SPACE           46
CURSOR            8      SUPERSCRIPT_X       47
CUT_BUFFER0       9      SUPERSCRIPT_Y       48
CUT_BUFFER1       10     SUBSCRIPT_X         49
CUT_BUFFER2       11     SUBSCRIPT_Y         50
CUT_BUFFER3       12     UNDERLINE_POSITION  51
CUT_BUFFER4       13     UNDERLINE_THICKNESS 52
CUT_BUFFER5       14     STRIKEOUT_ASCENT    53
CUT_BUFFER6       15     STRIKEOUT_DESCENT   54
CUT_BUFFER7       16     ITALIC_ANGLE        55
DRAWABLE          17     X_HEIGHT            56
FONT              18     QUAD_WIDTH          57
INTEGER           19     WEIGHT              58
PIXMAP            20     POINT_SIZE          59
POINT             21     RESOLUTION          60
RECTANGLE         22     COPYRIGHT           61
RESOURCE_MANAGER  23     NOTICE              62
RGB_COLOR_MAP     24     FONT_NAME           63
RGB_BEST_MAP      25     FAMILY_NAME         64
RGB_BLUE_MAP      26     FULL_NAME           65
RGB_DEFAULT_MAP   27     CAP_HEIGHT          66
RGB_GRAY_MAP      28     WM_CLASS            67
RGB_GREEN_MAP     29     WM_TRANSIENT_FOR    68
RGB_RED_MAP       30
STRING            31
VISUALID          32
WINDOW            33
WM_COMMAND        34
WM_HINTS          35
WM_CLIENT_MACHINE 36
WM_ICON_NAME      37
WM_ICON_SIZE      38
WM_NAME           39
</literallayout>
</sect1>

775
<sect1 id='Encoding::Connection_Setup'>
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940
<title>Connection Setup</title>

<para>
For TCP connections,
displays on a given host are numbered starting from 0,
and the server for display N listens and accepts connections on port 6000 + N.
For DECnet connections,
displays on a given host are numbered starting from 0,
and the server for display N listens and accepts connections on the object
name obtained by concatenating "X$X" with the decimal representation of N,
for example, X$X0 and X$X1.
</para>

<para>
Information sent by the client at connection setup:
</para>

<literallayout class="monospaced">
     1                       byte-order
          #x42     MSB first
          #x6C     LSB first
     1                       unused
     2     CARD16            protocol-major-version
     2     CARD16            protocol-minor-version
     2     n                 length of authorization-protocol-name
     2     d                 length of authorization-protocol-data
     2                       unused
     n     STRING8           authorization-protocol-name
     p                       unused, p=pad(n)
     d     STRING8           authorization-protocol-data
     q                       unused, q=pad(d)
</literallayout>

<para>
Except where explicitly noted in the protocol,
all 16-bit and 32-bit quantities sent by the client must be transmitted
with the specified byte order,
and all 16-bit and 32-bit quantities returned by the server will be transmitted
with this byte order.
</para>

<para>
Information received by the client if the connection is refused:
</para>

<literallayout class="monospaced">
     1     0                 Failed
     1     n                 length of reason in bytes
     2     CARD16            protocol-major-version
     2     CARD16            protocol-minor-version
     2     (n+p)/4           length in 4-byte units of "additional data"
     n     STRING8           reason
     p                       unused, p=pad(n)
</literallayout>

<para>
Information received by the client if further authentication is required:
</para>

<literallayout class="monospaced">
     1     2                 Authenticate
     5                       unused
     2     (n+p)/4           length in 4-byte units of "additional data"
     n     STRING8           reason
     p                       unused, p=pad(n)
</literallayout>

<para>
Information received by the client if the connection is accepted:
</para>

<literallayout class="monospaced">
     1     1                               Success
     1                                     unused
     2     CARD16                          protocol-major-version
     2     CARD16                          protocol-minor-version
     2     8+2n+(v+p+m)/4                  length in 4-byte units of
                                           "additional data"
     4     CARD32                          release-number
     4     CARD32                          resource-id-base
     4     CARD32                          resource-id-mask
     4     CARD32                          motion-buffer-size
     2     v                               length of vendor
     2     CARD16                          maximum-request-length
     1     CARD8                           number of SCREENs in roots
     1     n                               number for FORMATs in
                                           pixmap-formats
     1                                     image-byte-order
          0     LSBFirst
          1     MSBFirst
     1                                     bitmap-format-bit-order
          0     LeastSignificant
          1     MostSignificant
     1     CARD8                           bitmap-format-scanline-unit
     1     CARD8                           bitmap-format-scanline-pad
     1     KEYCODE                         min-keycode
     1     KEYCODE                         max-keycode
     4                                     unused
     v     STRING8                         vendor
     p                                     unused, p=pad(v)
     8n     LISTofFORMAT                   pixmap-formats
     m     LISTofSCREEN                    roots (m is always a multiple of 4)
</literallayout>

<literallayout class="monospaced">
FORMAT
     1     CARD8                           depth
     1     CARD8                           bits-per-pixel
     1     CARD8                           scanline-pad
     5                                     unused
</literallayout>

<literallayout class="monospaced">
SCREEN
     4     WINDOW                          root
     4     COLORMAP                        default-colormap
     4     CARD32                          white-pixel
     4     CARD32                          black-pixel
     4     SETofEVENT                      current-input-masks
     2     CARD16                          width-in-pixels
     2     CARD16                          height-in-pixels
     2     CARD16                          width-in-millimeters
     2     CARD16                          height-in-millimeters
     2     CARD16                          min-installed-maps
     2     CARD16                          max-installed-maps
     4     VISUALID                        root-visual
     1                                     backing-stores
          0     Never
          1     WhenMapped
          2     Always
     1     BOOL                            save-unders
     1     CARD8                           root-depth
     1     CARD8                           number of DEPTHs in allowed-depths
     n     LISTofDEPTH                     allowed-depths (n is always a
                                           multiple of 4)
</literallayout>

<literallayout class="monospaced">
DEPTH
     1     CARD8                           depth
     1                                     unused
     2     n                               number of VISUALTYPES in visuals
     4                                     unused
     24n     LISTofVISUALTYPE              visuals
</literallayout>

<literallayout class="monospaced">
VISUALTYPE
     4     VISUALID                        visual-id
     1                                     class
          0     StaticGray
          1     GrayScale
          2     StaticColor
          3     PseudoColor
          4     TrueColor
          5     DirectColor
     1     CARD8                           bits-per-rgb-value
     2     CARD16                          colormap-entries
     4     CARD32                          red-mask
     4     CARD32                          green-mask
     4     CARD32                          blue-mask
     4                                     unused
</literallayout>
</sect1>

941
<sect1 id='Encoding::Requests'>
942
<title>Requests</title>
943
<indexterm zone="Encoding::Requests"><primary>Request</primary><secondary>encoding</secondary></indexterm>
944 945

<literallayout class="monospaced">
946
<link linkend="requests:CreateWindow"><emphasis role='bold'>CreateWindow</emphasis></link>
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
     1     1                               opcode
     1     CARD8                           depth
     2     8+n                             request length
     4     WINDOW                          wid
     4     WINDOW                          parent
     2     INT16                           x
     2     INT16                           y
     2     CARD16                          width
     2     CARD16                          height
     2     CARD16                          border-width
     2                                     class
          0     CopyFromParent
          1     InputOutput
          2     InputOnly
     4     VISUALID                        visual
          0     CopyFromParent
     4     BITMASK                         value-mask (has n bits set to 1)
          #x00000001     background-pixmap
          #x00000002     background-pixel
          #x00000004     border-pixmap
          #x00000008     border-pixel
          #x00000010     bit-gravity
          #x00000020     win-gravity
          #x00000040     backing-store
          #x00000080     backing-planes
          #x00000100     backing-pixel
          #x00000200     override-redirect
          #x00000400     save-under
          #x00000800     event-mask
          #x00001000     do-not-propagate-mask
          #x00002000     colormap
          #x00004000     cursor
     4n     LISTofVALUE                    value-list

  VALUEs
     4     PIXMAP                          background-pixmap
          0     None
          1     ParentRelative
     4     CARD32                          background-pixel
     4     PIXMAP                          border-pixmap
          0     CopyFromParent
     4     CARD32                          border-pixel
     1     BITGRAVITY                      bit-gravity
     1     WINGRAVITY                      win-gravity
     1                                     backing-store
          0     NotUseful
          1     WhenMapped
          2     Always
     4     CARD32                          backing-planes
     4     CARD32                          backing-pixel
     1     BOOL                            override-redirect
     1     BOOL                            save-under
     4     SETofEVENT                      event-mask
     4     SETofDEVICEEVENT                do-not-propagate-mask
     4     COLORMAP                        colormap
          0     CopyFromParent
     4     CURSOR                          cursor
          0     None

1006
<link linkend="requests:ChangeWindowAttributes"><emphasis role='bold'>ChangeWindowAttributes</emphasis></link>
1007 1008 1009 1010 1011 1012 1013 1014 1015
     1     2                               opcode
     1                                     unused
     2     3+n                             request length
     4     WINDOW                          window
     4     BITMASK                         value-mask (has n bits set to 1)
          encodings are the same as for CreateWindow
     4n     LISTofVALUE                    value-list
          encodings are the same as for CreateWindow

1016
<link linkend="requests:GetWindowAttributes"><emphasis role='bold'>GetWindowAttributes</emphasis></link>
1017 1018 1019 1020 1021
     1     3                               opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1022

1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
     1     1                               Reply
     1                                     backing-store
          0     NotUseful
          1     WhenMapped
          2     Always
     2     CARD16                          sequence number
     4     3                               reply length
     4     VISUALID                        visual
     2                                     class
          1     InputOutput
          2     InputOnly
     1     BITGRAVITY                      bit-gravity
     1     WINGRAVITY                      win-gravity
     4     CARD32                          backing-planes
     4     CARD32                          backing-pixel
     1     BOOL                            save-under
     1     BOOL                            map-is-installed
     1                                     map-state
          0     Unmapped
          1     Unviewable
          2     Viewable
     1     BOOL                            override-redirect
     4     COLORMAP                        colormap
          0     None
     4     SETofEVENT                      all-event-masks
     4     SETofEVENT                      your-event-mask
     2     SETofDEVICEEVENT                do-not-propagate-mask
     2                                     unused

1052
<link linkend="requests:DestroyWindow"><emphasis role='bold'>DestroyWindow</emphasis></link>
1053 1054 1055 1056 1057
     1     4                               opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1058
<link linkend="requests:DestroySubwindows"><emphasis role='bold'>DestroySubwindows</emphasis></link>
1059 1060 1061 1062 1063
     1     5                               opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1064
<link linkend="requests:ChangeSaveSet"><emphasis role='bold'>ChangeSaveSet</emphasis></link>
1065 1066 1067 1068 1069 1070 1071
     1     6                               opcode
     1                                     mode
          0     Insert
          1     Delete
     2     2                               request length
     4     WINDOW                          window

1072
<link linkend="requests:ReparentWindow"><emphasis role='bold'>ReparentWindow</emphasis></link>
1073 1074 1075 1076 1077 1078 1079 1080
     1     7                               opcode
     1                                     unused
     2     4                               request length
     4     WINDOW                          window
     4     WINDOW                          parent
     2     INT16                           x
     2     INT16                           y

1081
<link linkend="requests:MapWindow"><emphasis role='bold'>MapWindow</emphasis></link>
1082 1083 1084 1085 1086
     1     8                               opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1087
<link linkend="requests:MapSubwindows"><emphasis role='bold'>MapSubwindows</emphasis></link>
1088 1089 1090 1091 1092
     1     9                               opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1093
<link linkend="requests:UnmapWindow"><emphasis role='bold'>UnmapWindow</emphasis></link>
1094 1095 1096 1097 1098
     1     10                              opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1099
<link linkend="requests:UnmapSubwindows"><emphasis role='bold'>UnmapSubwindows</emphasis></link>
1100 1101 1102 1103 1104
     1     11                              opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1105
<link linkend="requests:ConfigureWindow"><emphasis role='bold'>ConfigureWindow</emphasis></link>
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134
     1     12                              opcode
     1                                     unused
     2     3+n                             request length
     4     WINDOW                          window
     2     BITMASK                         value-mask (has n bits set to 1)
          #x0001     x
          #x0002     y
          #x0004     width
          #x0008     height
          #x0010     border-width
          #x0020     sibling
          #x0040     stack-mode
     2               unused
     4n     LISTofVALUE                    value-list

  VALUEs
     2     INT16                           x
     2     INT16                           y
     2     CARD16                          width
     2     CARD16                          height
     2     CARD16                          border-width
     4     WINDOW                          sibling
     1                                     stack-mode
          0     Above
          1     Below
          2     TopIf
          3     BottomIf
          4     Opposite

1135
<link linkend="requests:CirculateWindow"><emphasis role='bold'>CirculateWindow</emphasis></link>
1136 1137 1138 1139 1140 1141 1142
     1     13                              opcode
     1                                     direction
          0     RaiseLowest
          1     LowerHighest
     2     2                               request length
     4     WINDOW                          window

1143
<link linkend="requests:GetGeometry"><emphasis role='bold'>GetGeometry</emphasis></link>
1144 1145 1146 1147 1148
     1     14                              opcode
     1                                     unused
     2     2                               request length
     4     DRAWABLE                        drawable

1149

1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161
     1     1                               Reply
     1     CARD8                           depth
     2     CARD16                          sequence number
     4     0                               reply length
     4     WINDOW                          root
     2     INT16                           x
     2     INT16                           y
     2     CARD16                          width
     2     CARD16                          height
     2     CARD16                          border-width
     10                                    unused

1162
<link linkend="requests:QueryTree"><emphasis role='bold'>QueryTree</emphasis></link>
1163 1164 1165 1166 1167
     1     15                              opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1168

1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     n                               reply length
     4     WINDOW                          root
     4     WINDOW                          parent
          0     None
     2     n                               number of WINDOWs in children
     14                                    unused
     4n     LISTofWINDOW                   children

1180
<link linkend="requests:InternAtom"><emphasis role='bold'>InternAtom</emphasis></link>
1181 1182 1183 1184 1185 1186 1187 1188
     1     16                              opcode
     1     BOOL                            only-if-exists
     2     2+(n+p)/4                       request length
     2     n                               length of name
     2                                     unused
     n     STRING8                         name
     p                                     unused, p=pad(n)

1189

1190 1191 1192 1193 1194 1195 1196 1197
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     0                               reply length
     4     ATOM                            atom
           0     None
     20                                    unused

1198
<link linkend="requests:GetAtomName"><emphasis role='bold'>GetAtomName</emphasis></link>
1199 1200 1201 1202 1203
     1     17                              opcode
     1                                     unused
     2     2                               request length
     4     ATOM                            atom

1204

1205 1206 1207 1208 1209 1210 1211 1212 1213
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     (n+p)/4                         reply length
     2     n                               length of name
     22                                    unused
     n     STRING8                         name
     p                                     unused, p=pad(n)

1214
<link linkend="requests:ChangeProperty"><emphasis role='bold'>ChangeProperty</emphasis></link>
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
     1     18                              opcode
     1                                     mode
          0     Replace
          1     Prepend
          2     Append
     2     6+(n+p)/4                       request length
     4     WINDOW                          window
     4     ATOM                            property
     4     ATOM                            type
     1     CARD8                           format
     3                                     unused
     4     CARD32                          length of data in format units
                    (= n for format = 8)
                    (= n/2 for format = 16)
                    (= n/4 for format = 32)
     n     LISTofBYTE                      data
                    (n is a multiple of 2 for format = 16)
                    (n is a multiple of 4 for format = 32)
     p                                     unused, p=pad(n)


1236
<link linkend="requests:DeleteProperty"><emphasis role='bold'>DeleteProperty</emphasis></link>
1237 1238 1239 1240 1241 1242
     1     19                              opcode
     1                                     unused
     2     3                               request length
     4     WINDOW                          window
     4     ATOM                            property

1243
<link linkend="requests:GetProperty"><emphasis role='bold'>GetProperty</emphasis></link>
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
     1     20                              opcode
     1     BOOL                            delete
     2     6                               request length
     4     WINDOW                          window
     4     ATOM                            property
     4     ATOM                            type
          0     AnyPropertyType
     4     CARD32                          long-offset
     4     CARD32                          long-length

1254

1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
     1     1                               Reply
     1     CARD8                           format
     2     CARD16                          sequence number
     4     (n+p)/4                         reply length
     4     ATOM                            type
          0     None
     4     CARD32                          bytes-after
     4     CARD32                          length of value in format units
                    (= 0 for format = 0)
                    (= n for format = 8)
                    (= n/2 for format = 16)
                    (= n/4 for format = 32)
     12                                    unused
     n     LISTofBYTE                      value
                    (n is zero for format = 0)
                    (n is a multiple of 2 for format = 16)
                    (n is a multiple of 4 for format = 32)
     p                                     unused, p=pad(n)

1274
<link linkend="requests:ListProperties"><emphasis role='bold'>ListProperties</emphasis></link>
1275 1276 1277 1278 1279
     1     21                              opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1280

1281 1282 1283 1284 1285 1286 1287 1288
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     n                               reply length
     2     n                               number of ATOMs in atoms
     22                                    unused
     4n     LISTofATOM                     atoms

1289
<link linkend="requests:SetSelectionOwner"><emphasis role='bold'>SetSelectionOwner</emphasis></link>
1290 1291 1292 1293 1294 1295 1296 1297 1298
     1     22                              opcode
     1                                     unused
     2     4                               request length
     4     WINDOW                          owner
          0     None
     4     ATOM                            selection
     4     TIMESTAMP                       time
          0     CurrentTime

1299
<link linkend="requests:GetSelectionOwner"><emphasis role='bold'>GetSelectionOwner</emphasis></link>
1300 1301 1302 1303 1304
     1     23                              opcode
     1                                     unused
     2     2                               request length
     4     ATOM                            selection

1305

1306 1307 1308 1309 1310 1311 1312 1313
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     0                               reply length
     4     WINDOW                          owner
          0     None
     20                                    unused

1314
<link linkend="requests:ConvertSelection"><emphasis role='bold'>ConvertSelection</emphasis></link>
1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325
     1     24                              opcode
     1                                     unused
     2     6                               request length
     4     WINDOW                          requestor
     4     ATOM                            selection
     4     ATOM                            target
     4     ATOM                            property
          0     None
     4     TIMESTAMP                       time
          0     CurrentTime

1326
<link linkend="requests:SendEvent"><emphasis role='bold'>SendEvent</emphasis></link>
1327 1328 1329 1330 1331 1332 1333 1334
     1     25                              opcode
     1     BOOL                            propagate
     2     11                              requestlength
     4     WINDOW                          destination
          0     PointerWindow
          1     InputFocus
     4     SETofEVENT                      event-mask
     32                                    event
1335
          standard event format (see <link linkend='Events'>the Events section</link>)
1336

1337
<link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355
     1     26                              opcode
     1     BOOL                            owner-events
     2     6                               request length
     4     WINDOW                          grab-window
     2     SETofPOINTEREVENT               event-mask
     1                                     pointer-mode
          0     Synchronous
          1     Asynchronous
     1                                     keyboard-mode
          0     Synchronous
          1     Asynchronous
     4     WINDOW                          confine-to
          0     None
     4     CURSOR                          cursor
          0     None
     4     TIMESTAMP                       time
          0     CurrentTime

1356

1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
     1     1                               Reply
     1                                     status
          0     Success
          1     AlreadyGrabbed
          2     InvalidTime
          3     NotViewable
          4     Frozen
     2     CARD16                          sequence number
     4     0                               reply length
     24                                    unused

1368
<link linkend="requests:UngrabPointer"><emphasis role='bold'>UngrabPointer</emphasis></link>
1369 1370 1371 1372 1373 1374
     1     27                              opcode
     1                                     unused
     2     2                               request length
     4     TIMESTAMP                       time
          0     CurrentTime

1375
<link linkend="requests:GrabButton"><emphasis role='bold'>GrabButton</emphasis></link>
1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396
     1     28                              opcode
     1     BOOL                            owner-events
     2     6                               request length
     4     WINDOW                          grab-window
     2     SETofPOINTEREVENT               event-mask
     1                                     pointer-mode
          0     Synchronous
          1     Asynchronous
     1                                     keyboard-mode
          0     Synchronous
          1     Asynchronous
     4     WINDOW                          confine-to
          0     None
     4     CURSOR                          cursor
          0     None
     1     BUTTON                          button
          0     AnyButton
     1                                     unused
     2     SETofKEYMASK                    modifiers
          #x8000                           AnyModifier

1397
<link linkend="requests:UngrabButton"><emphasis role='bold'>UngrabButton</emphasis></link>
1398 1399 1400 1401 1402 1403 1404 1405 1406
     1     29                              opcode
     1     BUTTON                          button
          0     AnyButton
     2     3                               request length
     4     WINDOW                          grab-window
     2     SETofKEYMASK                    modifiers
          #x8000                           AnyModifier
     2                                     unused

1407
<link linkend="requests:ChangeActivePointerGrab"><emphasis role='bold'>ChangeActivePointerGrab</emphasis></link>
1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
     1     30                              opcode
     1                                     unused
     2     4                               request length
     4     CURSOR                          cursor
          0     None
     4     TIMESTAMP                       time
          0     CurrentTime
     2     SETofPOINTEREVENT               event-mask
     2                                     unused

1418
<link linkend="requests:GrabKeyboard"><emphasis role='bold'>GrabKeyboard</emphasis></link>
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432
     1     31                              opcode
     1     BOOL                            owner-events
     2     4                               request length
     4     WINDOW                          grab-window
     4     TIMESTAMP                       time
          0     CurrentTime
     1                                     pointer-mode
          0     Synchronous
          1     Asynchronous
     1                                     keyboard-mode
          0     Synchronous
          1     Asynchronous
     2                                     unused

1433

1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444
     1     1                               Reply
     1                                     status
          0     Success
          1     AlreadyGrabbed
          2     InvalidTime
          3     NotViewable
          4     Frozen
     2     CARD16                          sequence number
     4     0                               reply length
     24                                    unused

1445
<link linkend="requests:UngrabKeyboard"><emphasis role='bold'>UngrabKeyboard</emphasis></link>
1446 1447 1448 1449 1450 1451
     1     32                              opcode
     1                                     unused
     2     2                               request length
     4     TIMESTAMP                       time
          0     CurrentTime

1452
<link linkend="requests:GrabKey"><emphasis role='bold'>GrabKey</emphasis></link>
1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
     1     33                              opcode
     1     BOOL                            owner-events
     2     4                               request length
     4     WINDOW                          grab-window
     2     SETofKEYMASK                    modifiers
          #x8000     AnyModifier
     1     KEYCODE                         key
          0     AnyKey
     1                                     pointer-mode
          0     Synchronous
          1     Asynchronous
     1                                     keyboard-mode
          0     Synchronous
          1     Asynchronous
     3                                     unused

1469
<link linkend="requests:UngrabKey"><emphasis role='bold'>UngrabKey</emphasis></link>
1470 1471 1472 1473 1474 1475 1476 1477 1478
     1     34                              opcode
     1     KEYCODE                         key
          0     AnyKey
     2     3                               request length
     4     WINDOW                          grab-window
     2     SETofKEYMASK                    modifiers
          #x8000     AnyModifier
     2                                     unused

1479
<link linkend="requests:AllowEvents"><emphasis role='bold'>AllowEvents</emphasis></link>
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493
     1     35                              opcode
     1                                     mode
          0     AsyncPointer
          1     SyncPointer
          2     ReplayPointer
          3     AsyncKeyboard
          4     SyncKeyboard
          5     ReplayKeyboard
          6     AsyncBoth
          7     SyncBoth
     2     2                               request length
     4     TIMESTAMP                       time
          0     CurrentTime

1494
<link linkend="requests:GrabServer"><emphasis role='bold'>GrabServer</emphasis></link>
1495 1496 1497 1498
     1     36                              opcode
     1                                     unused
     2     1                               request length

1499
<link linkend="requests:UngrabServer"><emphasis role='bold'>UngrabServer</emphasis></link>
1500 1501 1502 1503
     1     37                              opcode
     1                                     unused
     2     1                               request length

1504
<link linkend="requests:QueryPointer"><emphasis role='bold'>QueryPointer</emphasis></link>
1505 1506 1507 1508 1509
     1     38                              opcode
     1                                     unused
     2     2                               request length
     4     WINDOW                          window

1510

1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524
     1     1                               Reply
     1     BOOL                            same-screen
     2     CARD16                          sequence number
     4     0                               reply length
     4     WINDOW                          root
     4     WINDOW                          child
          0     None
     2     INT16                           root-x
     2     INT16                           root-y
     2     INT16                           win-x
     2     INT16                           win-y
     2     SETofKEYBUTMASK                 mask
     6                                     unused

1525
<link linkend="requests:GetMotionEvents"><emphasis role='bold'>GetMotionEvents</emphasis></link>
1526 1527 1528 1529 1530 1531 1532 1533 1534
     1     39                              opcode
     1                                     unused
     2     4                               request length
     4     WINDOW                          window
     4     TIMESTAMP                       start
          0     CurrentTime
     4     TIMESTAMP                       stop
          0     CurrentTime

1535

1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     2n                              reply length
     4     n                               number of TIMECOORDs in events
     20                                    unused
     8n     LISTofTIMECOORD                events

  TIMECOORD
     4     TIMESTAMP                       time
     2     INT16                           x
     2     INT16                           y

1549
<link linkend="requests:TranslateCoordinates"><emphasis role='bold'>TranslateCoordinates</emphasis></link>
1550 1551 1552 1553 1554 1555 1556
     1     40                              opcode
     1                                     unused
     2     4                               request length
     4     WINDOW                          src-window
     4     WINDOW                          dst-window
     2     INT16                           src-x
     2     INT16                           src-y
1557

1558 1559 1560 1561 1562 1563 1564 1565 1566 1567
     1     1                               Reply
     1     BOOL                            same-screen
     2     CARD16                          sequence number
     4     0                               reply length
     4     WINDOW                          child
          0     None
     2     INT16                           dst-x
     2     INT16                           dst-y
     16                                    unused

1568
<link linkend="requests:WarpPointer"><emphasis role='bold'>WarpPointer</emphasis></link>
1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582
     1     41                              opcode
     1                                     unused
     2     6                               request length
     4     WINDOW                          src-window
          0     None
     4     WINDOW                          dst-window
          0     None
     2     INT16                           src-x
     2     INT16                           src-y
     2     CARD16                          src-width
     2     CARD16                          src-height
     2     INT16                           dst-x
     2     INT16                           dst-y

1583
<link linkend="requests:SetInputFocus"><emphasis role='bold'>SetInputFocus</emphasis></link>
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595
     1     42                              opcode
     1                                     revert-to
          0     None
          1     PointerRoot
          2     Parent
     2     3                               request length
     4     WINDOW                          focus
          0     None
          1     PointerRoot
     4     TIMESTAMP                       time
          0     CurrentTime

1596
<link linkend="requests:GetInputFocus"><emphasis role='bold'>GetInputFocus</emphasis></link>
1597 1598 1599 1600
     1     43                              opcode
     1                                     unused
     2     1                               request length

1601

1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613
     1     1                               Reply
     1                                     revert-to
          0     None
          1     PointerRoot
          2     Parent
     2     CARD16                          sequence number
     4     0                               reply length
     4     WINDOW                          focus
          0     None
          1     PointerRoot
     20                                    unused

1614
<link linkend="requests:QueryKeymap"><emphasis role='bold'>QueryKeymap</emphasis></link>
1615 1616 1617 1618
     1     44                              opcode
     1                                     unused
     2     1                               request length

1619

1620 1621 1622 1623 1624 1625
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     2                               reply length
     32     LISTofCARD8                    keys

1626
<link linkend="requests:OpenFont"><emphasis role='bold'>OpenFont</emphasis></link>
1627 1628 1629 1630 1631 1632 1633 1634 1635
     1     45                              opcode
     1                                     unused
     2     3+(n+p)/4                       request length
     4     FONT                            fid
     2     n                               length of name
     2                                     unused
     n     STRING8                         name
     p                                     unused, p=pad(n)

1636
<link linkend="requests:CloseFont"><emphasis role='bold'>CloseFont</emphasis></link>
1637 1638 1639 1640 1641
     1     46                              opcode
     1                                     unused
     2     2                               request length
     4     FONT                            font

1642
<link linkend="requests:QueryFont"><emphasis role='bold'>QueryFont</emphasis></link>
1643 1644 1645 1646 1647
     1     47                              opcode
     1                                     unused
     2     2                               request length
     4     FONTABLE                        font

1648

1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     7+2n+3m                         reply length
     12     CHARINFO                       min-bounds
     4                                     unused
     12     CHARINFO                       max-bounds
     4                                     unused
     2     CARD16                          min-char-or-byte2
     2     CARD16                          max-char-or-byte2
     2     CARD16                          default-char
     2     n                               number of FONTPROPs in properties
     1                                     draw-direction
          0     LeftToRight
          1     RightToLeft
     1     CARD8                           min-byte1
     1     CARD8                           max-byte1
     1     BOOL                            all-chars-exist
     2     INT16                           font-ascent
     2     INT16                           font-descent
     4     m                               number of CHARINFOs in char-infos
     8n     LISTofFONTPROP                 properties
     12m     LISTofCHARINFO                char-infos

  FONTPROP
     4     ATOM                            name
     4     &lt;32-bits&gt;                 value

  CHARINFO
     2     INT16                           left-side-bearing
     2     INT16                           right-side-bearing
     2     INT16                           character-width
     2     INT16                           ascent
     2     INT16                           descent
     2     CARD16                          attributes

1685
<link linkend="requests:QueryTextExtents"><emphasis role='bold'>QueryTextExtents</emphasis></link>
1686 1687 1688 1689 1690 1691 1692
     1     48                              opcode
     1     BOOL                            odd length, True if p = 2
     2     2+(2n+p)/4                      request length
     4     FONTABLE                        font
     2n     STRING16                       string
     p                                     unused, p=pad(2n)

1693

1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708
     1     1                               Reply
     1                                     draw-direction
          0     LeftToRight
          1     RightToLeft
     2     CARD16                          sequence number
     4     0                               reply length
     2     INT16                           font-ascent
     2     INT16                           font-descent
     2     INT16                           overall-ascent
     2     INT16                           overall-descent
     4     INT32                           overall-width
     4     INT32                           overall-left
     4     INT32                           overall-right
     4                                     unused

1709
<link linkend="requests:ListFonts"><emphasis role='bold'>ListFonts</emphasis></link>
1710 1711 1712 1713 1714 1715 1716 1717
     1     49                              opcode
     1                                     unused
     2     2+(n+p)/4                       request length
     2     CARD16                          max-names
     2     n                               length of pattern
     n     STRING8                         pattern
     p                                     unused, p=pad(n)

1718

1719 1720 1721 1722 1723 1724 1725 1726 1727
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     (n+p)/4                         reply length
     2     CARD16                          number of STRs in names
     22                                    unused
     n     LISTofSTR                       names
     p                                     unused, p=pad(n)

1728
<link linkend="requests:ListFontsWithInfo"><emphasis role='bold'>ListFontsWithInfo</emphasis></link>
1729 1730 1731 1732 1733 1734 1735 1736
     1     50                              opcode
     1                                     unused
     2     2+(n+p)/4                       request length
     2     CARD16                          max-names
     2     n                               length of pattern
     n     STRING8                         pattern
     p                                     unused, p=pad(n)

1737
▶ (except for last in series)
1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768
     1     1                               Reply
     1     n                               length of name in bytes
     2     CARD16                          sequence number
     4     7+2m+(n+p)/4                    reply length
     12     CHARINFO                       min-bounds
     4                                     unused
     12     CHARINFO                       max-bounds
     4                                     unused
     2     CARD16                          min-char-or-byte2
     2     CARD16                          max-char-or-byte2
     2     CARD16                          default-char
     2     m                               number of FONTPROPs in properties
     1                                     draw-direction
          0     LeftToRight
          1     RightToLeft
     1     CARD8                           min-byte1
     1     CARD8                           max-byte1
     1     BOOL                            all-chars-exist
     2     INT16                           font-ascent
     2     INT16                           font-descent
     4     CARD32                          replies-hint
     8m     LISTofFONTPROP                 properties
     n     STRING8                         name
     p                                     unused, p=pad(n)

  FONTPROP
     encodings are the same as for QueryFont

  CHARINFO
     encodings are the same as for QueryFont

1769
▶ (last in series)
1770 1771 1772 1773 1774 1775
     1     1                               Reply
     1     0                               last-reply indicator
     2     CARD16                          sequence number
     4     7                               reply length
     52                                    unused

1776
<link linkend="requests:SetFontPath"><emphasis role='bold'>SetFontPath</emphasis></link>
1777 1778 1779 1780 1781 1782 1783 1784
     1     51                              opcode
     1                                     unused
     2     2+(n+p)/4                       request length
     2     CARD16                          number of STRs in path
     2                                     unused
     n     LISTofSTR                       path
     p                                     unused, p=pad(n)

1785
<link linkend="requests:GetFontPath"><emphasis role='bold'>GetFontPath</emphasis></link>
1786 1787 1788 1789
     1     52                              opcode
     1                                     unused
     2     1                               request list

1790

1791 1792 1793 1794 1795 1796 1797 1798 1799
     1     1                               Reply
     1                                     unused
     2     CARD16                          sequence number
     4     (n+p)/4                         reply length
     2     CARD16                          number of STRs in path
     22                                    unused
     n     LISTofSTR                       path
     p                                     unused, p=pad(n)

1800
<link linkend="requests:CreatePixmap"><emphasis role='bold'>CreatePixmap</emphasis></link>
1801 1802 1803 1804 1805 1806 1807 1808
     1     53                              opcode
     1     CARD8                           depth
     2     4                               request length
     4     PIXMAP                          pid
     4     DRAWABLE                        drawable
     2     CARD16                          width
     2     CARD16                          height

1809
<link linkend="requests:FreePixmap"><emphasis role='bold'>FreePixmap</emphasis></link>
1810 1811 1812 1813 1814
     1     54                              opcode
     1                                     unused
     2     2                               request length
     4     PIXMAP                          pixmap

1815
<link linkend="requests:CreateGC"><emphasis role='bold'>CreateGC</emphasis></link>