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 ! https://www.x.org/releases/X11R7.6/doc/libX11/specs/libX11/libX11.html
15 USING: accessors alien.c-types alien.data alien.syntax classes.struct
16 io.encodings.ascii kernel literals math x11.X x11.syntax ;
17 FROM: alien.c-types => short ;
22 TYPEDEF: c-string XPointer
28 C-TYPE: XComposeStatus
36 TYPEDEF: ulong VisualID
39 : *XID ( bytes -- n ) ulong deref ;
43 : *Atom ( bytes -- n ) ulong deref ;
45 ! 2 - Display Functions
48 ! This struct is incomplete
54 X-FUNCTION: Display* XOpenDisplay ( c-string[ascii] display_name )
56 ! 2.2 Obtaining Information about the Display, Image Formats, or Screens
58 X-FUNCTION: ulong XBlackPixel ( Display* display, int screen_number )
59 X-FUNCTION: ulong XWhitePixel ( Display* display, int screen_number )
60 X-FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number )
61 X-FUNCTION: int XDefaultDepth ( Display* display, int screen_number )
62 X-FUNCTION: GC XDefaultGC ( Display* display, int screen_number )
63 X-FUNCTION: int XDefaultScreen ( Display* display )
64 X-FUNCTION: Window XRootWindow ( Display* display, int screen_number )
65 X-FUNCTION: Window XDefaultRootWindow ( Display* display )
66 X-FUNCTION: int XProtocolVersion ( Display* display )
67 X-FUNCTION: int XProtocolRevision ( Display* display )
68 X-FUNCTION: int XQLength ( Display* display )
69 X-FUNCTION: int XScreenCount ( Display* display )
70 X-FUNCTION: int XConnectionNumber ( Display* display )
72 ! 2.5 Closing the Display
73 X-FUNCTION: int XCloseDisplay ( Display* display )
76 ! 3 - Window Functions
79 ! 3.2 - Window Attributes
81 : CWBackPixmap ( -- n ) 0 2^ ; inline
82 : CWBackPixel ( -- n ) 1 2^ ; inline
83 : CWBorderPixmap ( -- n ) 2 2^ ; inline
84 : CWBorderPixel ( -- n ) 3 2^ ; inline
85 : CWBitGravity ( -- n ) 4 2^ ; inline
86 : CWWinGravity ( -- n ) 5 2^ ; inline
87 : CWBackingStore ( -- n ) 6 2^ ; inline
88 : CWBackingPlanes ( -- n ) 7 2^ ; inline
89 : CWBackingPixel ( -- n ) 8 2^ ; inline
90 : CWOverrideRedirect ( -- n ) 9 2^ ; inline
91 : CWSaveUnder ( -- n ) 10 2^ ; inline
92 : CWEventMask ( -- n ) 11 2^ ; inline
93 : CWDontPropagate ( -- n ) 12 2^ ; inline
94 : CWColormap ( -- n ) 13 2^ ; inline
95 : CWCursor ( -- n ) 14 2^ ; inline
97 STRUCT: XSetWindowAttributes
98 { background_pixmap Pixmap }
99 { background_pixel ulong }
100 { border_pixmap Pixmap }
101 { border_pixel ulong }
104 { backing_store int }
105 { backing_planes ulong }
106 { backing_pixel ulong }
109 { do_not_propagate_mask long }
110 { override_redirect Bool }
111 { colormap Colormap }
114 ! 3.3 - Creating Windows
116 X-FUNCTION: Window XCreateWindow ( Display* display,
118 int x, int y, uint width, uint height,
119 uint border_width, int depth, uint class,
120 Visual* visual, ulong valuemask,
121 XSetWindowAttributes* attributes )
122 X-FUNCTION: Window XCreateSimpleWindow ( Display* display,
124 int x, int y, uint width, uint height,
125 uint border_width, ulong border,
127 X-FUNCTION: Status XDestroyWindow ( Display* display, Window w )
128 X-FUNCTION: Status XMapWindow ( Display* display, Window window )
129 X-FUNCTION: Status XMapSubwindows ( Display* display, Window window )
130 X-FUNCTION: Status XUnmapWindow ( Display* display, Window w )
131 X-FUNCTION: Status XUnmapSubwindows ( Display* display, Window w )
133 ! 3.5 Mapping Windows
135 X-FUNCTION: int XMapRaised ( Display* display, Window w )
137 ! 3.7 - Configuring Windows
139 STRUCT: XWindowChanges
148 X-FUNCTION: Status XConfigureWindow ( Display* display,
150 uint value_mask, XWindowChanges* values )
151 X-FUNCTION: Status XMoveWindow ( Display* display, Window w,
153 X-FUNCTION: Status XResizeWindow ( Display* display,
157 X-FUNCTION: Status XSetWindowBorderWidth ( Display* display,
162 ! 3.8 Changing Window Stacking Order
164 X-FUNCTION: Status XRaiseWindow ( Display* display, Window w )
165 X-FUNCTION: Status XLowerWindow ( Display* display, Window w )
167 ! 3.9 - Changing Window Attributes
169 X-FUNCTION: Status XChangeWindowAttributes ( Display* display,
172 XSetWindowAttributes* attr )
173 X-FUNCTION: Status XSetWindowBackground ( Display* display,
174 Window w, ulong background_pixel )
175 X-FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor )
176 X-FUNCTION: Status XUndefineCursor ( Display* display, Window w )
178 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
179 ! 4 - Window Information Functions
180 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
182 ! 4.1 - Obtaining Window Information
184 X-FUNCTION: Status XQueryTree ( Display* display,
187 Window* parent_return,
188 Window** children_return,
189 uint* nchildren_return )
191 STRUCT: XWindowAttributes
203 { backing_store int }
204 { backing_planes ulong }
205 { backing_pixel ulong }
207 { colormap Colormap }
208 { map_installed Bool }
210 { all_event_masks long }
211 { your_event_mask long }
212 { do_not_propagate_mask long }
213 { override_redirect Bool }
216 X-FUNCTION: Status XGetWindowAttributes ( Display* display,
218 XWindowAttributes* attr )
220 X-FUNCTION: Status XGetGeometry ( Display* display,
227 uint* border_width_return,
230 ! 4.2 - Translating Screen Coordinates
232 X-FUNCTION: Bool XQueryPointer ( Display* display,
234 Window* root_return, Window* child_return,
235 int* root_x_return, int* root_y_return,
236 int* win_x_return, int* win_y_return,
239 ! 4.3 - Properties and Atoms
241 X-FUNCTION: Atom XInternAtom ( Display* display,
243 Bool only_if_exists )
245 X-FUNCTION: c-string XGetAtomName ( Display* display, Atom atom )
247 ! 4.4 - Obtaining and Changing Window Properties
249 X-FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property,
250 long long_offset, long long_length,
251 Bool delete, Atom req_type,
252 Atom* actual_type_return,
253 int* actual_format_return,
254 ulong* nitems_return,
255 ulong* bytes_after_return,
256 c-string* prop_return )
258 X-FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property,
259 Atom type, int format,
260 int mode, void* data, int nelements )
264 X-FUNCTION: int XSetSelectionOwner ( Display* display,
269 X-FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection )
271 X-FUNCTION: int XConvertSelection ( Display* display,
279 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
280 ! 5 - Pixmap and Cursor Functions
281 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
283 ! 5.1 - Creating and Freeing Pixmaps
285 X-FUNCTION: Pixmap XCreatePixmap ( Display* display,
287 uint width, uint height, uint depth )
288 X-FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap )
290 ! 5.2 - Creating, Recoloring, and Freeing Cursors
293 X-FUNCTION: Cursor XCreatePixmapCursor ( Display* display,
294 Pixmap source, Pixmap mask,
295 XColor* foreground_color,
296 XColor* background_color,
298 X-FUNCTION: int XFreeCursor ( Display* display, Cursor cursor )
300 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
301 ! 6 - Color Management Functions
302 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
312 X-FUNCTION: Status XLookupColor ( Display* display,
315 XColor* exact_def_return,
316 XColor* screen_def_return )
317 X-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out )
318 X-FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out )
320 ! 6.4 Creating, Copying, and Destroying Colormaps
322 X-FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc )
324 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
325 ! 7 - Graphics Context Functions
326 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
345 { subwindow_mode int }
346 { graphics_exposures Bool }
347 { clip_x_origin int }
348 { clip_y_origin int }
353 X-FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values )
354 X-FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values )
355 X-FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return )
356 X-FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground )
357 X-FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background )
358 X-FUNCTION: Status XSetFunction ( Display* display, GC gc, int function )
359 X-FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode )
361 X-FUNCTION: GContext XGContextFromGC ( GC gc )
363 X-FUNCTION: Status XSetFont ( Display* display, GC gc, Font font )
365 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
366 ! 8 - Graphics Functions
367 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369 X-FUNCTION: Status XClearWindow ( Display* display, Window w )
370 X-FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y )
371 X-FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 )
372 X-FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 )
373 X-FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 )
383 { attributes ushort } ;
386 { ext_data XExtData* }
389 { min_char_or_byte2 uint }
390 { max_char_or_byte2 uint }
393 { all_chars_exist Bool }
394 { default_char uint }
396 { properties XFontProp* }
397 { min_bounds XCharStruct }
398 { max_bounds XCharStruct }
399 { per_char XCharStruct* }
403 X-FUNCTION: Font XLoadFont ( Display* display, c-string name )
404 X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID )
405 X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, c-string name )
407 X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, c-string string, int count )
411 X-FUNCTION: Status XDrawString (
420 ! 8.7 - Transferring Images between Client and Server
422 CONSTANT: AllPlanes -1
425 { create_image void* }
426 { destroy_image void* }
430 { add_pixel void* } ;
440 { bitmap_bit_order int }
443 { bytes_per_line int }
444 { bits_per_pixel int }
451 X-FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format )
452 X-FUNCTION: int XDestroyImage ( XImage* ximage )
454 : XImage-size ( ximage -- size )
455 [ height>> ] [ bytes_per_line>> ] bi * ;
457 : XImage-pixels ( ximage -- byte-array )
458 [ data>> ] [ XImage-size ] bi memory>byte-array ;
461 ! 9 - Window and Session Manager Functions
464 X-FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y )
465 X-FUNCTION: Status XAddToSaveSet ( Display* display, Window w )
466 X-FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w )
467 X-FUNCTION: Status XGrabServer ( Display* display )
468 X-FUNCTION: Status XUngrabServer ( Display* display )
469 X-FUNCTION: Status XKillClient ( Display* display, XID resource )
471 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
473 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
484 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
486 ! 10.5 Keyboard and Pointer Events
503 { same_screen Bool } ;
505 TYPEDEF: XButtonEvent XButtonPressedEvent
506 TYPEDEF: XButtonEvent XButtonReleasedEvent
509 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
526 { same_screen Bool } ;
528 TYPEDEF: XKeyEvent XKeyPressedEvent
529 TYPEDEF: XKeyEvent XKeyReleasedEvent
531 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
548 { same_screen Bool } ;
550 TYPEDEF: XMotionEvent XPointerMovedEvent
552 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
554 STRUCT: XCrossingEvent
573 TYPEDEF: XCrossingEvent XEnterWindowEvent
574 TYPEDEF: XCrossingEvent XLeaveWindowEvent
576 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
578 STRUCT: XFocusChangeEvent
587 TYPEDEF: XFocusChangeEvent XFocusInEvent
588 TYPEDEF: XFocusChangeEvent XFocusOutEvent
590 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
604 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
606 STRUCT: XGraphicsExposeEvent
611 { drawable Drawable }
620 STRUCT: XNoExposeEvent
625 { drawable Drawable }
629 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
631 STRUCT: XVisibilityEvent
639 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
641 STRUCT: XCreateWindowEvent
653 { override_redirect Bool } ;
655 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
657 STRUCT: XDestroyWindowEvent
665 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
674 { from_configure Bool } ;
676 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
685 { override_redirect Bool } ;
687 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
689 STRUCT: XMapRequestEvent
697 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
699 STRUCT: XReparentEvent
709 { override_redirect Bool } ;
711 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
713 STRUCT: XConfigureEvent
726 { override_redirect Bool } ;
728 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
730 STRUCT: XGravityEvent
740 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
742 STRUCT: XResizeRequestEvent
751 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
753 STRUCT: XConfigureRequestEvent
767 { value_mask ulong } ;
769 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
771 STRUCT: XCirculateEvent
780 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
782 STRUCT: XCirculateRequestEvent
791 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
793 STRUCT: XPropertyEvent
803 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
805 STRUCT: XSelectionClearEvent
814 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
816 STRUCT: XSelectionRequestEvent
828 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
830 STRUCT: XSelectionEvent
841 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
843 STRUCT: XColormapEvent
849 { colormap Colormap }
853 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
855 STRUCT: XClientMessageEvent
861 { message_type Atom }
869 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
871 STRUCT: XMappingEvent
878 { first_keycode int }
881 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
889 { request_code uchar }
890 { minor_code uchar } ;
892 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
902 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
904 ! Newer things, needed for XInput2 support. Not in the book.
906 ! GenericEvent is the standard event for all newer extensions.
907 STRUCT: XGenericEvent
915 STRUCT: XGenericEventCookie
925 X-FUNCTION: Bool XGetEventData ( Display* dpy, XGenericEventCookie* cookie )
926 X-FUNCTION: void XFreeEventData ( Display* dpy, XGenericEventCookie* cookie )
928 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
932 { XAnyEvent XAnyEvent }
933 { XKeyEvent XKeyEvent }
934 { XButtonEvent XButtonEvent }
935 { XMotionEvent XMotionEvent }
936 { XCrossingEvent XCrossingEvent }
937 { XFocusChangeEvent XFocusChangeEvent }
938 { XExposeEvent XExposeEvent }
939 { XGraphicsExposeEvent XGraphicsExposeEvent }
940 { XNoExposeEvent XNoExposeEvent }
941 { XVisibilityEvent XVisibilityEvent }
942 { XCreateWindowEvent XCreateWindowEvent }
943 { XDestroyWindowEvent XDestroyWindowEvent }
944 { XUnmapEvent XUnmapEvent }
945 { XMapEvent XMapEvent }
946 { XMapRequestEvent XMapRequestEvent }
947 { XReparentEvent XReparentEvent }
948 { XConfigureEvent XConfigureEvent }
949 { XGravityEvent XGravityEvent }
950 { XResizeRequestEvent XResizeRequestEvent }
951 { XConfigureRequestEvent XConfigureRequestEvent }
952 { XCirculateEvent XCirculateEvent }
953 { XCirculateRequestEvent XCirculateRequestEvent }
954 { XPropertyEvent XPropertyEvent }
955 { XSelectionClearEvent XSelectionClearEvent }
956 { XSelectionRequestEvent XSelectionRequestEvent }
957 { XSelectionEvent XSelectionEvent }
958 { XColormapEvent XColormapEvent }
959 { XClientMessageEvent XClientMessageEvent }
960 { XMappingEvent XMappingEvent }
961 { XErrorEvent XErrorEvent }
962 { XKeymapEvent XKeymapEvent }
963 { XGenericEvent XGenericEvent }
964 { XGenericEventCookie XGenericEventCookie }
965 { padding long[24] } ;
967 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
968 ! 11 - Event Handling Functions
969 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
971 X-FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask )
972 X-FUNCTION: Status XFlush ( Display* display )
973 X-FUNCTION: Status XSync ( Display* display, int discard )
974 X-FUNCTION: Status XNextEvent ( Display* display, XEvent* event )
975 X-FUNCTION: Status XMaskEvent ( Display* display,
977 XEvent* event_return )
979 ! 11.3 - Event Queue Management
981 CONSTANT: QueuedAlready 0
982 CONSTANT: QueuedAfterReading 1
983 CONSTANT: QueuedAfterFlush 2
985 X-FUNCTION: int XEventsQueued ( Display* display, int mode )
986 X-FUNCTION: int XPending ( Display* display )
988 ! 11.6 - Sending Events to Other Applications
990 X-FUNCTION: Status XSendEvent ( Display* display,
996 ! 11.8 - Handling Protocol Errors
998 X-FUNCTION: int XSetErrorHandler ( void* handler )
1000 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1001 ! 12 - Input Device Functions
1002 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1003 X-FUNCTION: int XGrabPointer (
1015 X-FUNCTION: Status XUngrabPointer ( Display* display, Time time )
1016 X-FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time )
1017 X-FUNCTION: Status XGrabKey (
1018 Display* display, int keycode, uint modifiers,
1019 Window grab_window, Bool owner_events,
1020 int pointer_mode, int keyboard_mode
1022 X-FUNCTION: int XGrabKeyboard (
1023 Display* display, Window grab_window,
1025 int pointer_mode, int keyboard_mode, Time time
1027 X-FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time )
1029 X-FUNCTION: Status XGetInputFocus (
1031 Window* focus_return,
1032 int* revert_to_return
1035 X-FUNCTION: Status XWarpPointer (
1037 Window src_w, Window dest_w,
1038 int src_x, int src_y, uint src_width, uint src_height,
1039 int dest_x, int dest_y
1042 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1043 ! 14 - Inter-Client Communication Functions
1044 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1046 ! 14.1 Client to Window Manager Communication
1048 X-FUNCTION: Status XFetchName ( Display* display, Window w, c-string* window_name_return )
1049 X-FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return )
1051 ! 14.1.1. Manipulating Top-Level Windows
1053 X-FUNCTION: Status XIconifyWindow (
1059 X-FUNCTION: Status XWithdrawWindow (
1065 ! 14.1.6 - Setting and Reading the WM_HINTS Property
1067 ! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
1069 : USPosition ( -- n ) 0 2^ ; inline
1070 : USSize ( -- n ) 1 2^ ; inline
1071 : PPosition ( -- n ) 2 2^ ; inline
1072 : PSize ( -- n ) 3 2^ ; inline
1073 : PMinSize ( -- n ) 4 2^ ; inline
1074 : PMaxSize ( -- n ) 5 2^ ; inline
1075 : PResizeInc ( -- n ) 6 2^ ; inline
1076 : PAspect ( -- n ) 7 2^ ; inline
1077 : PBaseSize ( -- n ) 8 2^ ; inline
1078 : PWinGravity ( -- n ) 9 2^ ; inline
1080 flags{ PPosition PSize PMinSize PMaxSize PResizeInc PAspect }
1094 { min_aspect_x int }
1095 { min_aspect_y int }
1096 { max_aspect_x int }
1097 { max_aspect_y int }
1100 { win_gravity int } ;
1102 ! 14.1.10. Setting and Reading the WM_PROTOCOLS Property
1104 X-FUNCTION: Status XSetWMProtocols (
1105 Display* display, Window w, Atom* protocols, int count )
1107 X-FUNCTION: Status XGetWMProtocols (
1110 Atom** protocols_return,
1113 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1114 ! 16 - Application Utility Functions
1115 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1117 ! 16.1 Keyboard Utility Functions
1119 X-FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index )
1121 X-FUNCTION: int XLookupString (
1122 XKeyEvent* event_struct,
1123 void* buffer_return,
1125 KeySym* keysym_return,
1126 XComposeStatus* status_in_out
1129 ! 16.7 Determining the Appropriate Visual Type
1131 CONSTANT: VisualNoMask 0x0
1132 CONSTANT: VisualIDMask 0x1
1133 CONSTANT: VisualScreenMask 0x2
1134 CONSTANT: VisualDepthMask 0x4
1135 CONSTANT: VisualClassMask 0x8
1136 CONSTANT: VisualRedMaskMask 0x10
1137 CONSTANT: VisualGreenMaskMask 0x20
1138 CONSTANT: VisualBlueMaskMask 0x40
1139 CONSTANT: VisualColormapSizeMask 0x80
1140 CONSTANT: VisualBitsPerRGBMask 0x100
1141 CONSTANT: VisualAllMask 0x1FF
1145 { visualid VisualID }
1150 { green_mask ulong }
1152 { colormap_size int }
1153 { bits_per_rgb int } ;
1155 ! 16.9 Manipulating Bitmaps
1156 X-FUNCTION: Pixmap XCreateBitmapFromData (
1163 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1164 ! Appendix C - Extensions
1165 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1166 X-FUNCTION: Bool XQueryExtension (
1169 int* major_opcode_return,
1170 int* first_event_return,
1171 int* first_error_return
1174 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1175 ! Appendix D - Compatibility Functions
1176 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1178 X-FUNCTION: Status XSetStandardProperties (
1181 c-string window_name,
1189 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1191 CONSTANT: XA_PRIMARY 1
1192 CONSTANT: XA_SECONDARY 2
1195 CONSTANT: XA_BITMAP 5
1196 CONSTANT: XA_CARDINAL 6
1197 CONSTANT: XA_COLORMAP 7
1198 CONSTANT: XA_CURSOR 8
1199 CONSTANT: XA_CUT_BUFFER0 9
1200 CONSTANT: XA_CUT_BUFFER1 10
1201 CONSTANT: XA_CUT_BUFFER2 11
1202 CONSTANT: XA_CUT_BUFFER3 12
1203 CONSTANT: XA_CUT_BUFFER4 13
1204 CONSTANT: XA_CUT_BUFFER5 14
1205 CONSTANT: XA_CUT_BUFFER6 15
1206 CONSTANT: XA_CUT_BUFFER7 16
1207 CONSTANT: XA_DRAWABLE 17
1208 CONSTANT: XA_FONT 18
1209 CONSTANT: XA_INTEGER 19
1210 CONSTANT: XA_PIXMAP 20
1211 CONSTANT: XA_POINT 21
1212 CONSTANT: XA_RECTANGLE 22
1213 CONSTANT: XA_RESOURCE_MANAGER 23
1214 CONSTANT: XA_RGB_COLOR_MAP 24
1215 CONSTANT: XA_RGB_BEST_MAP 25
1216 CONSTANT: XA_RGB_BLUE_MAP 26
1217 CONSTANT: XA_RGB_DEFAULT_MAP 27
1218 CONSTANT: XA_RGB_GRAY_MAP 28
1219 CONSTANT: XA_RGB_GREEN_MAP 29
1220 CONSTANT: XA_RGB_RED_MAP 30
1221 CONSTANT: XA_STRING 31
1222 CONSTANT: XA_VISUALID 32
1223 CONSTANT: XA_WINDOW 33
1224 CONSTANT: XA_WM_COMMAND 34
1225 CONSTANT: XA_WM_HINTS 35
1226 CONSTANT: XA_WM_CLIENT_MACHINE 36
1227 CONSTANT: XA_WM_ICON_NAME 37
1228 CONSTANT: XA_WM_ICON_SIZE 38
1229 CONSTANT: XA_WM_NAME 39
1230 CONSTANT: XA_WM_NORMAL_HINTS 40
1231 CONSTANT: XA_WM_SIZE_HINTS 41
1232 CONSTANT: XA_WM_ZOOM_HINTS 42
1233 CONSTANT: XA_MIN_SPACE 43
1234 CONSTANT: XA_NORM_SPACE 44
1235 CONSTANT: XA_MAX_SPACE 45
1236 CONSTANT: XA_END_SPACE 46
1237 CONSTANT: XA_SUPERSCRIPT_X 47
1238 CONSTANT: XA_SUPERSCRIPT_Y 48
1239 CONSTANT: XA_SUBSCRIPT_X 49
1240 CONSTANT: XA_SUBSCRIPT_Y 50
1241 CONSTANT: XA_UNDERLINE_POSITION 51
1242 CONSTANT: XA_UNDERLINE_THICKNESS 52
1243 CONSTANT: XA_STRIKEOUT_ASCENT 53
1244 CONSTANT: XA_STRIKEOUT_DESCENT 54
1245 CONSTANT: XA_ITALIC_ANGLE 55
1246 CONSTANT: XA_X_HEIGHT 56
1247 CONSTANT: XA_QUAD_WIDTH 57
1248 CONSTANT: XA_WEIGHT 58
1249 CONSTANT: XA_POINT_SIZE 59
1250 CONSTANT: XA_RESOLUTION 60
1251 CONSTANT: XA_COPYRIGHT 61
1252 CONSTANT: XA_NOTICE 62
1253 CONSTANT: XA_FONT_NAME 63
1254 CONSTANT: XA_FAMILY_NAME 64
1255 CONSTANT: XA_FULL_NAME 65
1256 CONSTANT: XA_CAP_HEIGHT 66
1257 CONSTANT: XA_WM_CLASS 67
1258 CONSTANT: XA_WM_TRANSIENT_FOR 68
1260 CONSTANT: XA_LAST_PREDEFINED 68
1262 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1263 ! The rest of the stuff is not from the book.
1264 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1266 X-FUNCTION: void XFree ( void* data )
1267 X-FUNCTION: int XStoreName ( Display* display, Window w, c-string window_name )
1268 X-FUNCTION: void XSetWMNormalHints ( Display* display,
1271 X-FUNCTION: int XBell ( Display* display, int percent )
1275 CONSTANT: XIMPreeditArea 0x0001
1276 CONSTANT: XIMPreeditCallbacks 0x0002
1277 CONSTANT: XIMPreeditPosition 0x0004
1278 CONSTANT: XIMPreeditNothing 0x0008
1279 CONSTANT: XIMPreeditNone 0x0010
1280 CONSTANT: XIMStatusArea 0x0100
1281 CONSTANT: XIMStatusCallbacks 0x0200
1282 CONSTANT: XIMStatusNothing 0x0400
1283 CONSTANT: XIMStatusNone 0x0800
1285 CONSTANT: XNVaNestedList "XNVaNestedList"
1286 CONSTANT: XNQueryInputStyle "queryInputStyle"
1287 CONSTANT: XNClientWindow "clientWindow"
1288 CONSTANT: XNInputStyle "inputStyle"
1289 CONSTANT: XNFocusWindow "focusWindow"
1290 CONSTANT: XNResourceName "resourceName"
1291 CONSTANT: XNResourceClass "resourceClass"
1292 CONSTANT: XNGeometryCallback "geometryCallback"
1293 CONSTANT: XNDestroyCallback "destroyCallback"
1294 CONSTANT: XNFilterEvents "filterEvents"
1295 CONSTANT: XNPreeditStartCallback "preeditStartCallback"
1296 CONSTANT: XNPreeditDoneCallback "preeditDoneCallback"
1297 CONSTANT: XNPreeditDrawCallback "preeditDrawCallback"
1298 CONSTANT: XNPreeditCaretCallback "preeditCaretCallback"
1299 CONSTANT: XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
1300 CONSTANT: XNPreeditAttributes "preeditAttributes"
1301 CONSTANT: XNStatusStartCallback "statusStartCallback"
1302 CONSTANT: XNStatusDoneCallback "statusDoneCallback"
1303 CONSTANT: XNStatusDrawCallback "statusDrawCallback"
1304 CONSTANT: XNStatusAttributes "statusAttributes"
1305 CONSTANT: XNArea "area"
1306 CONSTANT: XNAreaNeeded "areaNeeded"
1307 CONSTANT: XNSpotLocation "spotLocation"
1308 CONSTANT: XNColormap "colorMap"
1309 CONSTANT: XNStdColormap "stdColorMap"
1310 CONSTANT: XNForeground "foreground"
1311 CONSTANT: XNBackground "background"
1312 CONSTANT: XNBackgroundPixmap "backgroundPixmap"
1313 CONSTANT: XNFontSet "fontSet"
1314 CONSTANT: XNLineSpace "lineSpace"
1315 CONSTANT: XNCursor "cursor"
1317 CONSTANT: XNQueryIMValuesList "queryIMValuesList"
1318 CONSTANT: XNQueryICValuesList "queryICValuesList"
1319 CONSTANT: XNVisiblePosition "visiblePosition"
1320 CONSTANT: XNR6PreeditCallback "r6PreeditCallback"
1321 CONSTANT: XNStringConversionCallback "stringConversionCallback"
1322 CONSTANT: XNStringConversion "stringConversion"
1323 CONSTANT: XNResetState "resetState"
1324 CONSTANT: XNHotKey "hotKey"
1325 CONSTANT: XNHotKeyState "hotKeyState"
1326 CONSTANT: XNPreeditState "preeditState"
1327 CONSTANT: XNSeparatorofNestedList "separatorofNestedList"
1329 CONSTANT: XBufferOverflow -1
1330 CONSTANT: XLookupNone 1
1331 CONSTANT: XLookupChars 2
1332 CONSTANT: XLookupKeySym 3
1333 CONSTANT: XLookupBoth 4
1335 X-FUNCTION: Bool XFilterEvent ( XEvent* event, Window w )
1337 X-FUNCTION: XIM XOpenIM ( Display* dpy,
1340 c-string res_class )
1342 X-FUNCTION: Status XCloseIM ( XIM im )
1344 X-FUNCTION: XIC XCreateIC ( XIM im,
1345 c-string key1, Window value1,
1346 c-string key2, Window value2,
1347 c-string key3, int value3,
1348 c-string key4, c-string value4,
1349 c-string key5, c-string value5,
1352 X-FUNCTION: void XDestroyIC ( XIC ic )
1354 X-FUNCTION: void XSetICFocus ( XIC ic )
1356 X-FUNCTION: void XUnsetICFocus ( XIC ic )
1358 X-FUNCTION: int XwcLookupString ( XIC ic,
1359 XKeyPressedEvent* event,
1360 ulong* buffer_return,
1362 KeySym* keysym_return,
1363 Status* status_return )
1365 X-FUNCTION: int Xutf8LookupString ( XIC ic,
1366 XKeyPressedEvent* event,
1367 c-string buffer_return,
1369 KeySym* keysym_return,
1370 Status* status_return )
1372 ! !!! category of setlocale
1374 CONSTANT: LC_COLLATE 1
1375 CONSTANT: LC_CTYPE 2
1376 CONSTANT: LC_MONETARY 3
1377 CONSTANT: LC_NUMERIC 4
1380 X-FUNCTION: c-string setlocale ( int category, c-string name )
1382 X-FUNCTION: Bool XSupportsLocale ( )
1384 X-FUNCTION: c-string XSetLocaleModifiers ( c-string modifier_list )
1386 ! uncategorized xlib bindings
1388 X-FUNCTION: int XQueryKeymap ( Display* display, char[32] keys_return )