1 <appendix id="protocol_encoding">
2 <title>Protocol Encoding</title>
4 The sections in this appendix correspond to their
5 number counterparts in the protocol document.
7 <sect1 id='Syntactic_Conventions_b'>
8 <title>Syntactic Conventions</title>
11 All numbers are in decimal,
12 unless prefixed with #x, in which case they are in hexadecimal (base 16).
16 The general syntax used to describe requests, replies, errors, events, and
20 <literallayout class="monospaced">
21 <emphasis role='bold'>NameofThing</emphasis>
28 Each encode-form describes a single component.
31 For components described in the protocol as:
33 <literallayout class="monospaced">
41 <literallayout class="monospaced">
46 N is the number of bytes occupied in the data stream,
47 and TYPE is the interpretation of those bytes.
51 <literallayout class="monospaced">
59 <literallayout class="monospaced">
64 For components with a static numeric value the encode-form is:
67 <literallayout class="monospaced">
72 The value is always interpreted as an N-byte unsigned integer.
74 the first two bytes of a
75 <emphasis role='bold'>Window</emphasis>
76 error are always zero (indicating an
77 error in general) and three (indicating the
78 <emphasis role='bold'>Window</emphasis>
82 <literallayout class="monospaced">
88 For components described in the protocol as:
93 { <emphasis role='bold'>Name1</emphasis>,...,
94 <emphasis role='bold'>NameI</emphasis>}
101 <literallayout class="monospaced">
109 The value is always interpreted as an N-byte unsigned integer.
110 Note that the size of N is sometimes larger than that strictly required
111 to encode the values.
117 { <emphasis role='bold'>InputOutput</emphasis>,
118 <emphasis role='bold'>InputOnly</emphasis>,
119 <emphasis role='bold'>CopyFromParent</emphasis> }
126 <literallayout class="monospaced">
134 For components described in the protocol as:
139 <emphasis role='bold'>Alternative1 ...or</emphasis>
140 <emphasis role='bold'>AlternativeI</emphasis>
147 <literallayout class="monospaced">
155 The alternative values are guaranteed not to conflict with the encoding
161 destination: WINDOW or
162 <emphasis role='bold'>PointerWindow</emphasis>
164 <emphasis role='bold'>InputFocus</emphasis>
171 <literallayout class="monospaced">
178 For components described in the protocol as:
181 <literallayout class="monospaced">
189 <literallayout class="monospaced">
197 The individual bits in the mask are specified and named,
199 The most-significant bit in a BITMASK is reserved for use in defining
200 chained (multiword) bitmasks, as extensions augment existing core requests.
201 The precise interpretation of this bit is not yet defined here,
202 although a probable mechanism is that a 1-bit indicates that another N bytes
203 of bitmask follows, with bits within the overall mask still interpreted
204 from least-significant to most-significant with an N-byte unit,
206 interpreted in stream order, and with the overall mask being byte-swapped
207 in individual N-byte units.
211 For LISTofVALUE encodings, the request is followed by a section of the form:
214 <literallayout class="monospaced">
222 listing an encode-form for each VALUE.
223 The NAME in each encode-form keys to the corresponding BITMASK bit.
224 The encoding of a VALUE always occupies four bytes,
225 but the number of bytes specified in the encoding-form indicates how
226 many of the least-significant bytes are actually used;
227 the remaining bytes are unused and their values do not matter.
231 In various cases, the number of bytes occupied by a component will be
233 by a lowercase single-letter variable name instead of a specific numeric
234 value, and often some other component will have its value specified as a
235 simple numeric expression involving these variables.
236 Components specified with such expressions are always interpreted
237 as unsigned integers.
238 The scope of such variables is always just the enclosing request, reply,
239 error, event, or compound type structure.
243 <literallayout class="monospaced">
245 4n LISTofPOINT points
249 For unused bytes (the values of the bytes are undefined and do no matter),
253 <literallayout class="monospaced">
259 If the number of unused bytes is variable, the encode-form typically is:
262 <literallayout class="monospaced">
267 where E is some expression,
268 <phrase id="encoding:pad">
269 <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.
274 <literallayout class="monospaced">
275 pad(E) = (4 - (E mod 4)) mod 4
279 <sect1 id='Encoding::Common_Types'>
280 <title>Common Types</title>
281 <indexterm zone="Encoding::Common_Types"><primary>Types</primary><secondary>encoding</secondary></indexterm>
285 <term>LISTofFOO</term>
288 In this document the LISTof notation strictly means some number of repetitions
290 the actual length of the list is encoded elsewhere.
295 <term>SETofFOO</term>
298 A set is always represented by a bitmask, with a 1-bit indicating presence in
305 <informaltable frame='none'>
306 <tgroup cols='1' align='left' colsep='0' rowsep='0'>
307 <colspec colname='c1' colwidth='1.0*'/>
371 INT8: 8-bit signed integer
376 INT16: 16-bit signed integer
381 INT32: 32-bit signed integer
386 CARD8: 8-bit unsigned integer
391 CARD16: 16-bit unsigned integer
396 CARD32: 32-bit unsigned integer
409 <literallayout class="monospaced">
442 #x00000002 KeyRelease
443 #x00000004 ButtonPress
444 #x00000008 ButtonRelease
445 #x00000010 EnterWindow
446 #x00000020 LeaveWindow
447 #x00000040 PointerMotion
448 #x00000080 PointerMotionHint
449 #x00000100 Button1Motion
450 #x00000200 Button2Motion
451 #x00000400 Button3Motion
452 #x00000800 Button4Motion
453 #x00001000 Button5Motion
454 #x00002000 ButtonMotion
455 #x00004000 KeymapState
457 #x00010000 VisibilityChange
458 #x00020000 StructureNotify
459 #x00040000 ResizeRedirect
460 #x00080000 SubstructureNotify
461 #x00100000 SubstructureRedirect
462 #x00200000 FocusChange
463 #x00400000 PropertyChange
464 #x00800000 ColormapChange
465 #x01000000 OwnerGrabButton
466 #xFE000000 unused but must be zero
469 encodings are the same as for SETofEVENT, except with
470 #xFFFF8003 unused but must be zero
473 encodings are the same as for SETofEVENT, except with
474 #xFFFFC0B0 unused but must be zero
494 #xE000 unused but must be zero
497 encodings are the same as for SETofKEYBUTMASK, except with
498 #xFF00 unused but must be zero
500 STRING16: LISTofCHAR2B
532 2 n length of address
537 1 n length of name in bytes
543 <sect1 id='Encoding::Errors'>
544 <title>Errors</title>
545 <indexterm zone="Encoding::Errors"><primary>Error report</primary><secondary>encoding</secondary></indexterm>
547 <literallayout class="monospaced">
548 <emphasis role='bold'>Request</emphasis>
551 2 CARD16 sequence number
553 2 CARD16 minor opcode
557 <emphasis role='bold'>Value</emphasis>
560 2 CARD16 sequence number
561 4 <32-bits> bad value
562 2 CARD16 minor opcode
566 <emphasis role='bold'>Window</emphasis>
569 2 CARD16 sequence number
570 4 CARD32 bad resource id
571 2 CARD16 minor opcode
575 <emphasis role='bold'>Pixmap</emphasis>
578 2 CARD16 sequence number
579 4 CARD32 bad resource id
580 2 CARD16 minor opcode
584 <emphasis role='bold'>Atom</emphasis>
587 2 CARD16 sequence number
589 2 CARD16 minor opcode
593 <emphasis role='bold'>Cursor</emphasis>
596 2 CARD16 sequence number
597 4 CARD32 bad resource id
598 2 CARD16 minor opcode
602 <emphasis role='bold'>Font</emphasis>
605 2 CARD16 sequence number
606 4 CARD32 bad resource id
607 2 CARD16 minor opcode
611 <emphasis role='bold'>Match</emphasis>
614 2 CARD16 sequence number
616 2 CARD16 minor opcode
620 <emphasis role='bold'>Drawable</emphasis>
623 2 CARD16 sequence number
624 4 CARD32 bad resource id
625 2 CARD16 minor opcode
629 <emphasis role='bold'>Access</emphasis>
632 2 CARD16 sequence number
634 2 CARD16 minor opcode
638 <emphasis role='bold'>Alloc</emphasis>
641 2 CARD16 sequence number
643 2 CARD16 minor opcode
647 <emphasis role='bold'>Colormap</emphasis>
650 2 CARD16 sequence number
651 4 CARD32 bad resource id
652 2 CARD16 minor opcode
656 <emphasis role='bold'>GContext</emphasis>
659 2 CARD16 sequence number
660 4 CARD32 bad resource id
661 2 CARD16 minor opcode
665 <emphasis role='bold'>IDChoice</emphasis>
668 2 CARD16 sequence number
669 4 CARD32 bad resource id
670 2 CARD16 minor opcode
674 <emphasis role='bold'>Name</emphasis>
677 2 CARD16 sequence number
679 2 CARD16 minor opcode
683 <emphasis role='bold'>Length</emphasis>
686 2 CARD16 sequence number
688 2 CARD16 minor opcode
692 <emphasis role='bold'>Implementation</emphasis>
695 2 CARD16 sequence number
697 2 CARD16 minor opcode
703 <sect1 id='Encoding::Keyboards'>
704 <title>Keyboards</title>
707 KEYCODE values are always greater than 7 (and less than 256).
711 KEYSYM values with the bit #x10000000 set are reserved as vendor-specific.
715 The names and encodings of the standard KEYSYM values are contained in
716 <link linkend="keysym_encoding">Appendix A, Keysym Encoding</link>.
720 <sect1 id='Encoding::Pointers'>
721 <title>Pointers</title>
724 BUTTON values are numbered starting with one.
728 <sect1 id='Encoding::Predefined_Atoms'>
729 <title>Predefined Atoms</title>
730 <indexterm zone="Encoding::Predefined_Atoms"><primary>Atom</primary><secondary>predefined</secondary></indexterm>
732 <literallayout class="monospaced">
733 PRIMARY 1 WM_NORMAL_HINTS 40
734 SECONDARY 2 WM_SIZE_HINTS 41
735 ARC 3 WM_ZOOM_HINTS 42
737 BITMAP 5 NORM_SPACE 44
738 CARDINAL 6 MAX_SPACE 45
739 COLORMAP 7 END_SPACE 46
740 CURSOR 8 SUPERSCRIPT_X 47
741 CUT_BUFFER0 9 SUPERSCRIPT_Y 48
742 CUT_BUFFER1 10 SUBSCRIPT_X 49
743 CUT_BUFFER2 11 SUBSCRIPT_Y 50
744 CUT_BUFFER3 12 UNDERLINE_POSITION 51
745 CUT_BUFFER4 13 UNDERLINE_THICKNESS 52
746 CUT_BUFFER5 14 STRIKEOUT_ASCENT 53
747 CUT_BUFFER6 15 STRIKEOUT_DESCENT 54
748 CUT_BUFFER7 16 ITALIC_ANGLE 55
749 DRAWABLE 17 X_HEIGHT 56
750 FONT 18 QUAD_WIDTH 57
752 PIXMAP 20 POINT_SIZE 59
753 POINT 21 RESOLUTION 60
754 RECTANGLE 22 COPYRIGHT 61
755 RESOURCE_MANAGER 23 NOTICE 62
756 RGB_COLOR_MAP 24 FONT_NAME 63
757 RGB_BEST_MAP 25 FAMILY_NAME 64
758 RGB_BLUE_MAP 26 FULL_NAME 65
759 RGB_DEFAULT_MAP 27 CAP_HEIGHT 66
760 RGB_GRAY_MAP 28 WM_CLASS 67
761 RGB_GREEN_MAP 29 WM_TRANSIENT_FOR 68
775 <sect1 id='Encoding::Connection_Setup'>
776 <title>Connection Setup</title>
780 displays on a given host are numbered starting from 0,
781 and the server for display N listens and accepts connections on port 6000 + N.
782 For DECnet connections,
783 displays on a given host are numbered starting from 0,
784 and the server for display N listens and accepts connections on the object
785 name obtained by concatenating "X$X" with the decimal representation of N,
786 for example, X$X0 and X$X1.
790 Information sent by the client at connection setup:
793 <literallayout class="monospaced">
798 2 CARD16 protocol-major-version
799 2 CARD16 protocol-minor-version
800 2 n length of authorization-protocol-name
801 2 d length of authorization-protocol-data
803 n STRING8 authorization-protocol-name
805 d STRING8 authorization-protocol-data
810 Except where explicitly noted in the protocol,
811 all 16-bit and 32-bit quantities sent by the client must be transmitted
812 with the specified byte order,
813 and all 16-bit and 32-bit quantities returned by the server will be transmitted
814 with this byte order.
818 Information received by the client if the connection is refused:
821 <literallayout class="monospaced">
823 1 n length of reason in bytes
824 2 CARD16 protocol-major-version
825 2 CARD16 protocol-minor-version
826 2 (n+p)/4 length in 4-byte units of "additional data"
832 Information received by the client if further authentication is required:
835 <literallayout class="monospaced">
838 2 (n+p)/4 length in 4-byte units of "additional data"
844 Information received by the client if the connection is accepted:
847 <literallayout class="monospaced">
850 2 CARD16 protocol-major-version
851 2 CARD16 protocol-minor-version
852 2 8+2n+(v+p+m)/4 length in 4-byte units of
854 4 CARD32 release-number
855 4 CARD32 resource-id-base
856 4 CARD32 resource-id-mask
857 4 CARD32 motion-buffer-size
859 2 CARD16 maximum-request-length
860 1 CARD8 number of SCREENs in roots
861 1 n number for FORMATs in
866 1 bitmap-format-bit-order
869 1 CARD8 bitmap-format-scanline-unit
870 1 CARD8 bitmap-format-scanline-pad
871 1 KEYCODE min-keycode
872 1 KEYCODE max-keycode
876 8n LISTofFORMAT pixmap-formats
877 m LISTofSCREEN roots (m is always a multiple of 4)
880 <literallayout class="monospaced">
883 1 CARD8 bits-per-pixel
888 <literallayout class="monospaced">
891 4 COLORMAP default-colormap
894 4 SETofEVENT current-input-masks
895 2 CARD16 width-in-pixels
896 2 CARD16 height-in-pixels
897 2 CARD16 width-in-millimeters
898 2 CARD16 height-in-millimeters
899 2 CARD16 min-installed-maps
900 2 CARD16 max-installed-maps
901 4 VISUALID root-visual
908 1 CARD8 number of DEPTHs in allowed-depths
909 n LISTofDEPTH allowed-depths (n is always a
913 <literallayout class="monospaced">
917 2 n number of VISUALTYPES in visuals
919 24n LISTofVISUALTYPE visuals
922 <literallayout class="monospaced">
932 1 CARD8 bits-per-rgb-value
933 2 CARD16 colormap-entries
941 <sect1 id='Encoding::Requests'>
942 <title>Requests</title>
943 <indexterm zone="Encoding::Requests"><primary>Request</primary><secondary>encoding</secondary></indexterm>
945 <literallayout class="monospaced">
946 <link linkend="requests:CreateWindow"><emphasis role='bold'>CreateWindow</emphasis></link>
956 2 CARD16 border-width
963 4 BITMASK value-mask (has n bits set to 1)
964 #x00000001 background-pixmap
965 #x00000002 background-pixel
966 #x00000004 border-pixmap
967 #x00000008 border-pixel
968 #x00000010 bit-gravity
969 #x00000020 win-gravity
970 #x00000040 backing-store
971 #x00000080 backing-planes
972 #x00000100 backing-pixel
973 #x00000200 override-redirect
974 #x00000400 save-under
975 #x00000800 event-mask
976 #x00001000 do-not-propagate-mask
979 4n LISTofVALUE value-list
982 4 PIXMAP background-pixmap
985 4 CARD32 background-pixel
986 4 PIXMAP border-pixmap
988 4 CARD32 border-pixel
989 1 BITGRAVITY bit-gravity
990 1 WINGRAVITY win-gravity
995 4 CARD32 backing-planes
996 4 CARD32 backing-pixel
997 1 BOOL override-redirect
999 4 SETofEVENT event-mask
1000 4 SETofDEVICEEVENT do-not-propagate-mask
1006 <link linkend="requests:ChangeWindowAttributes"><emphasis role='bold'>ChangeWindowAttributes</emphasis></link>
1009 2 3+n request length
1011 4 BITMASK value-mask (has n bits set to 1)
1012 encodings are the same as for CreateWindow
1013 4n LISTofVALUE value-list
1014 encodings are the same as for CreateWindow
1016 <link linkend="requests:GetWindowAttributes"><emphasis role='bold'>GetWindowAttributes</emphasis></link>
1028 2 CARD16 sequence number
1034 1 BITGRAVITY bit-gravity
1035 1 WINGRAVITY win-gravity
1036 4 CARD32 backing-planes
1037 4 CARD32 backing-pixel
1039 1 BOOL map-is-installed
1044 1 BOOL override-redirect
1047 4 SETofEVENT all-event-masks
1048 4 SETofEVENT your-event-mask
1049 2 SETofDEVICEEVENT do-not-propagate-mask
1052 <link linkend="requests:DestroyWindow"><emphasis role='bold'>DestroyWindow</emphasis></link>
1058 <link linkend="requests:DestroySubwindows"><emphasis role='bold'>DestroySubwindows</emphasis></link>
1064 <link linkend="requests:ChangeSaveSet"><emphasis role='bold'>ChangeSaveSet</emphasis></link>
1072 <link linkend="requests:ReparentWindow"><emphasis role='bold'>ReparentWindow</emphasis></link>
1081 <link linkend="requests:MapWindow"><emphasis role='bold'>MapWindow</emphasis></link>
1087 <link linkend="requests:MapSubwindows"><emphasis role='bold'>MapSubwindows</emphasis></link>
1093 <link linkend="requests:UnmapWindow"><emphasis role='bold'>UnmapWindow</emphasis></link>
1099 <link linkend="requests:UnmapSubwindows"><emphasis role='bold'>UnmapSubwindows</emphasis></link>
1105 <link linkend="requests:ConfigureWindow"><emphasis role='bold'>ConfigureWindow</emphasis></link>
1108 2 3+n request length
1110 2 BITMASK value-mask (has n bits set to 1)
1119 4n LISTofVALUE value-list
1126 2 CARD16 border-width
1135 <link linkend="requests:CirculateWindow"><emphasis role='bold'>CirculateWindow</emphasis></link>
1143 <link linkend="requests:GetGeometry"><emphasis role='bold'>GetGeometry</emphasis></link>
1152 2 CARD16 sequence number
1159 2 CARD16 border-width
1162 <link linkend="requests:QueryTree"><emphasis role='bold'>QueryTree</emphasis></link>
1171 2 CARD16 sequence number
1176 2 n number of WINDOWs in children
1178 4n LISTofWINDOW children
1180 <link linkend="requests:InternAtom"><emphasis role='bold'>InternAtom</emphasis></link>
1182 1 BOOL only-if-exists
1183 2 2+(n+p)/4 request length
1192 2 CARD16 sequence number
1198 <link linkend="requests:GetAtomName"><emphasis role='bold'>GetAtomName</emphasis></link>
1207 2 CARD16 sequence number
1208 4 (n+p)/4 reply length
1214 <link linkend="requests:ChangeProperty"><emphasis role='bold'>ChangeProperty</emphasis></link>
1220 2 6+(n+p)/4 request length
1226 4 CARD32 length of data in format units
1227 (= n for format = 8)
1228 (= n/2 for format = 16)
1229 (= n/4 for format = 32)
1231 (n is a multiple of 2 for format = 16)
1232 (n is a multiple of 4 for format = 32)
1236 <link linkend="requests:DeleteProperty"><emphasis role='bold'>DeleteProperty</emphasis></link>
1243 <link linkend="requests:GetProperty"><emphasis role='bold'>GetProperty</emphasis></link>
1251 4 CARD32 long-offset
1252 4 CARD32 long-length
1257 2 CARD16 sequence number
1258 4 (n+p)/4 reply length
1261 4 CARD32 bytes-after
1262 4 CARD32 length of value in format units
1263 (= 0 for format = 0)
1264 (= n for format = 8)
1265 (= n/2 for format = 16)
1266 (= n/4 for format = 32)
1269 (n is zero for format = 0)
1270 (n is a multiple of 2 for format = 16)
1271 (n is a multiple of 4 for format = 32)
1274 <link linkend="requests:ListProperties"><emphasis role='bold'>ListProperties</emphasis></link>
1283 2 CARD16 sequence number
1285 2 n number of ATOMs in atoms
1289 <link linkend="requests:SetSelectionOwner"><emphasis role='bold'>SetSelectionOwner</emphasis></link>
1299 <link linkend="requests:GetSelectionOwner"><emphasis role='bold'>GetSelectionOwner</emphasis></link>
1308 2 CARD16 sequence number
1314 <link linkend="requests:ConvertSelection"><emphasis role='bold'>ConvertSelection</emphasis></link>
1326 <link linkend="requests:SendEvent"><emphasis role='bold'>SendEvent</emphasis></link>
1330 4 WINDOW destination
1333 4 SETofEVENT event-mask
1335 standard event format (see <link linkend='Events'>the Events section</link>)
1337 <link linkend="requests:GrabPointer"><emphasis role='bold'>GrabPointer</emphasis></link>
1341 4 WINDOW grab-window
1342 2 SETofPOINTEREVENT event-mask
1364 2 CARD16 sequence number
1368 <link linkend="requests:UngrabPointer"><emphasis role='bold'>UngrabPointer</emphasis></link>
1375 <link linkend="requests:GrabButton"><emphasis role='bold'>GrabButton</emphasis></link>
1379 4 WINDOW grab-window
1380 2 SETofPOINTEREVENT event-mask
1394 2 SETofKEYMASK modifiers
1397 <link linkend="requests:UngrabButton"><emphasis role='bold'>UngrabButton</emphasis></link>
1402 4 WINDOW grab-window
1403 2 SETofKEYMASK modifiers
1407 <link linkend="requests:ChangeActivePointerGrab"><emphasis role='bold'>ChangeActivePointerGrab</emphasis></link>
1415 2 SETofPOINTEREVENT event-mask
1418 <link linkend="requests:GrabKeyboard"><emphasis role='bold'>GrabKeyboard</emphasis></link>
1422 4 WINDOW grab-window
1441 2 CARD16 sequence number
1445 <link linkend="requests:UngrabKeyboard"><emphasis role='bold'>UngrabKeyboard</emphasis></link>
1452 <link linkend="requests:GrabKey"><emphasis role='bold'>GrabKey</emphasis></link>
1456 4 WINDOW grab-window
1457 2 SETofKEYMASK modifiers
1469 <link linkend="requests:UngrabKey"><emphasis role='bold'>UngrabKey</emphasis></link>
1474 4 WINDOW grab-window
1475 2 SETofKEYMASK modifiers
1479 <link linkend="requests:AllowEvents"><emphasis role='bold'>AllowEvents</emphasis></link>
1494 <link linkend="requests:GrabServer"><emphasis role='bold'>GrabServer</emphasis></link>
1499 <link linkend="requests:UngrabServer"><emphasis role='bold'>UngrabServer</emphasis></link>
1504 <link linkend="requests:QueryPointer"><emphasis role='bold'>QueryPointer</emphasis></link>
1513 2 CARD16 sequence number
1522 2 SETofKEYBUTMASK mask
1525 <link linkend="requests:GetMotionEvents"><emphasis role='bold'>GetMotionEvents</emphasis></link>
1538 2 CARD16 sequence number
1540 4 n number of TIMECOORDs in events
1542 8n LISTofTIMECOORD events
1549 <link linkend="requests:TranslateCoordinates"><emphasis role='bold'>TranslateCoordinates</emphasis></link>
1560 2 CARD16 sequence number
1568 <link linkend="requests:WarpPointer"><emphasis role='bold'>WarpPointer</emphasis></link>
1583 <link linkend="requests:SetInputFocus"><emphasis role='bold'>SetInputFocus</emphasis></link>
1596 <link linkend="requests:GetInputFocus"><emphasis role='bold'>GetInputFocus</emphasis></link>
1607 2 CARD16 sequence number
1614 <link linkend="requests:QueryKeymap"><emphasis role='bold'>QueryKeymap</emphasis></link>
1622 2 CARD16 sequence number
1626 <link linkend="requests:OpenFont"><emphasis role='bold'>OpenFont</emphasis></link>
1629 2 3+(n+p)/4 request length
1636 <link linkend="requests:CloseFont"><emphasis role='bold'>CloseFont</emphasis></link>
1642 <link linkend="requests:QueryFont"><emphasis role='bold'>QueryFont</emphasis></link>
1651 2 CARD16 sequence number
1652 4 7+2n+3m reply length
1653 12 CHARINFO min-bounds
1655 12 CHARINFO max-bounds
1657 2 CARD16 min-char-or-byte2
1658 2 CARD16 max-char-or-byte2
1659 2 CARD16 default-char
1660 2 n number of FONTPROPs in properties
1666 1 BOOL all-chars-exist
1668 2 INT16 font-descent
1669 4 m number of CHARINFOs in char-infos
1670 8n LISTofFONTPROP properties
1671 12m LISTofCHARINFO char-infos
1675 4 <32-bits> value
1678 2 INT16 left-side-bearing
1679 2 INT16 right-side-bearing
1680 2 INT16 character-width
1685 <link linkend="requests:QueryTextExtents"><emphasis role='bold'>QueryTextExtents</emphasis></link>
1687 1 BOOL odd length, True if p = 2
1688 2 2+(2n+p)/4 request length
1698 2 CARD16 sequence number
1701 2 INT16 font-descent
1702 2 INT16 overall-ascent
1703 2 INT16 overall-descent
1704 4 INT32 overall-width
1705 4 INT32 overall-left
1706 4 INT32 overall-right
1709 <link linkend="requests:ListFonts"><emphasis role='bold'>ListFonts</emphasis></link>
1712 2 2+(n+p)/4 request length
1714 2 n length of pattern
1721 2 CARD16 sequence number
1722 4 (n+p)/4 reply length
1723 2 CARD16 number of STRs in names
1728 <link linkend="requests:ListFontsWithInfo"><emphasis role='bold'>ListFontsWithInfo</emphasis></link>
1731 2 2+(n+p)/4 request length
1733 2 n length of pattern
1737 â–¶ (except for last in series)
1739 1 n length of name in bytes
1740 2 CARD16 sequence number
1741 4 7+2m+(n+p)/4 reply length
1742 12 CHARINFO min-bounds
1744 12 CHARINFO max-bounds
1746 2 CARD16 min-char-or-byte2
1747 2 CARD16 max-char-or-byte2
1748 2 CARD16 default-char
1749 2 m number of FONTPROPs in properties
1755 1 BOOL all-chars-exist
1757 2 INT16 font-descent
1758 4 CARD32 replies-hint
1759 8m LISTofFONTPROP properties
1764 encodings are the same as for QueryFont
1767 encodings are the same as for QueryFont
1769 â–¶ (last in series)
1771 1 0 last-reply indicator
1772 2 CARD16 sequence number
1776 <link linkend="requests:SetFontPath"><emphasis role='bold'>SetFontPath</emphasis></link>
1779 2 2+(n+p)/4 request length
1780 2 CARD16 number of STRs in path
1785 <link linkend="requests:GetFontPath"><emphasis role='bold'>GetFontPath</emphasis></link>
1793 2 CARD16 sequence number
1794 4 (n+p)/4 reply length
1795 2 CARD16 number of STRs in path
1800 <link linkend="requests:CreatePixmap"><emphasis role='bold'>CreatePixmap</emphasis></link>
1809 <link linkend="requests:FreePixmap"><emphasis role='bold'>FreePixmap</emphasis></link>
1815 <link linkend="requests:CreateGC"><emphasis role='bold'>CreateGC</emphasis></link>
1818 2 4+n request length
1821 4 BITMASK value-mask (has n bits set to 1)
1823 #x00000002 plane-mask
1824 #x00000004 foreground
1825 #x00000008 background
1826 #x00000010 line-width
1827 #x00000020 line-style
1828 #x00000040 cap-style
1829 #x00000080 join-style
1830 #x00000100 fill-style
1831 #x00000200 fill-rule
1834 #x00001000 tile-stipple-x-origin
1835 #x00002000 tile-stipple-y-origin
1837 #x00008000 subwindow-mode
1838 #x00010000 graphics-exposures
1839 #x00020000 clip-x-origin
1840 #x00040000 clip-y-origin
1841 #x00080000 clip-mask
1842 #x00100000 dash-offset
1845 4n LISTofVALUE value-list
1892 2 INT16 tile-stipple-x-origin
1893 2 INT16 tile-stipple-y-origin
1898 1 BOOL graphics-exposures
1899 2 INT16 clip-x-origin
1900 2 INT16 clip-y-origin
1903 2 CARD16 dash-offset
1909 <link linkend="requests:ChangeGC"><emphasis role='bold'>ChangeGC</emphasis></link>
1912 2 3+n request length
1914 4 BITMASK value-mask (has n bits set to 1)
1915 encodings are the same as for CreateGC
1916 4n LISTofVALUE value-list
1917 encodings are the same as for CreateGC
1919 <link linkend="requests:CopyGC"><emphasis role='bold'>CopyGC</emphasis></link>
1925 4 BITMASK value-mask
1926 encodings are the same as for CreateGC
1928 <link linkend="requests:SetDashes"><emphasis role='bold'>SetDashes</emphasis></link>
1931 2 3+(n+p)/4 request length
1933 2 CARD16 dash-offset
1934 2 n length of dashes
1935 n LISTofCARD8 dashes
1938 <link linkend="requests:SetClipRectangles"><emphasis role='bold'>SetClipRectangles</emphasis></link>
1945 2 3+2n request length
1947 2 INT16 clip-x-origin
1948 2 INT16 clip-y-origin
1949 8n LISTofRECTANGLE rectangles
1951 <link linkend="requests:FreeGC"><emphasis role='bold'>FreeGC</emphasis></link>
1957 <link linkend="requests:ClearArea"><emphasis role='bold'>ClearArea</emphasis></link>
1967 <link linkend="requests:CopyArea"><emphasis role='bold'>CopyArea</emphasis></link>
1971 4 DRAWABLE src-drawable
1972 4 DRAWABLE dst-drawable
1981 <link linkend="requests:CopyPlane"><emphasis role='bold'>CopyPlane</emphasis></link>
1985 4 DRAWABLE src-drawable
1986 4 DRAWABLE dst-drawable
1996 <link linkend="requests:PolyPoint"><emphasis role='bold'>PolyPoint</emphasis></link>
2001 2 3+n request length
2004 4n LISTofPOINT points
2006 <link linkend="requests:PolyLine"><emphasis role='bold'>PolyLine</emphasis></link>
2011 2 3+n request length
2014 4n LISTofPOINT points
2016 <link linkend="requests:PolySegment"><emphasis role='bold'>PolySegment</emphasis></link>
2019 2 3+2n request length
2022 8n LISTofSEGMENT segments
2030 <link linkend="requests:PolyRectangle"><emphasis role='bold'>PolyRectangle</emphasis></link>
2033 2 3+2n request length
2036 8n LISTofRECTANGLE rectangles
2038 <link linkend="requests:PolyArc"><emphasis role='bold'>PolyArc</emphasis></link>
2041 2 3+3n request length
2046 <link linkend="requests:FillPoly"><emphasis role='bold'>FillPoly</emphasis></link>
2049 2 4+n request length
2060 4n LISTofPOINT points
2062 <link linkend="requests:PolyFillRectangle"><emphasis role='bold'>PolyFillRectangle</emphasis></link>
2065 2 3+2n request length
2068 8n LISTofRECTANGLE rectangles
2070 <link linkend="requests:PolyFillArc"><emphasis role='bold'>PolyFillArc</emphasis></link>
2073 2 3+3n request length
2078 <link linkend="requests:PutImage"><emphasis role='bold'>PutImage</emphasis></link>
2084 2 6+(n+p)/4 request length
2097 <link linkend="requests:GetImage"><emphasis role='bold'>GetImage</emphasis></link>
2113 2 CARD16 sequence number
2114 4 (n+p)/4 reply length
2121 <link linkend="requests:PolyText8"><emphasis role='bold'>PolyText8</emphasis></link>
2124 2 4+(n+p)/4 request length
2129 n LISTofTEXTITEM8 items
2130 p unused, p=pad(n) (p is always 0
2134 1 m length of string (cannot be 255)
2138 1 255 font-shift indicator
2139 1 font byte 3 (most-significant)
2142 1 font byte 0 (least-significant)
2144 <link linkend="requests:PolyText16"><emphasis role='bold'>PolyText16</emphasis></link>
2147 2 4+(n+p)/4 request length
2152 n LISTofTEXTITEM16 items
2153 p unused, p=pad(n) (p must be 0 or
2157 1 m number of CHAR2Bs in string
2162 1 255 font-shift indicator
2163 1 font byte 3 (most-significant)
2166 1 font byte 0 (least-significant)
2168 <link linkend="requests:ImageText8"><emphasis role='bold'>ImageText8</emphasis></link>
2170 1 n length of string
2171 2 4+(n+p)/4 request length
2179 <link linkend="requests:ImageText16"><emphasis role='bold'>ImageText16</emphasis></link>
2181 1 n number of CHAR2Bs in string
2182 2 4+(2n+p)/4 request length
2190 <link linkend="requests:CreateColormap"><emphasis role='bold'>CreateColormap</emphasis></link>
2200 <link linkend="requests:FreeColormap"><emphasis role='bold'>FreeColormap</emphasis></link>
2206 <link linkend="requests:CopyColormapAndFree"><emphasis role='bold'>CopyColormapAndFree</emphasis></link>
2213 <link linkend="requests:InstallColormap"><emphasis role='bold'>InstallColormap</emphasis></link>
2219 <link linkend="requests:UninstallColormap"><emphasis role='bold'>UninstallColormap</emphasis></link>
2225 <link linkend="requests:ListInstalledColormaps"><emphasis role='bold'>ListInstalledColormaps</emphasis></link>
2234 2 CARD16 sequence number
2236 2 n number of COLORMAPs in cmaps
2238 4n LISTofCOLORMAP cmaps
2240 <link linkend="requests:AllocColor"><emphasis role='bold'>AllocColor</emphasis></link>
2253 2 CARD16 sequence number
2262 <link linkend="requests:AllocNamedColor"><emphasis role='bold'>AllocNamedColor</emphasis></link>
2265 2 3+(n+p)/4 request length
2275 2 CARD16 sequence number
2279 2 CARD16 exact-green
2282 2 CARD16 visual-green
2283 2 CARD16 visual-blue
2286 <link linkend="requests:AllocColorCells"><emphasis role='bold'>AllocColorCells</emphasis></link>
2297 2 CARD16 sequence number
2299 2 n number of CARD32s in pixels
2300 2 m number of CARD32s in masks
2302 4n LISTofCARD32 pixels
2303 4m LISTofCARD32 masks
2305 <link linkend="requests:AllocColorPlanes"><emphasis role='bold'>AllocColorPlanes</emphasis></link>
2318 2 CARD16 sequence number
2320 2 n number of CARD32s in pixels
2326 4n LISTofCARD32 pixels
2328 <link linkend="requests:FreeColors"><emphasis role='bold'>FreeColors</emphasis></link>
2331 2 3+n request length
2334 4n LISTofCARD32 pixels
2336 <link linkend="requests:StoreColors"><emphasis role='bold'>StoreColors</emphasis></link>
2339 2 2+3n request length
2341 12n LISTofCOLORITEM items
2348 1 do-red, do-green, do-blue
2349 #x01 do-red (1 is True, 0 is False)
2350 #x02 do-green (1 is True, 0 is False)
2351 #x04 do-blue (1 is True, 0 is False)
2355 <link linkend="requests:StoreNamedColor"><emphasis role='bold'>StoreNamedColor</emphasis></link>
2357 1 do-red, do-green, do-blue
2358 #x01 do-red (1 is True, 0 is False)
2359 #x02 do-green (1 is True, 0 is False)
2360 #x04 do-blue (1 is True, 0 is False)
2362 2 4+(n+p)/4 request length
2370 <link linkend="requests:QueryColors"><emphasis role='bold'>QueryColors</emphasis></link>
2373 2 2+n request length
2375 4n LISTofCARD32 pixels
2380 2 CARD16 sequence number
2382 2 n number of RGBs in colors
2392 <link linkend="requests:LookupColor"><emphasis role='bold'>LookupColor</emphasis></link>
2395 2 3+(n+p)/4 request length
2405 2 CARD16 sequence number
2408 2 CARD16 exact-green
2411 2 CARD16 visual-green
2412 2 CARD16 visual-blue
2415 <link linkend="requests:CreateCursor"><emphasis role='bold'>CreateCursor</emphasis></link>
2432 <link linkend="requests:CreateGlyphCursor"><emphasis role='bold'>CreateGlyphCursor</emphasis></link>
2440 2 CARD16 source-char
2449 <link linkend="requests:FreeCursor"><emphasis role='bold'>FreeCursor</emphasis></link>
2455 <link linkend="requests:RecolorCursor"><emphasis role='bold'>RecolorCursor</emphasis></link>
2467 <link linkend="requests:QueryBestSize"><emphasis role='bold'>QueryBestSize</emphasis></link>
2481 2 CARD16 sequence number
2487 <link linkend="requests:QueryExtension"><emphasis role='bold'>QueryExtension</emphasis></link>
2490 2 2+(n+p)/4 request length
2499 2 CARD16 sequence number
2502 1 CARD8 major-opcode
2507 <link linkend="requests:ListExtensions"><emphasis role='bold'>ListExtensions</emphasis></link>
2514 1 CARD8 number of STRs in names
2515 2 CARD16 sequence number
2516 4 (n+p)/4 reply length
2521 <link linkend="requests:ChangeKeyboardMapping"><emphasis role='bold'>ChangeKeyboardMapping</emphasis></link>
2524 2 2+nm request length
2525 1 KEYCODE first-keycode
2526 1 m keysyms-per-keycode
2528 4nm LISTofKEYSYM keysyms
2530 <link linkend="requests:GetKeyboardMapping"><emphasis role='bold'>GetKeyboardMapping</emphasis></link>
2534 1 KEYCODE first-keycode
2540 1 n keysyms-per-keycode
2541 2 CARD16 sequence number
2542 4 nm reply length (m = count field
2545 4nm LISTofKEYSYM keysyms
2547 <link linkend="requests:ChangeKeyboardControl"><emphasis role='bold'>ChangeKeyboardControl</emphasis></link>
2550 2 2+n request length
2551 4 BITMASK value-mask (has n bits set to 1)
2552 #x0001 key-click-percent
2555 #x0008 bell-duration
2559 #x0080 auto-repeat-mode
2560 4n LISTofVALUE value-list
2563 1 INT8 key-click-percent
2566 2 INT16 bell-duration
2577 <link linkend="requests:GetKeyboardControl"><emphasis role='bold'>GetKeyboardControl</emphasis></link>
2584 1 global-auto-repeat
2587 2 CARD16 sequence number
2590 1 CARD8 key-click-percent
2591 1 CARD8 bell-percent
2593 2 CARD16 bell-duration
2595 32 LISTofCARD8 auto-repeats
2597 <link linkend="requests:Bell"><emphasis role='bold'>Bell</emphasis></link>
2602 <link linkend="requests:ChangePointerControl"><emphasis role='bold'>ChangePointerControl</emphasis></link>
2606 2 INT16 acceleration-numerator
2607 2 INT16 acceleration-denominator
2609 1 BOOL do-acceleration
2612 <link linkend="requests:GetPointerControl"><emphasis role='bold'>GetPointerControl</emphasis></link>
2620 2 CARD16 sequence number
2622 2 CARD16 acceleration-numerator
2623 2 CARD16 acceleration-denominator
2627 <link linkend="requests:SetScreenSaver"><emphasis role='bold'>SetScreenSaver</emphasis></link>
2643 <link linkend="requests:GetScreenSaver"><emphasis role='bold'>GetScreenSaver</emphasis></link>
2651 2 CARD16 sequence number
2663 <link linkend="requests:ChangeHosts"><emphasis role='bold'>ChangeHosts</emphasis></link>
2668 2 2+(n+p)/4 request length
2674 2 n length of address
2675 n LISTofCARD8 address
2678 <link linkend="requests:ListHosts"><emphasis role='bold'>ListHosts</emphasis></link>
2688 2 CARD16 sequence number
2690 2 CARD16 number of HOSTs in hosts
2692 n LISTofHOST hosts (n always a multiple of 4)
2694 <link linkend="requests:SetAccessControl"><emphasis role='bold'>SetAccessControl</emphasis></link>
2701 <link linkend="requests:SetCloseDownMode"><emphasis role='bold'>SetCloseDownMode</emphasis></link>
2709 <link linkend="requests:KillClient"><emphasis role='bold'>KillClient</emphasis></link>
2716 <link linkend="requests:RotateProperties"><emphasis role='bold'>RotateProperties</emphasis></link>
2719 2 3+n request length
2721 2 n number of properties
2723 4n LISTofATOM properties
2725 <link linkend="requests:ForceScreenSaver"><emphasis role='bold'>ForceScreenSaver</emphasis></link>
2732 <link linkend="requests:SetPointerMapping"><emphasis role='bold'>SetPointerMapping</emphasis></link>
2735 2 1+(n+p)/4 request length
2744 2 CARD16 sequence number
2748 <link linkend="requests:GetPointerMapping"><emphasis role='bold'>GetPointerMapping</emphasis></link>
2756 2 CARD16 sequence number
2757 4 (n+p)/4 reply length
2762 <link linkend="requests:SetModifierMapping"><emphasis role='bold'>SetModifierMapping</emphasis></link>
2764 1 n keycodes-per-modifier
2765 2 1+2n request length
2766 8n LISTofKEYCODE keycodes
2774 2 CARD16 sequence number
2778 <link linkend="requests:GetModifierMapping"><emphasis role='bold'>GetModifierMapping</emphasis></link>
2785 1 n keycodes-per-modifier
2786 2 CARD16 sequence number
2789 8n LISTofKEYCODE keycodes
2791 <link linkend="requests:NoOperation"><emphasis role='bold'>NoOperation</emphasis></link>
2794 2 1+n request length
2799 <sect1 id='Encoding::Events'>
2800 <title>Events</title>
2801 <indexterm zone="Encoding::Events"><primary>Event</primary><secondary>encoding</secondary></indexterm>
2803 <literallayout class="monospaced">
2804 <link linkend="events:KeyPress"><emphasis role='bold'>KeyPress</emphasis></link>
2807 2 CARD16 sequence number
2817 2 SETofKEYBUTMASK state
2821 <link linkend="events:KeyRelease"><emphasis role='bold'>KeyRelease</emphasis></link>
2824 2 CARD16 sequence number
2834 2 SETofKEYBUTMASK state
2838 <link linkend="events:ButtonPress"><emphasis role='bold'>ButtonPress</emphasis></link>
2841 2 CARD16 sequence number
2851 2 SETofKEYBUTMASK state
2855 <link linkend="events:ButtonRelease"><emphasis role='bold'>ButtonRelease</emphasis></link>
2858 2 CARD16 sequence number
2868 2 SETofKEYBUTMASK state
2872 <link linkend="events:MotionNotify"><emphasis role='bold'>MotionNotify</emphasis></link>
2877 2 CARD16 sequence number
2887 2 SETofKEYBUTMASK state
2891 <link linkend="events:EnterNotify"><emphasis role='bold'>EnterNotify</emphasis></link>
2899 2 CARD16 sequence number
2909 2 SETofKEYBUTMASK state
2914 1 same-screen, focus
2915 #x01 focus (1 is True, 0 is False)
2916 #x02 same-screen (1 is True, 0 is False)
2919 <link linkend="events:LeaveNotify"><emphasis role='bold'>LeaveNotify</emphasis></link>
2927 2 CARD16 sequence number
2937 2 SETofKEYBUTMASK state
2942 1 same-screen, focus
2943 #x01 focus (1 is True, 0 is False)
2944 #x02 same-screen (1 is True, 0 is False)
2947 <link linkend="events:FocusIn"><emphasis role='bold'>FocusIn</emphasis></link>
2958 2 CARD16 sequence number
2967 <link linkend="events:FocusOut"><emphasis role='bold'>FocusOut</emphasis></link>
2978 2 CARD16 sequence number
2987 <link linkend="events:KeymapNotify"><emphasis role='bold'>KeymapNotify</emphasis></link>
2989 31 LISTofCARD8 keys (byte for keycodes 0-7 is
2992 <link linkend="events:Expose"><emphasis role='bold'>Expose</emphasis></link>
2995 2 CARD16 sequence number
3004 <link linkend="events:GraphicsExposure"><emphasis role='bold'>GraphicsExposure</emphasis></link>
3007 2 CARD16 sequence number
3013 2 CARD16 minor-opcode
3015 1 CARD8 major-opcode
3018 <link linkend="events:NoExposure"><emphasis role='bold'>NoExposure</emphasis></link>
3021 2 CARD16 sequence number
3023 2 CARD16 minor-opcode
3024 1 CARD8 major-opcode
3027 <link linkend="events:VisibilityNotify"><emphasis role='bold'>VisibilityNotify</emphasis></link>
3030 2 CARD16 sequence number
3038 <link linkend="events:CreateNotify"><emphasis role='bold'>CreateNotify</emphasis></link>
3041 2 CARD16 sequence number
3048 2 CARD16 border-width
3049 1 BOOL override-redirect
3052 <link linkend="events:DestroyNotify"><emphasis role='bold'>DestroyNotify</emphasis></link>
3055 2 CARD16 sequence number
3060 <link linkend="events:UnmapNotify"><emphasis role='bold'>UnmapNotify</emphasis></link>
3063 2 CARD16 sequence number
3066 1 BOOL from-configure
3069 <link linkend="events:MapNotify"><emphasis role='bold'>MapNotify</emphasis></link>
3072 2 CARD16 sequence number
3075 1 BOOL override-redirect
3078 <link linkend="events:MapRequest"><emphasis role='bold'>MapRequest</emphasis></link>
3081 2 CARD16 sequence number
3086 <link linkend="events:ReparentNotify"><emphasis role='bold'>ReparentNotify</emphasis></link>
3089 2 CARD16 sequence number
3095 1 BOOL override-redirect
3098 <link linkend="events:ConfigureNotify"><emphasis role='bold'>ConfigureNotify</emphasis></link>
3101 2 CARD16 sequence number
3104 4 WINDOW above-sibling
3110 2 CARD16 border-width
3111 1 BOOL override-redirect
3114 <link linkend="events:ConfigureRequest"><emphasis role='bold'>ConfigureRequest</emphasis></link>
3122 2 CARD16 sequence number
3131 2 CARD16 border-width
3132 2 BITMASK value-mask
3142 <link linkend="events:GravityNotify"><emphasis role='bold'>GravityNotify</emphasis></link>
3145 2 CARD16 sequence number
3152 <link linkend="events:ResizeRequest"><emphasis role='bold'>ResizeRequest</emphasis></link>
3155 2 CARD16 sequence number
3161 <link linkend="events:CirculateNotify"><emphasis role='bold'>CirculateNotify</emphasis></link>
3164 2 CARD16 sequence number
3173 <link linkend="events:CirculateRequest"><emphasis role='bold'>CirculateRequest</emphasis></link>
3176 2 CARD16 sequence number
3185 <link linkend="events:PropertyNotify"><emphasis role='bold'>PropertyNotify</emphasis></link>
3188 2 CARD16 sequence number
3197 <link linkend="events:SelectionClear"><emphasis role='bold'>SelectionClear</emphasis></link>
3200 2 CARD16 sequence number
3206 <link linkend="events:SelectionRequest"><emphasis role='bold'>SelectionRequest</emphasis></link>
3209 2 CARD16 sequence number
3220 <link linkend="events:SelectionNotify"><emphasis role='bold'>SelectionNotify</emphasis></link>
3223 2 CARD16 sequence number
3233 <link linkend="events:ColormapNotify"><emphasis role='bold'>ColormapNotify</emphasis></link>
3236 2 CARD16 sequence number
3246 <link linkend="events:ClientMessage"><emphasis role='bold'>ClientMessage</emphasis></link>
3249 2 CARD16 sequence number
3254 <link linkend="events:MappingNotify"><emphasis role='bold'>MappingNotify</emphasis></link>
3257 2 CARD16 sequence number
3262 1 KEYCODE first-keycode