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 ;
21 TYPEDEF: c-string XPointer
27 C-TYPE: XComposeStatus
35 TYPEDEF: ulong VisualID
38 : *XID ( bytes -- n ) ulong deref ;
42 : *Atom ( bytes -- n ) ulong deref ;
44 ! 2 - Display Functions
47 ! This struct is incomplete
53 X-FUNCTION: Display* XOpenDisplay ( c-string[ascii] display_name )
55 ! 2.2 Obtaining Information about the Display, Image Formats, or Screens
57 X-FUNCTION: ulong XBlackPixel ( Display* display, int screen_number )
58 X-FUNCTION: ulong XWhitePixel ( Display* display, int screen_number )
59 X-FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number )
60 X-FUNCTION: int XDefaultDepth ( Display* display, int screen_number )
61 X-FUNCTION: GC XDefaultGC ( Display* display, int screen_number )
62 X-FUNCTION: int XDefaultScreen ( Display* display )
63 X-FUNCTION: Window XRootWindow ( Display* display, int screen_number )
64 X-FUNCTION: Window XDefaultRootWindow ( Display* display )
65 X-FUNCTION: int XProtocolVersion ( Display* display )
66 X-FUNCTION: int XProtocolRevision ( Display* display )
67 X-FUNCTION: int XQLength ( Display* display )
68 X-FUNCTION: int XScreenCount ( Display* display )
69 X-FUNCTION: int XConnectionNumber ( Display* display )
71 ! 2.5 Closing the Display
72 X-FUNCTION: int XCloseDisplay ( Display* display )
75 ! 3 - Window Functions
78 ! 3.2 - Window Attributes
80 : CWBackPixmap ( -- n ) 0 2^ ; inline
81 : CWBackPixel ( -- n ) 1 2^ ; inline
82 : CWBorderPixmap ( -- n ) 2 2^ ; inline
83 : CWBorderPixel ( -- n ) 3 2^ ; inline
84 : CWBitGravity ( -- n ) 4 2^ ; inline
85 : CWWinGravity ( -- n ) 5 2^ ; inline
86 : CWBackingStore ( -- n ) 6 2^ ; inline
87 : CWBackingPlanes ( -- n ) 7 2^ ; inline
88 : CWBackingPixel ( -- n ) 8 2^ ; inline
89 : CWOverrideRedirect ( -- n ) 9 2^ ; inline
90 : CWSaveUnder ( -- n ) 10 2^ ; inline
91 : CWEventMask ( -- n ) 11 2^ ; inline
92 : CWDontPropagate ( -- n ) 12 2^ ; inline
93 : CWColormap ( -- n ) 13 2^ ; inline
94 : CWCursor ( -- n ) 14 2^ ; inline
96 STRUCT: XSetWindowAttributes
97 { background_pixmap Pixmap }
98 { background_pixel ulong }
99 { border_pixmap Pixmap }
100 { border_pixel ulong }
103 { backing_store int }
104 { backing_planes ulong }
105 { backing_pixel ulong }
108 { do_not_propagate_mask long }
109 { override_redirect Bool }
110 { colormap Colormap }
113 ! 3.3 - Creating Windows
115 X-FUNCTION: Window XCreateWindow ( Display* display,
117 int x, int y, uint width, uint height,
118 uint border_width, int depth, uint class,
119 Visual* visual, ulong valuemask,
120 XSetWindowAttributes* attributes )
121 X-FUNCTION: Window XCreateSimpleWindow ( Display* display,
123 int x, int y, uint width, uint height,
124 uint border_width, ulong border,
126 X-FUNCTION: Status XDestroyWindow ( Display* display, Window w )
127 X-FUNCTION: Status XMapWindow ( Display* display, Window window )
128 X-FUNCTION: Status XMapSubwindows ( Display* display, Window window )
129 X-FUNCTION: Status XUnmapWindow ( Display* display, Window w )
130 X-FUNCTION: Status XUnmapSubwindows ( Display* display, Window w )
132 ! 3.5 Mapping Windows
134 X-FUNCTION: int XMapRaised ( Display* display, Window w )
136 ! 3.7 - Configuring Windows
138 STRUCT: XWindowChanges
147 X-FUNCTION: Status XConfigureWindow ( Display* display,
149 uint value_mask, XWindowChanges* values )
150 X-FUNCTION: Status XMoveWindow ( Display* display, Window w,
152 X-FUNCTION: Status XResizeWindow ( Display* display,
156 X-FUNCTION: Status XSetWindowBorderWidth ( Display* display,
161 ! 3.8 Changing Window Stacking Order
163 X-FUNCTION: Status XRaiseWindow ( Display* display, Window w )
164 X-FUNCTION: Status XLowerWindow ( Display* display, Window w )
166 ! 3.9 - Changing Window Attributes
168 X-FUNCTION: Status XChangeWindowAttributes ( Display* display,
171 XSetWindowAttributes* attr )
172 X-FUNCTION: Status XSetWindowBackground ( Display* display,
173 Window w, ulong background_pixel )
174 X-FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor )
175 X-FUNCTION: Status XUndefineCursor ( Display* display, Window w )
177 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
178 ! 4 - Window Information Functions
179 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
181 ! 4.1 - Obtaining Window Information
183 X-FUNCTION: Status XQueryTree ( Display* display,
186 Window* parent_return,
187 Window** children_return,
188 uint* nchildren_return )
190 STRUCT: XWindowAttributes
202 { backing_store int }
203 { backing_planes ulong }
204 { backing_pixel ulong }
206 { colormap Colormap }
207 { map_installed Bool }
209 { all_event_masks long }
210 { your_event_mask long }
211 { do_not_propagate_mask long }
212 { override_redirect Bool }
215 X-FUNCTION: Status XGetWindowAttributes ( Display* display,
217 XWindowAttributes* attr )
219 X-FUNCTION: Status XGetGeometry ( Display* display,
226 uint* border_width_return,
229 ! 4.2 - Translating Screen Coordinates
231 X-FUNCTION: Bool XQueryPointer ( Display* display,
233 Window* root_return, Window* child_return,
234 int* root_x_return, int* root_y_return,
235 int* win_x_return, int* win_y_return,
238 ! 4.3 - Properties and Atoms
240 X-FUNCTION: Atom XInternAtom ( Display* display,
242 Bool only_if_exists )
244 X-FUNCTION: c-string XGetAtomName ( Display* display, Atom atom )
246 ! 4.4 - Obtaining and Changing Window Properties
248 X-FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property,
249 long long_offset, long long_length,
250 Bool delete, Atom req_type,
251 Atom* actual_type_return,
252 int* actual_format_return,
253 ulong* nitems_return,
254 ulong* bytes_after_return,
255 c-string* prop_return )
257 X-FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property,
258 Atom type, int format,
259 int mode, void* data, int nelements )
263 X-FUNCTION: int XSetSelectionOwner ( Display* display,
268 X-FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection )
270 X-FUNCTION: int XConvertSelection ( Display* display,
278 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
279 ! 5 - Pixmap and Cursor Functions
280 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
282 ! 5.1 - Creating and Freeing Pixmaps
284 X-FUNCTION: Pixmap XCreatePixmap ( Display* display,
286 uint width, uint height, uint depth )
287 X-FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap )
289 ! 5.2 - Creating, Recoloring, and Freeing Cursors
292 X-FUNCTION: Cursor XCreatePixmapCursor ( Display* display,
293 Pixmap source, Pixmap mask,
294 XColor* foreground_color,
295 XColor* background_color,
297 X-FUNCTION: int XFreeCursor ( Display* display, Cursor cursor )
299 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
300 ! 6 - Color Management Functions
301 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
311 X-FUNCTION: Status XLookupColor ( Display* display,
314 XColor* exact_def_return,
315 XColor* screen_def_return )
316 X-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out )
317 X-FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out )
319 ! 6.4 Creating, Copying, and Destroying Colormaps
321 X-FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc )
323 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
324 ! 7 - Graphics Context Functions
325 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
344 { subwindow_mode int }
345 { graphics_exposures Bool }
346 { clip_x_origin int }
347 { clip_y_origin int }
352 X-FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values )
353 X-FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values )
354 X-FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return )
355 X-FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground )
356 X-FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background )
357 X-FUNCTION: Status XSetFunction ( Display* display, GC gc, int function )
358 X-FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode )
360 X-FUNCTION: GContext XGContextFromGC ( GC gc )
362 X-FUNCTION: Status XSetFont ( Display* display, GC gc, Font font )
364 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
365 ! 8 - Graphics Functions
366 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
368 X-FUNCTION: Status XClearWindow ( Display* display, Window w )
369 X-FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y )
370 X-FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 )
371 X-FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 )
372 X-FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 )
382 { attributes ushort } ;
385 { ext_data XExtData* }
388 { min_char_or_byte2 uint }
389 { max_char_or_byte2 uint }
392 { all_chars_exist Bool }
393 { default_char uint }
395 { properties XFontProp* }
396 { min_bounds XCharStruct }
397 { max_bounds XCharStruct }
398 { per_char XCharStruct* }
402 X-FUNCTION: Font XLoadFont ( Display* display, c-string name )
403 X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID )
404 X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, c-string name )
406 X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, c-string string, int count )
410 X-FUNCTION: Status XDrawString (
419 ! 8.7 - Transferring Images between Client and Server
421 CONSTANT: AllPlanes -1
424 { create_image void* }
425 { destroy_image void* }
429 { add_pixel void* } ;
439 { bitmap_bit_order int }
442 { bytes_per_line int }
443 { bits_per_pixel int }
450 X-FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format )
451 X-FUNCTION: int XDestroyImage ( XImage* ximage )
453 : XImage-size ( ximage -- size )
454 [ height>> ] [ bytes_per_line>> ] bi * ;
456 : XImage-pixels ( ximage -- byte-array )
457 [ data>> ] [ XImage-size ] bi memory>byte-array ;
460 ! 9 - Window and Session Manager Functions
463 X-FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y )
464 X-FUNCTION: Status XAddToSaveSet ( Display* display, Window w )
465 X-FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w )
466 X-FUNCTION: Status XGrabServer ( Display* display )
467 X-FUNCTION: Status XUngrabServer ( Display* display )
468 X-FUNCTION: Status XKillClient ( Display* display, XID resource )
470 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
472 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
483 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
485 ! 10.5 Keyboard and Pointer Events
502 { same_screen Bool } ;
504 TYPEDEF: XButtonEvent XButtonPressedEvent
505 TYPEDEF: XButtonEvent XButtonReleasedEvent
508 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
525 { same_screen Bool } ;
527 TYPEDEF: XKeyEvent XKeyPressedEvent
528 TYPEDEF: XKeyEvent XKeyReleasedEvent
530 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
547 { same_screen Bool } ;
549 TYPEDEF: XMotionEvent XPointerMovedEvent
551 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
553 STRUCT: XCrossingEvent
572 TYPEDEF: XCrossingEvent XEnterWindowEvent
573 TYPEDEF: XCrossingEvent XLeaveWindowEvent
575 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
577 STRUCT: XFocusChangeEvent
586 TYPEDEF: XFocusChangeEvent XFocusInEvent
587 TYPEDEF: XFocusChangeEvent XFocusOutEvent
589 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
603 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
605 STRUCT: XGraphicsExposeEvent
610 { drawable Drawable }
619 STRUCT: XNoExposeEvent
624 { drawable Drawable }
628 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
630 STRUCT: XVisibilityEvent
638 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
640 STRUCT: XCreateWindowEvent
652 { override_redirect Bool } ;
654 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
656 STRUCT: XDestroyWindowEvent
664 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
673 { from_configure Bool } ;
675 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
684 { override_redirect Bool } ;
686 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
688 STRUCT: XMapRequestEvent
696 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
698 STRUCT: XReparentEvent
708 { override_redirect Bool } ;
710 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
712 STRUCT: XConfigureEvent
725 { override_redirect Bool } ;
727 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
729 STRUCT: XGravityEvent
739 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
741 STRUCT: XResizeRequestEvent
750 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
752 STRUCT: XConfigureRequestEvent
766 { value_mask ulong } ;
768 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
770 STRUCT: XCirculateEvent
779 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
781 STRUCT: XCirculateRequestEvent
790 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
792 STRUCT: XPropertyEvent
802 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
804 STRUCT: XSelectionClearEvent
813 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
815 STRUCT: XSelectionRequestEvent
827 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
829 STRUCT: XSelectionEvent
840 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
842 STRUCT: XColormapEvent
848 { colormap Colormap }
852 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
854 STRUCT: XClientMessageEvent
860 { message_type Atom }
868 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
870 STRUCT: XMappingEvent
877 { first_keycode int }
880 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
888 { request_code uchar }
889 { minor_code uchar } ;
891 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
901 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
903 ! Newer things, needed for XInput2 support. Not in the book.
905 ! GenericEvent is the standard event for all newer extensions.
906 STRUCT: XGenericEvent
914 STRUCT: XGenericEventCookie
924 X-FUNCTION: Bool XGetEventData ( Display* dpy, XGenericEventCookie* cookie )
925 X-FUNCTION: void XFreeEventData ( Display* dpy, XGenericEventCookie* cookie )
927 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
931 { XAnyEvent XAnyEvent }
932 { XKeyEvent XKeyEvent }
933 { XButtonEvent XButtonEvent }
934 { XMotionEvent XMotionEvent }
935 { XCrossingEvent XCrossingEvent }
936 { XFocusChangeEvent XFocusChangeEvent }
937 { XExposeEvent XExposeEvent }
938 { XGraphicsExposeEvent XGraphicsExposeEvent }
939 { XNoExposeEvent XNoExposeEvent }
940 { XVisibilityEvent XVisibilityEvent }
941 { XCreateWindowEvent XCreateWindowEvent }
942 { XDestroyWindowEvent XDestroyWindowEvent }
943 { XUnmapEvent XUnmapEvent }
944 { XMapEvent XMapEvent }
945 { XMapRequestEvent XMapRequestEvent }
946 { XReparentEvent XReparentEvent }
947 { XConfigureEvent XConfigureEvent }
948 { XGravityEvent XGravityEvent }
949 { XResizeRequestEvent XResizeRequestEvent }
950 { XConfigureRequestEvent XConfigureRequestEvent }
951 { XCirculateEvent XCirculateEvent }
952 { XCirculateRequestEvent XCirculateRequestEvent }
953 { XPropertyEvent XPropertyEvent }
954 { XSelectionClearEvent XSelectionClearEvent }
955 { XSelectionRequestEvent XSelectionRequestEvent }
956 { XSelectionEvent XSelectionEvent }
957 { XColormapEvent XColormapEvent }
958 { XClientMessageEvent XClientMessageEvent }
959 { XMappingEvent XMappingEvent }
960 { XErrorEvent XErrorEvent }
961 { XKeymapEvent XKeymapEvent }
962 { XGenericEvent XGenericEvent }
963 { XGenericEventCookie XGenericEventCookie }
964 { padding long[24] } ;
966 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
967 ! 11 - Event Handling Functions
968 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
970 X-FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask )
971 X-FUNCTION: Status XFlush ( Display* display )
972 X-FUNCTION: Status XSync ( Display* display, int discard )
973 X-FUNCTION: Status XNextEvent ( Display* display, XEvent* event )
974 X-FUNCTION: Status XMaskEvent ( Display* display,
976 XEvent* event_return )
978 ! 11.3 - Event Queue Management
980 CONSTANT: QueuedAlready 0
981 CONSTANT: QueuedAfterReading 1
982 CONSTANT: QueuedAfterFlush 2
984 X-FUNCTION: int XEventsQueued ( Display* display, int mode )
985 X-FUNCTION: int XPending ( Display* display )
987 ! 11.6 - Sending Events to Other Applications
989 X-FUNCTION: Status XSendEvent ( Display* display,
995 ! 11.8 - Handling Protocol Errors
997 X-FUNCTION: int XSetErrorHandler ( void* handler )
999 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1000 ! 12 - Input Device Functions
1001 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1002 X-FUNCTION: int XGrabPointer (
1014 X-FUNCTION: Status XUngrabPointer ( Display* display, Time time )
1015 X-FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time )
1016 X-FUNCTION: Status XGrabKey (
1017 Display* display, int keycode, uint modifiers,
1018 Window grab_window, Bool owner_events,
1019 int pointer_mode, int keyboard_mode
1021 X-FUNCTION: int XGrabKeyboard (
1022 Display* display, Window grab_window,
1024 int pointer_mode, int keyboard_mode, Time time
1026 X-FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time )
1028 X-FUNCTION: Status XGetInputFocus (
1030 Window* focus_return,
1031 int* revert_to_return
1034 X-FUNCTION: Status XWarpPointer (
1036 Window src_w, Window dest_w,
1037 int src_x, int src_y, uint src_width, uint src_height,
1038 int dest_x, int dest_y
1041 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1042 ! 14 - Inter-Client Communication Functions
1043 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1045 ! 14.1 Client to Window Manager Communication
1047 X-FUNCTION: Status XFetchName ( Display* display, Window w, c-string* window_name_return )
1048 X-FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return )
1050 ! 14.1.1. Manipulating Top-Level Windows
1052 X-FUNCTION: Status XIconifyWindow (
1058 X-FUNCTION: Status XWithdrawWindow (
1064 ! 14.1.6 - Setting and Reading the WM_HINTS Property
1066 ! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
1068 : USPosition ( -- n ) 0 2^ ; inline
1069 : USSize ( -- n ) 1 2^ ; inline
1070 : PPosition ( -- n ) 2 2^ ; inline
1071 : PSize ( -- n ) 3 2^ ; inline
1072 : PMinSize ( -- n ) 4 2^ ; inline
1073 : PMaxSize ( -- n ) 5 2^ ; inline
1074 : PResizeInc ( -- n ) 6 2^ ; inline
1075 : PAspect ( -- n ) 7 2^ ; inline
1076 : PBaseSize ( -- n ) 8 2^ ; inline
1077 : PWinGravity ( -- n ) 9 2^ ; inline
1079 flags{ PPosition PSize PMinSize PMaxSize PResizeInc PAspect }
1093 { min_aspect_x int }
1094 { min_aspect_y int }
1095 { max_aspect_x int }
1096 { max_aspect_y int }
1099 { win_gravity int } ;
1101 ! 14.1.10. Setting and Reading the WM_PROTOCOLS Property
1103 X-FUNCTION: Status XSetWMProtocols (
1104 Display* display, Window w, Atom* protocols, int count )
1106 X-FUNCTION: Status XGetWMProtocols (
1109 Atom** protocols_return,
1112 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1113 ! 16 - Application Utility Functions
1114 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1116 ! 16.1 Keyboard Utility Functions
1118 X-FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index )
1120 X-FUNCTION: int XLookupString (
1121 XKeyEvent* event_struct,
1122 void* buffer_return,
1124 KeySym* keysym_return,
1125 XComposeStatus* status_in_out
1128 ! 16.7 Determining the Appropriate Visual Type
1130 CONSTANT: VisualNoMask 0x0
1131 CONSTANT: VisualIDMask 0x1
1132 CONSTANT: VisualScreenMask 0x2
1133 CONSTANT: VisualDepthMask 0x4
1134 CONSTANT: VisualClassMask 0x8
1135 CONSTANT: VisualRedMaskMask 0x10
1136 CONSTANT: VisualGreenMaskMask 0x20
1137 CONSTANT: VisualBlueMaskMask 0x40
1138 CONSTANT: VisualColormapSizeMask 0x80
1139 CONSTANT: VisualBitsPerRGBMask 0x100
1140 CONSTANT: VisualAllMask 0x1FF
1144 { visualid VisualID }
1149 { green_mask ulong }
1151 { colormap_size int }
1152 { bits_per_rgb int } ;
1154 ! 16.9 Manipulating Bitmaps
1155 X-FUNCTION: Pixmap XCreateBitmapFromData (
1162 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1163 ! Appendix C - Extensions
1164 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1165 X-FUNCTION: Bool XQueryExtension (
1168 int* major_opcode_return,
1169 int* first_event_return,
1170 int* first_error_return
1173 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1174 ! Appendix D - Compatibility Functions
1175 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1177 X-FUNCTION: Status XSetStandardProperties (
1180 c-string window_name,
1188 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1190 CONSTANT: XA_PRIMARY 1
1191 CONSTANT: XA_SECONDARY 2
1194 CONSTANT: XA_BITMAP 5
1195 CONSTANT: XA_CARDINAL 6
1196 CONSTANT: XA_COLORMAP 7
1197 CONSTANT: XA_CURSOR 8
1198 CONSTANT: XA_CUT_BUFFER0 9
1199 CONSTANT: XA_CUT_BUFFER1 10
1200 CONSTANT: XA_CUT_BUFFER2 11
1201 CONSTANT: XA_CUT_BUFFER3 12
1202 CONSTANT: XA_CUT_BUFFER4 13
1203 CONSTANT: XA_CUT_BUFFER5 14
1204 CONSTANT: XA_CUT_BUFFER6 15
1205 CONSTANT: XA_CUT_BUFFER7 16
1206 CONSTANT: XA_DRAWABLE 17
1207 CONSTANT: XA_FONT 18
1208 CONSTANT: XA_INTEGER 19
1209 CONSTANT: XA_PIXMAP 20
1210 CONSTANT: XA_POINT 21
1211 CONSTANT: XA_RECTANGLE 22
1212 CONSTANT: XA_RESOURCE_MANAGER 23
1213 CONSTANT: XA_RGB_COLOR_MAP 24
1214 CONSTANT: XA_RGB_BEST_MAP 25
1215 CONSTANT: XA_RGB_BLUE_MAP 26
1216 CONSTANT: XA_RGB_DEFAULT_MAP 27
1217 CONSTANT: XA_RGB_GRAY_MAP 28
1218 CONSTANT: XA_RGB_GREEN_MAP 29
1219 CONSTANT: XA_RGB_RED_MAP 30
1220 CONSTANT: XA_STRING 31
1221 CONSTANT: XA_VISUALID 32
1222 CONSTANT: XA_WINDOW 33
1223 CONSTANT: XA_WM_COMMAND 34
1224 CONSTANT: XA_WM_HINTS 35
1225 CONSTANT: XA_WM_CLIENT_MACHINE 36
1226 CONSTANT: XA_WM_ICON_NAME 37
1227 CONSTANT: XA_WM_ICON_SIZE 38
1228 CONSTANT: XA_WM_NAME 39
1229 CONSTANT: XA_WM_NORMAL_HINTS 40
1230 CONSTANT: XA_WM_SIZE_HINTS 41
1231 CONSTANT: XA_WM_ZOOM_HINTS 42
1232 CONSTANT: XA_MIN_SPACE 43
1233 CONSTANT: XA_NORM_SPACE 44
1234 CONSTANT: XA_MAX_SPACE 45
1235 CONSTANT: XA_END_SPACE 46
1236 CONSTANT: XA_SUPERSCRIPT_X 47
1237 CONSTANT: XA_SUPERSCRIPT_Y 48
1238 CONSTANT: XA_SUBSCRIPT_X 49
1239 CONSTANT: XA_SUBSCRIPT_Y 50
1240 CONSTANT: XA_UNDERLINE_POSITION 51
1241 CONSTANT: XA_UNDERLINE_THICKNESS 52
1242 CONSTANT: XA_STRIKEOUT_ASCENT 53
1243 CONSTANT: XA_STRIKEOUT_DESCENT 54
1244 CONSTANT: XA_ITALIC_ANGLE 55
1245 CONSTANT: XA_X_HEIGHT 56
1246 CONSTANT: XA_QUAD_WIDTH 57
1247 CONSTANT: XA_WEIGHT 58
1248 CONSTANT: XA_POINT_SIZE 59
1249 CONSTANT: XA_RESOLUTION 60
1250 CONSTANT: XA_COPYRIGHT 61
1251 CONSTANT: XA_NOTICE 62
1252 CONSTANT: XA_FONT_NAME 63
1253 CONSTANT: XA_FAMILY_NAME 64
1254 CONSTANT: XA_FULL_NAME 65
1255 CONSTANT: XA_CAP_HEIGHT 66
1256 CONSTANT: XA_WM_CLASS 67
1257 CONSTANT: XA_WM_TRANSIENT_FOR 68
1259 CONSTANT: XA_LAST_PREDEFINED 68
1261 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1262 ! The rest of the stuff is not from the book.
1263 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1265 X-FUNCTION: void XFree ( void* data )
1266 X-FUNCTION: int XStoreName ( Display* display, Window w, c-string window_name )
1267 X-FUNCTION: void XSetWMNormalHints ( Display* display,
1270 X-FUNCTION: int XBell ( Display* display, int percent )
1274 CONSTANT: XIMPreeditArea 0x0001
1275 CONSTANT: XIMPreeditCallbacks 0x0002
1276 CONSTANT: XIMPreeditPosition 0x0004
1277 CONSTANT: XIMPreeditNothing 0x0008
1278 CONSTANT: XIMPreeditNone 0x0010
1279 CONSTANT: XIMStatusArea 0x0100
1280 CONSTANT: XIMStatusCallbacks 0x0200
1281 CONSTANT: XIMStatusNothing 0x0400
1282 CONSTANT: XIMStatusNone 0x0800
1284 CONSTANT: XNVaNestedList "XNVaNestedList"
1285 CONSTANT: XNQueryInputStyle "queryInputStyle"
1286 CONSTANT: XNClientWindow "clientWindow"
1287 CONSTANT: XNInputStyle "inputStyle"
1288 CONSTANT: XNFocusWindow "focusWindow"
1289 CONSTANT: XNResourceName "resourceName"
1290 CONSTANT: XNResourceClass "resourceClass"
1291 CONSTANT: XNGeometryCallback "geometryCallback"
1292 CONSTANT: XNDestroyCallback "destroyCallback"
1293 CONSTANT: XNFilterEvents "filterEvents"
1294 CONSTANT: XNPreeditStartCallback "preeditStartCallback"
1295 CONSTANT: XNPreeditDoneCallback "preeditDoneCallback"
1296 CONSTANT: XNPreeditDrawCallback "preeditDrawCallback"
1297 CONSTANT: XNPreeditCaretCallback "preeditCaretCallback"
1298 CONSTANT: XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
1299 CONSTANT: XNPreeditAttributes "preeditAttributes"
1300 CONSTANT: XNStatusStartCallback "statusStartCallback"
1301 CONSTANT: XNStatusDoneCallback "statusDoneCallback"
1302 CONSTANT: XNStatusDrawCallback "statusDrawCallback"
1303 CONSTANT: XNStatusAttributes "statusAttributes"
1304 CONSTANT: XNArea "area"
1305 CONSTANT: XNAreaNeeded "areaNeeded"
1306 CONSTANT: XNSpotLocation "spotLocation"
1307 CONSTANT: XNColormap "colorMap"
1308 CONSTANT: XNStdColormap "stdColorMap"
1309 CONSTANT: XNForeground "foreground"
1310 CONSTANT: XNBackground "background"
1311 CONSTANT: XNBackgroundPixmap "backgroundPixmap"
1312 CONSTANT: XNFontSet "fontSet"
1313 CONSTANT: XNLineSpace "lineSpace"
1314 CONSTANT: XNCursor "cursor"
1316 CONSTANT: XNQueryIMValuesList "queryIMValuesList"
1317 CONSTANT: XNQueryICValuesList "queryICValuesList"
1318 CONSTANT: XNVisiblePosition "visiblePosition"
1319 CONSTANT: XNR6PreeditCallback "r6PreeditCallback"
1320 CONSTANT: XNStringConversionCallback "stringConversionCallback"
1321 CONSTANT: XNStringConversion "stringConversion"
1322 CONSTANT: XNResetState "resetState"
1323 CONSTANT: XNHotKey "hotKey"
1324 CONSTANT: XNHotKeyState "hotKeyState"
1325 CONSTANT: XNPreeditState "preeditState"
1326 CONSTANT: XNSeparatorofNestedList "separatorofNestedList"
1328 CONSTANT: XBufferOverflow -1
1329 CONSTANT: XLookupNone 1
1330 CONSTANT: XLookupChars 2
1331 CONSTANT: XLookupKeySym 3
1332 CONSTANT: XLookupBoth 4
1334 X-FUNCTION: Bool XFilterEvent ( XEvent* event, Window w )
1336 X-FUNCTION: XIM XOpenIM ( Display* dpy,
1339 c-string res_class )
1341 X-FUNCTION: Status XCloseIM ( XIM im )
1343 X-FUNCTION: XIC XCreateIC ( XIM im,
1344 c-string key1, Window value1,
1345 c-string key2, Window value2,
1346 c-string key3, int value3,
1347 c-string key4, c-string value4,
1348 c-string key5, c-string value5,
1351 X-FUNCTION: void XDestroyIC ( XIC ic )
1353 X-FUNCTION: void XSetICFocus ( XIC ic )
1355 X-FUNCTION: void XUnsetICFocus ( XIC ic )
1357 X-FUNCTION: int XwcLookupString ( XIC ic,
1358 XKeyPressedEvent* event,
1359 ulong* buffer_return,
1361 KeySym* keysym_return,
1362 Status* status_return )
1364 X-FUNCTION: int Xutf8LookupString ( XIC ic,
1365 XKeyPressedEvent* event,
1366 c-string buffer_return,
1368 KeySym* keysym_return,
1369 Status* status_return )
1371 ! !!! category of setlocale
1373 CONSTANT: LC_COLLATE 1
1374 CONSTANT: LC_CTYPE 2
1375 CONSTANT: LC_MONETARY 3
1376 CONSTANT: LC_NUMERIC 4
1379 X-FUNCTION: c-string setlocale ( int category, c-string name )
1381 X-FUNCTION: Bool XSupportsLocale ( )
1383 X-FUNCTION: c-string XSetLocaleModifiers ( c-string modifier_list )
1385 ! uncategorized xlib bindings
1387 X-FUNCTION: int XQueryKeymap ( Display* display, char[32] keys_return )