1 ! Copyright (C) 2005, 2006 Eduardo Cavazos
2 ! See http://factorcode.org/license.txt for BSD license.
4 ! The most popular guides to programming the X Window System are
5 ! the series from Oreilly. For programming with Xlib, there is
6 ! the reference manual and the programmers guide. However, a
7 ! lesser known manual is the free Xlib manual that comes with
8 ! the MIT X distribution. The arrangement and order of these
9 ! bindings follows the structure of the free Xlib manual. If you
10 ! add to this library and are wondering what part of the file to
11 ! modify, just find the function or data structure in the manual
12 ! and note the section.
14 USING: kernel arrays alien math words sequences ;
31 TYPEDEF: char* XPointer
32 TYPEDEF: void* Display*
33 TYPEDEF: void* Screen*
35 TYPEDEF: void* Visual*
36 TYPEDEF: void* XExtData*
37 TYPEDEF: void* XFontProp*
38 TYPEDEF: void* XComposeStatus*
44 TYPEDEF: ulong VisualID
47 TYPEDEF: void* Window**
50 : <XID> <ulong> ; inline
51 : <Window> <XID> ; inline
52 : <Drawable> <XID> ; inline
53 : <KeySym> <XID> ; inline
54 : <Atom> <ulong> ; inline
56 : *XID *ulong ; inline
57 : *Window *XID ; inline
58 : *Drawable *XID ; inline
59 : *KeySym *XID ; inline
60 : *Atom *ulong ; inline
62 ! 2 - Display Functions
65 FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
67 ! 2.2 Obtaining Information about the Display, Image Formats, or Screens
69 FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ;
70 FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ;
71 FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ;
72 FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ;
73 FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ;
74 FUNCTION: int XDefaultScreen ( Display* display ) ;
75 FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ;
76 FUNCTION: Window XDefaultRootWindow ( Display* display ) ;
77 FUNCTION: int XProtocolVersion ( Display* display ) ;
78 FUNCTION: int XProtocolRevision ( Display* display ) ;
79 FUNCTION: int XQLength ( Display* display ) ;
80 FUNCTION: int XScreenCount ( Display* display ) ;
81 FUNCTION: int XConnectionNumber ( Display* display ) ;
83 ! 2.5 Closing the Display
84 FUNCTION: int XCloseDisplay ( Display* display ) ;
87 ! 3 - Window Functions
90 ! 3.2 - Window Attributes
92 : CWBackPixmap 1 0 shift ; inline
93 : CWBackPixel 1 1 shift ; inline
94 : CWBorderPixmap 1 2 shift ; inline
95 : CWBorderPixel 1 3 shift ; inline
96 : CWBitGravity 1 4 shift ; inline
97 : CWWinGravity 1 5 shift ; inline
98 : CWBackingStore 1 6 shift ; inline
99 : CWBackingPlanes 1 7 shift ; inline
100 : CWBackingPixel 1 8 shift ; inline
101 : CWOverrideRedirect 1 9 shift ; inline
102 : CWSaveUnder 1 10 shift ; inline
103 : CWEventMask 1 11 shift ; inline
104 : CWDontPropagate 1 12 shift ; inline
105 : CWColormap 1 13 shift ; inline
106 : CWCursor 1 14 shift ; inline
108 BEGIN-STRUCT: XSetWindowAttributes
109 FIELD: Pixmap background_pixmap
110 FIELD: ulong background_pixel
111 FIELD: Pixmap border_pixmap
112 FIELD: ulong border_pixel
113 FIELD: int bit_gravity
114 FIELD: int win_gravity
115 FIELD: int backing_store
116 FIELD: ulong backing_planes
117 FIELD: ulong backing_pixel
118 FIELD: Bool save_under
119 FIELD: long event_mask
120 FIELD: long do_not_propagate_mask
121 FIELD: Bool override_redirect
122 FIELD: Colormap colormap
126 : UnmapGravity 0 ; inline
128 : ForgetGravity 0 ; inline
129 : NorthWestGravity 1 ; inline
130 : NorthGravity 2 ; inline
131 : NorthEastGravity 3 ; inline
132 : WestGravity 4 ; inline
133 : CenterGravity 5 ; inline
134 : EastGravity 6 ; inline
135 : SouthWestGravity 7 ; inline
136 : SouthGravity 8 ; inline
137 : SouthEastGravity 9 ; inline
138 : StaticGravity 10 ; inline
140 ! 3.3 - Creating Windows
142 FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ;
143 FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
144 FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
145 FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
146 FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
147 FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
148 FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
150 ! 3.5 Mapping Windows
152 FUNCTION: int XMapRaised ( Display* display, Window w ) ;
154 ! 3.7 - Configuring Windows
156 : CWX 1 0 shift ; inline
157 : CWY 1 1 shift ; inline
158 : CWWidth 1 2 shift ; inline
159 : CWHeight 1 3 shift ; inline
160 : CWBorderWidth 1 4 shift ; inline
161 : CWSibling 1 5 shift ; inline
162 : CWStackMode 1 6 shift ; inline
164 BEGIN-STRUCT: XWindowChanges
169 FIELD: int border_width
170 FIELD: Window sibling
171 FIELD: int stack_mode
174 FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
175 FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
176 FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ;
177 FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ;
180 ! 3.8 Changing Window Stacking Order
182 FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ;
183 FUNCTION: Status XLowerWindow ( Display* display, Window w ) ;
185 ! 3.9 - Changing Window Attributes
187 FUNCTION: Status XChangeWindowAttributes (
188 Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ;
189 FUNCTION: Status XSetWindowBackground (
190 Display* display, Window w, ulong background_pixel ) ;
191 FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ;
192 FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
194 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
195 ! 4 - Window Information Functions
196 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
198 ! 4.1 - Obtaining Window Information
200 FUNCTION: Status XQueryTree (
204 Window* parent_return,
205 Window** children_return, uint* nchildren_return ) ;
207 BEGIN-STRUCT: XWindowAttributes
212 FIELD: int border_width
214 FIELD: Visual* visual
217 FIELD: int bit_gravity
218 FIELD: int win_gravity
219 FIELD: int backing_store
220 FIELD: ulong backing_planes
221 FIELD: ulong backing_pixel
222 FIELD: Bool save_under
223 FIELD: Colormap colormap
224 FIELD: Bool map_installed
226 FIELD: long all_event_masks
227 FIELD: long your_event_mask
228 FIELD: long do_not_propagate_mask
229 FIELD: Bool override_redirect
230 FIELD: Screen* screen
233 FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
235 : IsUnmapped 0 ; inline
236 : IsUnviewable 1 ; inline
237 : IsViewable 2 ; inline
239 FUNCTION: Status XGetGeometry (
247 uint* border_width_return,
248 uint* depth_return ) ;
250 ! 4.2 - Translating Screen Coordinates
252 FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ;
254 ! 4.3 - Properties and Atoms
256 FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
258 FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
260 ! 4.4 - Obtaining and Changing Window Properties
262 FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property, long long_offset, long long_length, Bool delete, Atom req_type, Atom* actual_type_return, int* actual_format_return, ulong* nitems_return, ulong* bytes_after_return, char** prop_return ) ;
264 FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
268 FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ;
270 FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
272 FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
274 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
275 ! 6 - Color Management Functions
276 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
287 FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
288 FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
289 FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
291 ! 6.4 Creating, Copying, and Destroying Colormaps
293 FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
295 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
296 ! 7 - Graphics Context Functions
297 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
299 : GCFunction 1 0 shift ; inline
300 : GCPlaneMask 1 1 shift ; inline
301 : GCForeground 1 2 shift ; inline
302 : GCBackground 1 3 shift ; inline
303 : GCLineWidth 1 4 shift ; inline
304 : GCLineStyle 1 5 shift ; inline
305 : GCCapStyle 1 6 shift ; inline
306 : GCJoinStyle 1 7 shift ; inline
307 : GCFillStyle 1 8 shift ; inline
308 : GCFillRule 1 9 shift ; inline
309 : GCTile 1 10 shift ; inline
310 : GCStipple 1 11 shift ; inline
311 : GCTileStipXOrigin 1 12 shift ; inline
312 : GCTileStipYOrigin 1 13 shift ; inline
313 : GCFont 1 14 shift ; inline
314 : GCSubwindowMode 1 15 shift ; inline
315 : GCGraphicsExposures 1 16 shift ; inline
316 : GCClipXOrigin 1 17 shift ; inline
317 : GCClipYOrigin 1 18 shift ; inline
318 : GCClipMask 1 19 shift ; inline
319 : GCDashOffset 1 20 shift ; inline
320 : GCDashList 1 21 shift ; inline
321 : GCArcMode 1 22 shift ; inline
323 : GXclear HEX: 0 ; inline
324 : GXand HEX: 1 ; inline
325 : GXandReverse HEX: 2 ; inline
326 : GXcopy HEX: 3 ; inline
327 : GXandInverted HEX: 4 ; inline
328 : GXnoop HEX: 5 ; inline
329 : GXxor HEX: 6 ; inline
330 : GXor HEX: 7 ; inline
331 : GXnor HEX: 8 ; inline
332 : GXequiv HEX: 9 ; inline
333 : GXinvert HEX: a ; inline
334 : GXorReverse HEX: b ; inline
335 : GXcopyInverted HEX: c ; inline
336 : GXorInverted HEX: d ; inline
337 : GXnand HEX: e ; inline
338 : GXset HEX: f ; inline
340 BEGIN-STRUCT: XGCValues
342 FIELD: ulong plane_mask
343 FIELD: ulong foreground
344 FIELD: ulong background
345 FIELD: int line_width
346 FIELD: int line_style
348 FIELD: int join_style
349 FIELD: int fill_style
353 FIELD: Pixmap stipple
354 FIELD: int ts_x_origin
355 FIELD: int ts_y_origin
357 FIELD: int subwindow_mode
358 FIELD: Bool graphics_exposures
359 FIELD: int clip_x_origin
360 FIELD: int clip_y_origin
361 FIELD: Pixmap clip_mask
362 FIELD: int dash_offset
366 FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
367 FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
368 FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
369 FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
370 FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
371 FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
372 FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
374 : ClipByChildren 0 ; inline
375 : IncludeInferiors 1 ; inline
377 FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
379 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
380 ! 8 - Graphics Functions
381 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
383 FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
384 FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
385 FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
386 FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
387 FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
391 BEGIN-STRUCT: XCharStruct
392 FIELD: short lbearing;
393 FIELD: short rbearing;
396 FIELD: short descent;
397 FIELD: ushort attributes;
400 FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
401 FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
402 FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
404 BEGIN-STRUCT: XFontStruct
405 FIELD: XExtData* ext_data
407 FIELD: uint direction
408 FIELD: uint min_char_or_byte2
409 FIELD: uint max_char_or_byte2
410 FIELD: uint min_byte1
411 FIELD: uint max_byte1
412 FIELD: Bool all_chars_exist
413 FIELD: uint default_char
414 FIELD: int n_properties
415 FIELD: XFontProp* properties
416 FIELD: XCharStruct min_bounds
417 FIELD: XCharStruct max_bounds
418 FIELD: XCharStruct* per_char
423 FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
427 FUNCTION: Status XDrawString (
437 ! 9 - Window and Session Manager Functions
440 FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
441 FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
442 FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
443 FUNCTION: Status XGrabServer ( Display* display ) ;
444 FUNCTION: Status XUngrabServer ( Display* display ) ;
445 FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
447 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
449 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
453 : NoEventMask 0 ; inline
454 : KeyPressMask 1 0 shift ; inline
455 : KeyReleaseMask 1 1 shift ; inline
456 : ButtonPressMask 1 2 shift ; inline
457 : ButtonReleaseMask 1 3 shift ; inline
458 : EnterWindowMask 1 4 shift ; inline
459 : LeaveWindowMask 1 5 shift ; inline
460 : PointerMotionMask 1 6 shift ; inline
461 : PointerMotionHintMask 1 7 shift ; inline
462 : Button1MotionMask 1 8 shift ; inline
463 : Button2MotionMask 1 9 shift ; inline
464 : Button3MotionMask 1 10 shift ; inline
465 : Button4MotionMask 1 11 shift ; inline
466 : Button5MotionMask 1 12 shift ; inline
467 : ButtonMotionMask 1 13 shift ; inline
468 : KeymapStateMask 1 14 shift ; inline
469 : ExposureMask 1 15 shift ; inline
470 : VisibilityChangeMask 1 16 shift ; inline
471 : StructureNotifyMask 1 17 shift ; inline
472 : ResizeRedirectMask 1 18 shift ; inline
473 : SubstructureNotifyMask 1 19 shift ; inline
474 : SubstructureRedirectMask 1 20 shift ; inline
475 : FocusChangeMask 1 21 shift ; inline
476 : PropertyChangeMask 1 22 shift ; inline
477 : ColormapChangeMask 1 23 shift ; inline
478 : OwnerGrabButtonMask 1 24 shift ; inline
480 : KeyPress 2 ; inline
481 : KeyRelease 3 ; inline
482 : ButtonPress 4 ; inline
483 : ButtonRelease 5 ; inline
484 : MotionNotify 6 ; inline
485 : EnterNotify 7 ; inline
486 : LeaveNotify 8 ; inline
488 : FocusOut 10 ; inline
489 : KeymapNotify 11 ; inline
491 : GraphicsExpose 13 ; inline
492 : NoExpose 14 ; inline
493 : VisibilityNotify 15 ; inline
494 : CreateNotify 16 ; inline
495 : DestroyNotify 17 ; inline
496 : UnmapNotify 18 ; inline
497 : MapNotify 19 ; inline
498 : MapRequest 20 ; inline
499 : ReparentNotify 21 ; inline
500 : ConfigureNotify 22 ; inline
501 : ConfigureRequest 23 ; inline
502 : GravityNotify 24 ; inline
503 : ResizeRequest 25 ; inline
504 : CirculateNotify 26 ; inline
505 : CirculateRequest 27 ; inline
506 : PropertyNotify 28 ; inline
507 : SelectionClear 29 ; inline
508 : SelectionRequest 30 ; inline
509 : SelectionNotify 31 ; inline
510 : ColormapNotify 32 ; inline
511 : ClientMessage 33 ; inline
512 : MappingNotify 34 ; inline
513 : LASTEvent 35 ; inline
517 BEGIN-STRUCT: XAnyEvent
520 FIELD: Bool send_event
521 FIELD: Display* display
525 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
527 ! 10.5 Keyboard and Pointer Events
535 : Button1Mask 1 8 shift ; inline
536 : Button2Mask 1 9 shift ; inline
537 : Button3Mask 1 10 shift ; inline
538 : Button4Mask 1 11 shift ; inline
539 : Button5Mask 1 12 shift ; inline
541 : ShiftMask 1 0 shift ; inline
542 : LockMask 1 1 shift ; inline
543 : ControlMask 1 2 shift ; inline
544 : Mod1Mask 1 3 shift ; inline
545 : Mod2Mask 1 4 shift ; inline
546 : Mod3Mask 1 5 shift ; inline
547 : Mod4Mask 1 6 shift ; inline
548 : Mod5Mask 1 7 shift ; inline
550 BEGIN-STRUCT: XButtonEvent
553 FIELD: Bool send_event
554 FIELD: Display* display
557 FIELD: Window subwindow
565 FIELD: Bool same_screen
568 TYPEDEF: XButtonEvent XButtonPressedEvent
569 TYPEDEF: XButtonEvent XButtonReleasedEvent
572 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
574 BEGIN-STRUCT: XKeyEvent
577 FIELD: Bool send_event
578 FIELD: Display* display
581 FIELD: Window subwindow
589 FIELD: Bool same_screen
592 TYPEDEF: XKeyEvent XKeyPressedEvent
593 TYPEDEF: XKeyEvent XKeyReleasedEvent
595 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
597 BEGIN-STRUCT: XMotionEvent
600 FIELD: Bool send_event
601 FIELD: Display* display
604 FIELD: Window subwindow
612 FIELD: Bool same_screen
615 TYPEDEF: XMotionEvent XPointerMovedEvent
617 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
619 BEGIN-STRUCT: XCrossingEvent
622 FIELD: Bool send_event
623 FIELD: Display* display
626 FIELD: Window subwindow
634 FIELD: Bool same_screen
639 TYPEDEF: XCrossingEvent XEnterWindowEvent
640 TYPEDEF: XCrossingEvent XLeaveWindowEvent
642 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
644 BEGIN-STRUCT: XFocusChangeEvent
647 FIELD: Bool send_event
648 FIELD: Display* display
654 TYPEDEF: XFocusChangeEvent XFocusInEvent
655 TYPEDEF: XFocusChangeEvent XFocusOutEvent
657 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
659 BEGIN-STRUCT: XExposeEvent
662 FIELD: Bool send_event
663 FIELD: Display* display
672 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
674 BEGIN-STRUCT: XGraphicsExposeEvent
677 FIELD: Bool send_event
678 FIELD: Display* display
679 FIELD: Drawable drawable
685 FIELD: int major_code
686 FIELD: int minor_code
689 BEGIN-STRUCT: XNoExposeEvent
692 FIELD: Bool send_event
693 FIELD: Display* display
694 FIELD: Drawable drawable
695 FIELD: int major_code
696 FIELD: int minor_code
699 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
701 BEGIN-STRUCT: XVisibilityEvent
704 FIELD: Bool send_event
705 FIELD: Display* display
710 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
712 BEGIN-STRUCT: XCreateWindowEvent
715 FIELD: Bool send_event
716 FIELD: Display* display
723 FIELD: int border_width
724 FIELD: Bool override_redirect
727 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
729 BEGIN-STRUCT: XDestroyWindowEvent
732 FIELD: Bool send_event
733 FIELD: Display* display
738 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
740 BEGIN-STRUCT: XUnmapEvent
743 FIELD: Bool send_event
744 FIELD: Display* display
747 FIELD: Bool from_configure
750 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
752 BEGIN-STRUCT: XMapEvent
755 FIELD: Bool send_event
756 FIELD: Display* display
759 FIELD: Bool override_redirect
762 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
764 BEGIN-STRUCT: XMapRequestEvent
767 FIELD: Bool send_event
768 FIELD: Display* display
773 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
775 BEGIN-STRUCT: XReparentEvent
778 FIELD: Bool send_event
779 FIELD: Display* display
785 FIELD: Bool override_redirect
788 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
790 BEGIN-STRUCT: XConfigureEvent
793 FIELD: Bool send_event
794 FIELD: Display* display
801 FIELD: int border_width
803 FIELD: Bool override_redirect
806 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
808 BEGIN-STRUCT: XGravityEvent
811 FIELD: Bool send_event
812 FIELD: Display* display
819 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
821 BEGIN-STRUCT: XResizeRequestEvent
824 FIELD: Bool send_event
825 FIELD: Display* display
831 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
833 BEGIN-STRUCT: XConfigureRequestEvent
836 FIELD: Bool send_event
837 FIELD: Display* display
844 FIELD: int border_width
847 FIELD: ulong value_mask
850 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
852 BEGIN-STRUCT: XCirculateEvent
855 FIELD: Bool send_event
856 FIELD: Display* display
862 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
864 BEGIN-STRUCT: XCirculateRequestEvent
867 FIELD: Bool send_event
868 FIELD: Display* display
874 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
876 BEGIN-STRUCT: XPropertyEvent
879 FIELD: Bool send_event
880 FIELD: Display* display
887 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
889 BEGIN-STRUCT: XSelectionClearEvent
892 FIELD: Bool send_event
893 FIELD: Display* display
895 FIELD: Atom selection
899 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
901 BEGIN-STRUCT: XSelectionRequestEvent
904 FIELD: Bool send_event
905 FIELD: Display* display
907 FIELD: Window requestor
908 FIELD: Atom selection
914 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
916 BEGIN-STRUCT: XSelectionEvent
919 FIELD: Bool send_event
920 FIELD: Display* display
921 FIELD: Window requestor
922 FIELD: Atom selection
928 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
930 BEGIN-STRUCT: XColormapEvent
933 FIELD: Bool send_event
934 FIELD: Display* display
936 FIELD: Colormap colormap
941 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
943 BEGIN-STRUCT: XClientMessageEvent
946 FIELD: Bool send_event
947 FIELD: Display* display
949 FIELD: Atom message_type
963 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
965 BEGIN-STRUCT: XMappingEvent
968 FIELD: Bool send_event
969 FIELD: Display* display
972 FIELD: int first_keycode
976 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
978 BEGIN-STRUCT: XErrorEvent
980 FIELD: Display* display
981 FIELD: XID resourceid
983 FIELD: uchar error_code
984 FIELD: uchar request_code
985 FIELD: uchar minor_code
988 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
990 BEGIN-STRUCT: XKeymapEvent
993 FIELD: Bool send_event
994 FIELD: Display* display
996 ! char key_vector[32];
1016 XGraphicsExposeEvent
1028 XConfigureRequestEvent
1030 XCirculateRequestEvent
1032 XSelectionClearEvent
1033 XSelectionRequestEvent
1042 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1043 ! 11 - Event Handling Functions
1044 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1046 FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
1047 FUNCTION: Status XFlush ( Display* display ) ;
1048 FUNCTION: Status XSync ( Display* display, int discard ) ;
1049 FUNCTION: int XPending ( Display* display ) ;
1050 FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
1051 FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
1053 ! 11.3 - Event Queue Management
1055 : QueuedAlready 0 ; inline
1056 : QueuedAfterReading 1 ; inline
1057 : QueuedAfterFlush 2 ; inline
1059 FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
1060 FUNCTION: int XPending ( Display* display ) ;
1062 ! 11.6 - Sending Events to Other Applications
1064 FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
1066 ! 11.8 - Handling Protocol Errors
1068 FUNCTION: int XSetErrorHandler ( void* handler ) ;
1070 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1071 ! 12 - Input Device Functions
1072 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1075 : PointerRoot 1 ; inline
1077 : RevertToNone None ; inline
1078 : RevertToPointerRoot PointerRoot ; inline
1079 : RevertToParent 2 ; inline
1081 : GrabModeSync 0 ; inline
1082 : GrabModeAsync 1 ; inline
1085 FUNCTION: int XGrabPointer (
1096 FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
1097 FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
1098 FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
1099 FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
1100 FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y ) ;
1102 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1103 ! 14 - Inter-Client Communication Functions
1104 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1106 ! 14.1 Client to Window Manager Communication
1108 FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
1109 FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
1111 ! 14.1.1. Manipulating Top-Level Windows
1113 FUNCTION: Status XIconifyWindow (
1114 Display* display, Window w, int screen_number ) ;
1116 FUNCTION: Status XWithdrawWindow (
1117 Display* display, Window w, int screen_number ) ;
1119 ! 14.1.6 - Setting and Reading the WM_HINTS Property
1121 ! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
1123 : USPosition 1 0 shift ; inline
1124 : USSize 1 1 shift ; inline
1125 : PPosition 1 2 shift ; inline
1126 : PSize 1 3 shift ; inline
1127 : PMinSize 1 4 shift ; inline
1128 : PMaxSize 1 5 shift ; inline
1129 : PResizeInc 1 6 shift ; inline
1130 : PAspect 1 7 shift ; inline
1131 : PBaseSize 1 8 shift ; inline
1132 : PWinGravity 1 9 shift ; inline
1133 : PAllHints [ PPosition PSize PMinSize PMaxSize PResizeInc PAspect ]
1134 0 [ execute bitor ] reduce ; inline
1136 BEGIN-STRUCT: XSizeHints
1142 FIELD: int min_width
1143 FIELD: int min_height
1144 FIELD: int max_width
1145 FIELD: int max_height
1146 FIELD: int width_inc
1147 FIELD: int height_inc
1148 FIELD: int min_aspect_x
1149 FIELD: int min_aspect_y
1150 FIELD: int max_aspect_x
1151 FIELD: int max_aspect_y
1152 FIELD: int base_width
1153 FIELD: int base_height
1154 FIELD: int win_gravity;
1157 ! 14.1.10. Setting and Reading the WM_PROTOCOLS Property
1159 FUNCTION: Status XSetWMProtocols (
1160 Display* display, Window w, Atom* protocols, int count ) ;
1162 FUNCTION: Status XGetWMProtocols (
1165 Atom** protocols_return,
1166 int* count_return ) ;
1168 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1169 ! 16 - Application Utility Functions
1170 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1172 ! 16.1 Keyboard Utility Functions
1174 FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
1176 FUNCTION: int XLookupString (
1177 XKeyEvent* event_struct,
1178 void* buffer_return,
1180 KeySym* keysym_return,
1181 XComposeStatus* status_in_out ) ;
1183 ! 16.7 Determining the Appropriate Visual Type
1185 : VisualNoMask HEX: 0 ; inline
1186 : VisualIDMask HEX: 1 ; inline
1187 : VisualScreenMask HEX: 2 ; inline
1188 : VisualDepthMask HEX: 4 ; inline
1189 : VisualClassMask HEX: 8 ; inline
1190 : VisualRedMaskMask HEX: 10 ; inline
1191 : VisualGreenMaskMask HEX: 20 ; inline
1192 : VisualBlueMaskMask HEX: 40 ; inline
1193 : VisualColormapSizeMask HEX: 80 ; inline
1194 : VisualBitsPerRGBMask HEX: 100 ; inline
1195 : VisualAllMask HEX: 1FF ; inline
1197 BEGIN-STRUCT: XVisualInfo
1198 FIELD: Visual* visual
1199 FIELD: VisualID visualid
1203 FIELD: ulong red_mask
1204 FIELD: ulong green_mask
1205 FIELD: ulong blue_mask
1206 FIELD: int colormap_size
1207 FIELD: int bits_per_rgb
1210 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1211 ! Appendix D - Compatibility Functions
1212 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1214 FUNCTION: Status XSetStandardProperties (
1222 XSizeHints* hints ) ;
1224 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1226 : CurrentTime 0 ; inline
1228 : XA_PRIMARY 1 ; inline
1229 : XA_SECONDARY 2 ; inline
1231 : XA_ATOM 4 ; inline
1232 : XA_BITMAP 5 ; inline
1233 : XA_CARDINAL 6 ; inline
1234 : XA_COLORMAP 7 ; inline
1235 : XA_CURSOR 8 ; inline
1236 : XA_CUT_BUFFER0 9 ; inline
1237 : XA_CUT_BUFFER1 10 ; inline
1238 : XA_CUT_BUFFER2 11 ; inline
1239 : XA_CUT_BUFFER3 12 ; inline
1240 : XA_CUT_BUFFER4 13 ; inline
1241 : XA_CUT_BUFFER5 14 ; inline
1242 : XA_CUT_BUFFER6 15 ; inline
1243 : XA_CUT_BUFFER7 16 ; inline
1244 : XA_DRAWABLE 17 ; inline
1245 : XA_FONT 18 ; inline
1246 : XA_INTEGER 19 ; inline
1247 : XA_PIXMAP 20 ; inline
1248 : XA_POINT 21 ; inline
1249 : XA_RECTANGLE 22 ; inline
1250 : XA_RESOURCE_MANAGER 23 ; inline
1251 : XA_RGB_COLOR_MAP 24 ; inline
1252 : XA_RGB_BEST_MAP 25 ; inline
1253 : XA_RGB_BLUE_MAP 26 ; inline
1254 : XA_RGB_DEFAULT_MAP 27 ; inline
1255 : XA_RGB_GRAY_MAP 28 ; inline
1256 : XA_RGB_GREEN_MAP 29 ; inline
1257 : XA_RGB_RED_MAP 30 ; inline
1258 : XA_STRING 31 ; inline
1259 : XA_VISUALID 32 ; inline
1260 : XA_WINDOW 33 ; inline
1261 : XA_WM_COMMAND 34 ; inline
1262 : XA_WM_HINTS 35 ; inline
1263 : XA_WM_CLIENT_MACHINE 36 ; inline
1264 : XA_WM_ICON_NAME 37 ; inline
1265 : XA_WM_ICON_SIZE 38 ; inline
1266 : XA_WM_NAME 39 ; inline
1267 : XA_WM_NORMAL_HINTS 40 ; inline
1268 : XA_WM_SIZE_HINTS 41 ; inline
1269 : XA_WM_ZOOM_HINTS 42 ; inline
1270 : XA_MIN_SPACE 43 ; inline
1271 : XA_NORM_SPACE 44 ; inline
1272 : XA_MAX_SPACE 45 ; inline
1273 : XA_END_SPACE 46 ; inline
1274 : XA_SUPERSCRIPT_X 47 ; inline
1275 : XA_SUPERSCRIPT_Y 48 ; inline
1276 : XA_SUBSCRIPT_X 49 ; inline
1277 : XA_SUBSCRIPT_Y 50 ; inline
1278 : XA_UNDERLINE_POSITION 51 ; inline
1279 : XA_UNDERLINE_THICKNESS 52 ; inline
1280 : XA_STRIKEOUT_ASCENT 53 ; inline
1281 : XA_STRIKEOUT_DESCENT 54 ; inline
1282 : XA_ITALIC_ANGLE 55 ; inline
1283 : XA_X_HEIGHT 56 ; inline
1284 : XA_QUAD_WIDTH 57 ; inline
1285 : XA_WEIGHT 58 ; inline
1286 : XA_POINT_SIZE 59 ; inline
1287 : XA_RESOLUTION 60 ; inline
1288 : XA_COPYRIGHT 61 ; inline
1289 : XA_NOTICE 62 ; inline
1290 : XA_FONT_NAME 63 ; inline
1291 : XA_FAMILY_NAME 64 ; inline
1292 : XA_FULL_NAME 65 ; inline
1293 : XA_CAP_HEIGHT 66 ; inline
1294 : XA_WM_CLASS 67 ; inline
1295 : XA_WM_TRANSIENT_FOR 68 ; inline
1297 : XA_LAST_PREDEFINED 68 ; inline
1299 : PropModeReplace 0 ; inline
1300 : PropModePrepend 1 ; inline
1301 : PropModeAppend 2 ; inline
1303 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1304 ! The rest of the stuff is not from the book.
1305 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1307 FUNCTION: void XFree ( void* data ) ;
1308 FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
1310 : USPosition 1 0 shift ; inline
1311 : USSize 1 1 shift ; inline
1312 : PPosition 1 2 shift ; inline
1313 : PSize 1 3 shift ; inline
1314 : PMinSize 1 4 shift ; inline
1315 : PMaxSize 1 5 shift ; inline
1316 : PResizeInc 1 6 shift ; inline
1317 : PAspect 1 7 shift ; inline
1318 : PBaseSize 1 8 shift ; inline
1319 : PWinGravity 1 9 shift ; inline
1321 BEGIN-STRUCT: XSizeHints
1327 FIELD: int min_width
1328 FIELD: int min_height
1329 FIELD: int max_width
1330 FIELD: int max_height
1331 FIELD: int width_inc
1332 FIELD: int height_inc
1333 FIELD: int min_aspect_x
1334 FIELD: int min_aspect_y
1335 FIELD: int max_aspect_x
1336 FIELD: int max_aspect_y
1337 FIELD: int base_width
1338 FIELD: int base_height
1339 FIELD: int win_gravity
1342 FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;