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 alien.c-types alien.strings
15 alien.syntax math math.bitwise words sequences namespaces
16 continuations io.encodings.ascii ;
33 TYPEDEF: char* XPointer
34 TYPEDEF: void* Display*
35 TYPEDEF: void* Screen*
37 TYPEDEF: void* Visual*
38 TYPEDEF: void* XExtData*
39 TYPEDEF: void* XFontProp*
40 TYPEDEF: void* XComposeStatus*
48 TYPEDEF: ulong VisualID
51 TYPEDEF: void* Window**
54 : <XID> <ulong> ; inline
55 : <Window> <XID> ; inline
56 : <Drawable> <XID> ; inline
57 : <KeySym> <XID> ; inline
58 : <Atom> <ulong> ; inline
60 : *XID *ulong ; inline
61 : *Window *XID ; inline
62 : *Drawable *XID ; inline
63 : *KeySym *XID ; inline
64 : *Atom *ulong ; inline
66 ! 2 - Display Functions
69 FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
71 ! 2.2 Obtaining Information about the Display, Image Formats, or Screens
73 FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ;
74 FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ;
75 FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ;
76 FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ;
77 FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ;
78 FUNCTION: int XDefaultScreen ( Display* display ) ;
79 FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ;
80 FUNCTION: Window XDefaultRootWindow ( Display* display ) ;
81 FUNCTION: int XProtocolVersion ( Display* display ) ;
82 FUNCTION: int XProtocolRevision ( Display* display ) ;
83 FUNCTION: int XQLength ( Display* display ) ;
84 FUNCTION: int XScreenCount ( Display* display ) ;
85 FUNCTION: int XConnectionNumber ( Display* display ) ;
87 ! 2.5 Closing the Display
88 FUNCTION: int XCloseDisplay ( Display* display ) ;
91 ! 3 - Window Functions
94 ! 3.2 - Window Attributes
96 : CWBackPixmap 1 0 shift ; inline
97 : CWBackPixel 1 1 shift ; inline
98 : CWBorderPixmap 1 2 shift ; inline
99 : CWBorderPixel 1 3 shift ; inline
100 : CWBitGravity 1 4 shift ; inline
101 : CWWinGravity 1 5 shift ; inline
102 : CWBackingStore 1 6 shift ; inline
103 : CWBackingPlanes 1 7 shift ; inline
104 : CWBackingPixel 1 8 shift ; inline
105 : CWOverrideRedirect 1 9 shift ; inline
106 : CWSaveUnder 1 10 shift ; inline
107 : CWEventMask 1 11 shift ; inline
108 : CWDontPropagate 1 12 shift ; inline
109 : CWColormap 1 13 shift ; inline
110 : CWCursor 1 14 shift ; inline
112 C-STRUCT: XSetWindowAttributes
113 { "Pixmap" "background_pixmap" }
114 { "ulong" "background_pixel" }
115 { "Pixmap" "border_pixmap" }
116 { "ulong" "border_pixel" }
117 { "int" "bit_gravity" }
118 { "int" "win_gravity" }
119 { "int" "backing_store" }
120 { "ulong" "backing_planes" }
121 { "ulong" "backing_pixel" }
122 { "Bool" "save_under" }
123 { "long" "event_mask" }
124 { "long" "do_not_propagate_mask" }
125 { "Bool" "override_redirect" }
126 { "Colormap" "colormap" }
127 { "Cursor" "cursor" } ;
129 : UnmapGravity 0 ; inline
131 : ForgetGravity 0 ; inline
132 : NorthWestGravity 1 ; inline
133 : NorthGravity 2 ; inline
134 : NorthEastGravity 3 ; inline
135 : WestGravity 4 ; inline
136 : CenterGravity 5 ; inline
137 : EastGravity 6 ; inline
138 : SouthWestGravity 7 ; inline
139 : SouthGravity 8 ; inline
140 : SouthEastGravity 9 ; inline
141 : StaticGravity 10 ; inline
143 ! 3.3 - Creating Windows
145 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 ) ;
146 FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
147 FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
148 FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
149 FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
150 FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
151 FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
153 ! 3.5 Mapping Windows
155 FUNCTION: int XMapRaised ( Display* display, Window w ) ;
157 ! 3.7 - Configuring Windows
159 : CWX 1 0 shift ; inline
160 : CWY 1 1 shift ; inline
161 : CWWidth 1 2 shift ; inline
162 : CWHeight 1 3 shift ; inline
163 : CWBorderWidth 1 4 shift ; inline
164 : CWSibling 1 5 shift ; inline
165 : CWStackMode 1 6 shift ; inline
167 C-STRUCT: XWindowChanges
172 { "int" "border_width" }
173 { "Window" "sibling" }
174 { "int" "stack_mode" } ;
176 FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
177 FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
178 FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ;
179 FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ;
182 ! 3.8 Changing Window Stacking Order
184 FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ;
185 FUNCTION: Status XLowerWindow ( Display* display, Window w ) ;
187 ! 3.9 - Changing Window Attributes
189 FUNCTION: Status XChangeWindowAttributes (
190 Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ;
191 FUNCTION: Status XSetWindowBackground (
192 Display* display, Window w, ulong background_pixel ) ;
193 FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ;
194 FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
196 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
197 ! 4 - Window Information Functions
198 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
200 ! 4.1 - Obtaining Window Information
202 FUNCTION: Status XQueryTree (
206 Window* parent_return,
207 Window** children_return, uint* nchildren_return ) ;
209 C-STRUCT: XWindowAttributes
214 { "int" "border_width" }
216 { "Visual*" "visual" }
219 { "int" "bit_gravity" }
220 { "int" "win_gravity" }
221 { "int" "backing_store" }
222 { "ulong" "backing_planes" }
223 { "ulong" "backing_pixel" }
224 { "Bool" "save_under" }
225 { "Colormap" "colormap" }
226 { "Bool" "map_installed" }
227 { "int" "map_state" }
228 { "long" "all_event_masks" }
229 { "long" "your_event_mask" }
230 { "long" "do_not_propagate_mask" }
231 { "Bool" "override_redirect" }
232 { "Screen*" "screen" } ;
234 FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
236 : IsUnmapped 0 ; inline
237 : IsUnviewable 1 ; inline
238 : IsViewable 2 ; inline
240 FUNCTION: Status XGetGeometry (
248 uint* border_width_return,
249 uint* depth_return ) ;
251 ! 4.2 - Translating Screen Coordinates
253 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 ) ;
255 ! 4.3 - Properties and Atoms
257 FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
259 FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
261 ! 4.4 - Obtaining and Changing Window Properties
263 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 ) ;
265 FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
269 FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ;
271 FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
273 FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
275 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
276 ! 6 - Color Management Functions
277 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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
342 { "ulong" "plane_mask" }
343 { "ulong" "foreground" }
344 { "ulong" "background" }
345 { "int" "line_width" }
346 { "int" "line_style" }
347 { "int" "cap_style" }
348 { "int" "join_style" }
349 { "int" "fill_style" }
350 { "int" "fill_rule" }
353 { "Pixmap" "stipple" }
354 { "int" "ts_x_origin" }
355 { "int" "ts_y_origin" }
357 { "int" "subwindow_mode" }
358 { "Bool" "graphics_exposures" }
359 { "int" "clip_x_origin" }
360 { "int" "clip_y_origin" }
361 { "Pixmap" "clip_mask" }
362 { "int" "dash_offset" }
363 { "char" "dashes" } ;
365 FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
366 FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
367 FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
368 FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
369 FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
370 FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
371 FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
373 FUNCTION: GContext XGContextFromGC ( GC gc ) ;
375 FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
377 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
378 ! 8 - Graphics Functions
379 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
381 FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
382 FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
383 FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
384 FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
385 FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
389 C-STRUCT: XCharStruct
390 { "short" "lbearing" }
391 { "short" "rbearing" }
394 { "short" "descent" }
395 { "ushort" "attributes" } ;
397 FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
398 FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
399 FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
401 C-STRUCT: XFontStruct
402 { "XExtData*" "ext_data" }
404 { "uint" "direction" }
405 { "uint" "min_char_or_byte2" }
406 { "uint" "max_char_or_byte2" }
407 { "uint" "min_byte1" }
408 { "uint" "max_byte1" }
409 { "Bool" "all_chars_exist" }
410 { "uint" "default_char" }
411 { "int" "n_properties" }
412 { "XFontProp*" "properties" }
413 { "XCharStruct" "min_bounds" }
414 { "XCharStruct" "max_bounds" }
415 { "XCharStruct*" "per_char" }
417 { "int" "descent" } ;
419 FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
423 FUNCTION: Status XDrawString (
433 ! 9 - Window and Session Manager Functions
436 FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
437 FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
438 FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
439 FUNCTION: Status XGrabServer ( Display* display ) ;
440 FUNCTION: Status XUngrabServer ( Display* display ) ;
441 FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
443 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
445 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
449 : NoEventMask 0 ; inline
450 : KeyPressMask 1 0 shift ; inline
451 : KeyReleaseMask 1 1 shift ; inline
452 : ButtonPressMask 1 2 shift ; inline
453 : ButtonReleaseMask 1 3 shift ; inline
454 : EnterWindowMask 1 4 shift ; inline
455 : LeaveWindowMask 1 5 shift ; inline
456 : PointerMotionMask 1 6 shift ; inline
457 : PointerMotionHintMask 1 7 shift ; inline
458 : Button1MotionMask 1 8 shift ; inline
459 : Button2MotionMask 1 9 shift ; inline
460 : Button3MotionMask 1 10 shift ; inline
461 : Button4MotionMask 1 11 shift ; inline
462 : Button5MotionMask 1 12 shift ; inline
463 : ButtonMotionMask 1 13 shift ; inline
464 : KeymapStateMask 1 14 shift ; inline
465 : ExposureMask 1 15 shift ; inline
466 : VisibilityChangeMask 1 16 shift ; inline
467 : StructureNotifyMask 1 17 shift ; inline
468 : ResizeRedirectMask 1 18 shift ; inline
469 : SubstructureNotifyMask 1 19 shift ; inline
470 : SubstructureRedirectMask 1 20 shift ; inline
471 : FocusChangeMask 1 21 shift ; inline
472 : PropertyChangeMask 1 22 shift ; inline
473 : ColormapChangeMask 1 23 shift ; inline
474 : OwnerGrabButtonMask 1 24 shift ; inline
476 : KeyPress 2 ; inline
477 : KeyRelease 3 ; inline
478 : ButtonPress 4 ; inline
479 : ButtonRelease 5 ; inline
480 : MotionNotify 6 ; inline
481 : EnterNotify 7 ; inline
482 : LeaveNotify 8 ; inline
484 : FocusOut 10 ; inline
485 : KeymapNotify 11 ; inline
487 : GraphicsExpose 13 ; inline
488 : NoExpose 14 ; inline
489 : VisibilityNotify 15 ; inline
490 : CreateNotify 16 ; inline
491 : DestroyNotify 17 ; inline
492 : UnmapNotify 18 ; inline
493 : MapNotify 19 ; inline
494 : MapRequest 20 ; inline
495 : ReparentNotify 21 ; inline
496 : ConfigureNotify 22 ; inline
497 : ConfigureRequest 23 ; inline
498 : GravityNotify 24 ; inline
499 : ResizeRequest 25 ; inline
500 : CirculateNotify 26 ; inline
501 : CirculateRequest 27 ; inline
502 : PropertyNotify 28 ; inline
503 : SelectionClear 29 ; inline
504 : SelectionRequest 30 ; inline
505 : SelectionNotify 31 ; inline
506 : ColormapNotify 32 ; inline
507 : ClientMessage 33 ; inline
508 : MappingNotify 34 ; inline
509 : LASTEvent 35 ; inline
514 { "Bool" "send_event" }
515 { "Display*" "display" }
516 { "Window" "window" } ;
518 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
520 ! 10.5 Keyboard and Pointer Events
528 : Button1Mask 1 8 shift ; inline
529 : Button2Mask 1 9 shift ; inline
530 : Button3Mask 1 10 shift ; inline
531 : Button4Mask 1 11 shift ; inline
532 : Button5Mask 1 12 shift ; inline
534 : ShiftMask 1 0 shift ; inline
535 : LockMask 1 1 shift ; inline
536 : ControlMask 1 2 shift ; inline
537 : Mod1Mask 1 3 shift ; inline
538 : Mod2Mask 1 4 shift ; inline
539 : Mod3Mask 1 5 shift ; inline
540 : Mod4Mask 1 6 shift ; inline
541 : Mod5Mask 1 7 shift ; inline
543 C-STRUCT: XButtonEvent
546 { "Bool" "send_event" }
547 { "Display*" "display" }
548 { "Window" "window" }
550 { "Window" "subwindow" }
558 { "Bool" "same_screen" } ;
560 TYPEDEF: XButtonEvent XButtonPressedEvent
561 TYPEDEF: XButtonEvent XButtonReleasedEvent
564 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
569 { "Bool" "send_event" }
570 { "Display*" "display" }
571 { "Window" "window" }
573 { "Window" "subwindow" }
581 { "Bool" "same_screen" } ;
583 TYPEDEF: XKeyEvent XKeyPressedEvent
584 TYPEDEF: XKeyEvent XKeyReleasedEvent
586 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
588 C-STRUCT: XMotionEvent
591 { "Bool" "send_event" }
592 { "Display*" "display" }
593 { "Window" "window" }
595 { "Window" "subwindow" }
603 { "Bool" "same_screen" } ;
605 TYPEDEF: XMotionEvent XPointerMovedEvent
607 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
609 C-STRUCT: XCrossingEvent
612 { "Bool" "send_event" }
613 { "Display*" "display" }
614 { "Window" "window" }
616 { "Window" "subwindow" }
624 { "Bool" "same_screen" }
628 TYPEDEF: XCrossingEvent XEnterWindowEvent
629 TYPEDEF: XCrossingEvent XLeaveWindowEvent
631 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
633 C-STRUCT: XFocusChangeEvent
636 { "Bool" "send_event" }
637 { "Display*" "display" }
638 { "Window" "window" }
642 TYPEDEF: XFocusChangeEvent XFocusInEvent
643 TYPEDEF: XFocusChangeEvent XFocusOutEvent
645 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
647 C-STRUCT: XExposeEvent
650 { "Bool" "send_event" }
651 { "Display*" "display" }
652 { "Window" "window" }
659 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
661 C-STRUCT: XGraphicsExposeEvent
664 { "Bool" "send_event" }
665 { "Display*" "display" }
666 { "Drawable" "drawable" }
672 { "int" "major_code" }
673 { "int" "minor_code" } ;
675 C-STRUCT: XNoExposeEvent
678 { "Bool" "send_event" }
679 { "Display*" "display" }
680 { "Drawable" "drawable" }
681 { "int" "major_code" }
682 { "int" "minor_code" } ;
684 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
686 C-STRUCT: XVisibilityEvent
689 { "Bool" "send_event" }
690 { "Display*" "display" }
691 { "Window" "window" }
694 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
696 C-STRUCT: XCreateWindowEvent
699 { "Bool" "send_event" }
700 { "Display*" "display" }
701 { "Window" "parent" }
702 { "Window" "window" }
707 { "int" "border_width" }
708 { "Bool" "override_redirect" } ;
710 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
712 C-STRUCT: XDestroyWindowEvent
715 { "Bool" "send_event" }
716 { "Display*" "display" }
718 { "Window" "window" } ;
720 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
722 C-STRUCT: XUnmapEvent
725 { "Bool" "send_event" }
726 { "Display*" "display" }
728 { "Window" "window" }
729 { "Bool" "from_configure" } ;
731 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
736 { "Bool" "send_event" }
737 { "Display*" "display" }
739 { "Window" "window" }
740 { "Bool" "override_redirect" } ;
742 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
744 C-STRUCT: XMapRequestEvent
747 { "Bool" "send_event" }
748 { "Display*" "display" }
749 { "Window" "parent" }
750 { "Window" "window" } ;
752 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
754 C-STRUCT: XReparentEvent
757 { "Bool" "send_event" }
758 { "Display*" "display" }
760 { "Window" "window" }
761 { "Window" "parent" }
764 { "Bool" "override_redirect" } ;
766 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
768 C-STRUCT: XConfigureEvent
771 { "Bool" "send_event" }
772 { "Display*" "display" }
774 { "Window" "window" }
779 { "int" "border_width" }
781 { "Bool" "override_redirect" } ;
783 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
785 C-STRUCT: XGravityEvent
788 { "Bool" "send_event" }
789 { "Display*" "display" }
791 { "Window" "window" }
795 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
797 C-STRUCT: XResizeRequestEvent
800 { "Bool" "send_event" }
801 { "Display*" "display" }
802 { "Window" "window" }
806 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
808 C-STRUCT: XConfigureRequestEvent
811 { "Bool" "send_event" }
812 { "Display*" "display" }
813 { "Window" "parent" }
814 { "Window" "window" }
819 { "int" "border_width" }
822 { "ulong" "value_mask" } ;
824 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
826 C-STRUCT: XCirculateEvent
829 { "Bool" "send_event" }
830 { "Display*" "display" }
832 { "Window" "window" }
835 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
837 C-STRUCT: XCirculateRequestEvent
840 { "Bool" "send_event" }
841 { "Display*" "display" }
842 { "Window" "parent" }
843 { "Window" "window" }
846 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
848 C-STRUCT: XPropertyEvent
851 { "Bool" "send_event" }
852 { "Display*" "display" }
853 { "Window" "window" }
858 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
860 C-STRUCT: XSelectionClearEvent
863 { "Bool" "send_event" }
864 { "Display*" "display" }
865 { "Window" "window" }
866 { "Atom" "selection" }
869 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
871 C-STRUCT: XSelectionRequestEvent
874 { "Bool" "send_event" }
875 { "Display*" "display" }
877 { "Window" "requestor" }
878 { "Atom" "selection" }
880 { "Atom" "property" }
883 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
885 C-STRUCT: XSelectionEvent
888 { "Bool" "send_event" }
889 { "Display*" "display" }
890 { "Window" "requestor" }
891 { "Atom" "selection" }
893 { "Atom" "property" }
896 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
898 C-STRUCT: XColormapEvent
901 { "Bool" "send_event" }
902 { "Display*" "display" }
903 { "Window" "window" }
904 { "Colormap" "colormap" }
908 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
910 C-STRUCT: XClientMessageEvent
913 { "Bool" "send_event" }
914 { "Display*" "display" }
915 { "Window" "window" }
916 { "Atom" "message_type" }
930 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
932 C-STRUCT: XMappingEvent
935 { "Bool" "send_event" }
936 { "Display*" "display" }
937 { "Window" "window" }
939 { "int" "first_keycode" }
942 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
944 C-STRUCT: XErrorEvent
946 { "Display*" "display" }
947 { "XID" "resourceid" }
949 { "uchar" "error_code" }
950 { "uchar" "request_code" }
951 { "uchar" "minor_code" } ;
953 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
955 C-STRUCT: XKeymapEvent
958 { "Bool" "send_event" }
959 { "Display*" "display" }
960 { "Window" "window" }
961 ! char key_vector[32];
980 "XGraphicsExposeEvent"
984 "XDestroyWindowEvent"
991 "XResizeRequestEvent"
992 "XConfigureRequestEvent"
994 "XCirculateRequestEvent"
996 "XSelectionClearEvent"
997 "XSelectionRequestEvent"
1000 "XClientMessageEvent"
1006 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1007 ! 11 - Event Handling Functions
1008 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1010 FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
1011 FUNCTION: Status XFlush ( Display* display ) ;
1012 FUNCTION: Status XSync ( Display* display, int discard ) ;
1013 FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
1014 FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
1016 ! 11.3 - Event Queue Management
1018 : QueuedAlready 0 ; inline
1019 : QueuedAfterReading 1 ; inline
1020 : QueuedAfterFlush 2 ; inline
1022 FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
1023 FUNCTION: int XPending ( Display* display ) ;
1025 ! 11.6 - Sending Events to Other Applications
1027 FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
1029 ! 11.8 - Handling Protocol Errors
1031 FUNCTION: int XSetErrorHandler ( void* handler ) ;
1033 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1034 ! 12 - Input Device Functions
1035 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1039 FUNCTION: int XGrabPointer (
1050 FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
1051 FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
1052 FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
1053 FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
1055 FUNCTION: Status XGetInputFocus ( Display* display,
1056 Window* focus_return,
1057 int* revert_to_return ) ;
1059 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 ) ;
1061 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1062 ! 14 - Inter-Client Communication Functions
1063 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1065 ! 14.1 Client to Window Manager Communication
1067 FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
1068 FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
1070 ! 14.1.1. Manipulating Top-Level Windows
1072 FUNCTION: Status XIconifyWindow (
1073 Display* display, Window w, int screen_number ) ;
1075 FUNCTION: Status XWithdrawWindow (
1076 Display* display, Window w, int screen_number ) ;
1078 ! 14.1.6 - Setting and Reading the WM_HINTS Property
1080 ! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
1082 : USPosition ( -- n ) 0 2^ ; inline
1083 : USSize ( -- n ) 1 2^ ; inline
1084 : PPosition ( -- n ) 2 2^ ; inline
1085 : PSize ( -- n ) 3 2^ ; inline
1086 : PMinSize ( -- n ) 4 2^ ; inline
1087 : PMaxSize ( -- n ) 5 2^ ; inline
1088 : PResizeInc ( -- n ) 6 2^ ; inline
1089 : PAspect ( -- n ) 7 2^ ; inline
1090 : PBaseSize ( -- n ) 8 2^ ; inline
1091 : PWinGravity ( -- n ) 9 2^ ; inline
1092 : PAllHints ( -- n )
1093 { PPosition PSize PMinSize PMaxSize PResizeInc PAspect } flags ; foldable
1095 C-STRUCT: XSizeHints
1101 { "int" "min_width" }
1102 { "int" "min_height" }
1103 { "int" "max_width" }
1104 { "int" "max_height" }
1105 { "int" "width_inc" }
1106 { "int" "height_inc" }
1107 { "int" "min_aspect_x" }
1108 { "int" "min_aspect_y" }
1109 { "int" "max_aspect_x" }
1110 { "int" "max_aspect_y" }
1111 { "int" "base_width" }
1112 { "int" "base_height" }
1113 { "int" "win_gravity" } ;
1115 ! 14.1.10. Setting and Reading the WM_PROTOCOLS Property
1117 FUNCTION: Status XSetWMProtocols (
1118 Display* display, Window w, Atom* protocols, int count ) ;
1120 FUNCTION: Status XGetWMProtocols (
1123 Atom** protocols_return,
1124 int* count_return ) ;
1126 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1127 ! 16 - Application Utility Functions
1128 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1130 ! 16.1 Keyboard Utility Functions
1132 FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
1134 FUNCTION: int XLookupString (
1135 XKeyEvent* event_struct,
1136 void* buffer_return,
1138 KeySym* keysym_return,
1139 XComposeStatus* status_in_out ) ;
1141 ! 16.7 Determining the Appropriate Visual Type
1143 : VisualNoMask HEX: 0 ; inline
1144 : VisualIDMask HEX: 1 ; inline
1145 : VisualScreenMask HEX: 2 ; inline
1146 : VisualDepthMask HEX: 4 ; inline
1147 : VisualClassMask HEX: 8 ; inline
1148 : VisualRedMaskMask HEX: 10 ; inline
1149 : VisualGreenMaskMask HEX: 20 ; inline
1150 : VisualBlueMaskMask HEX: 40 ; inline
1151 : VisualColormapSizeMask HEX: 80 ; inline
1152 : VisualBitsPerRGBMask HEX: 100 ; inline
1153 : VisualAllMask HEX: 1FF ; inline
1155 C-STRUCT: XVisualInfo
1156 { "Visual*" "visual" }
1157 { "VisualID" "visualid" }
1161 { "ulong" "red_mask" }
1162 { "ulong" "green_mask" }
1163 { "ulong" "blue_mask" }
1164 { "int" "colormap_size" }
1165 { "int" "bits_per_rgb" } ;
1167 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1168 ! Appendix D - Compatibility Functions
1169 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1171 FUNCTION: Status XSetStandardProperties (
1179 XSizeHints* hints ) ;
1181 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1183 : XA_PRIMARY 1 ; inline
1184 : XA_SECONDARY 2 ; inline
1186 : XA_ATOM 4 ; inline
1187 : XA_BITMAP 5 ; inline
1188 : XA_CARDINAL 6 ; inline
1189 : XA_COLORMAP 7 ; inline
1190 : XA_CURSOR 8 ; inline
1191 : XA_CUT_BUFFER0 9 ; inline
1192 : XA_CUT_BUFFER1 10 ; inline
1193 : XA_CUT_BUFFER2 11 ; inline
1194 : XA_CUT_BUFFER3 12 ; inline
1195 : XA_CUT_BUFFER4 13 ; inline
1196 : XA_CUT_BUFFER5 14 ; inline
1197 : XA_CUT_BUFFER6 15 ; inline
1198 : XA_CUT_BUFFER7 16 ; inline
1199 : XA_DRAWABLE 17 ; inline
1200 : XA_FONT 18 ; inline
1201 : XA_INTEGER 19 ; inline
1202 : XA_PIXMAP 20 ; inline
1203 : XA_POINT 21 ; inline
1204 : XA_RECTANGLE 22 ; inline
1205 : XA_RESOURCE_MANAGER 23 ; inline
1206 : XA_RGB_COLOR_MAP 24 ; inline
1207 : XA_RGB_BEST_MAP 25 ; inline
1208 : XA_RGB_BLUE_MAP 26 ; inline
1209 : XA_RGB_DEFAULT_MAP 27 ; inline
1210 : XA_RGB_GRAY_MAP 28 ; inline
1211 : XA_RGB_GREEN_MAP 29 ; inline
1212 : XA_RGB_RED_MAP 30 ; inline
1213 : XA_STRING 31 ; inline
1214 : XA_VISUALID 32 ; inline
1215 : XA_WINDOW 33 ; inline
1216 : XA_WM_COMMAND 34 ; inline
1217 : XA_WM_HINTS 35 ; inline
1218 : XA_WM_CLIENT_MACHINE 36 ; inline
1219 : XA_WM_ICON_NAME 37 ; inline
1220 : XA_WM_ICON_SIZE 38 ; inline
1221 : XA_WM_NAME 39 ; inline
1222 : XA_WM_NORMAL_HINTS 40 ; inline
1223 : XA_WM_SIZE_HINTS 41 ; inline
1224 : XA_WM_ZOOM_HINTS 42 ; inline
1225 : XA_MIN_SPACE 43 ; inline
1226 : XA_NORM_SPACE 44 ; inline
1227 : XA_MAX_SPACE 45 ; inline
1228 : XA_END_SPACE 46 ; inline
1229 : XA_SUPERSCRIPT_X 47 ; inline
1230 : XA_SUPERSCRIPT_Y 48 ; inline
1231 : XA_SUBSCRIPT_X 49 ; inline
1232 : XA_SUBSCRIPT_Y 50 ; inline
1233 : XA_UNDERLINE_POSITION 51 ; inline
1234 : XA_UNDERLINE_THICKNESS 52 ; inline
1235 : XA_STRIKEOUT_ASCENT 53 ; inline
1236 : XA_STRIKEOUT_DESCENT 54 ; inline
1237 : XA_ITALIC_ANGLE 55 ; inline
1238 : XA_X_HEIGHT 56 ; inline
1239 : XA_QUAD_WIDTH 57 ; inline
1240 : XA_WEIGHT 58 ; inline
1241 : XA_POINT_SIZE 59 ; inline
1242 : XA_RESOLUTION 60 ; inline
1243 : XA_COPYRIGHT 61 ; inline
1244 : XA_NOTICE 62 ; inline
1245 : XA_FONT_NAME 63 ; inline
1246 : XA_FAMILY_NAME 64 ; inline
1247 : XA_FULL_NAME 65 ; inline
1248 : XA_CAP_HEIGHT 66 ; inline
1249 : XA_WM_CLASS 67 ; inline
1250 : XA_WM_TRANSIENT_FOR 68 ; inline
1252 : XA_LAST_PREDEFINED 68 ; inline
1254 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1255 ! The rest of the stuff is not from the book.
1256 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1258 FUNCTION: void XFree ( void* data ) ;
1259 FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
1260 FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
1261 FUNCTION: int XBell ( Display* display, int percent ) ;
1265 : XIMPreeditArea HEX: 0001 ;
1266 : XIMPreeditCallbacks HEX: 0002 ;
1267 : XIMPreeditPosition HEX: 0004 ;
1268 : XIMPreeditNothing HEX: 0008 ;
1269 : XIMPreeditNone HEX: 0010 ;
1270 : XIMStatusArea HEX: 0100 ;
1271 : XIMStatusCallbacks HEX: 0200 ;
1272 : XIMStatusNothing HEX: 0400 ;
1273 : XIMStatusNone HEX: 0800 ;
1275 : XNVaNestedList "XNVaNestedList" ;
1276 : XNQueryInputStyle "queryInputStyle" ;
1277 : XNClientWindow "clientWindow" ;
1278 : XNInputStyle "inputStyle" ;
1279 : XNFocusWindow "focusWindow" ;
1280 : XNResourceName "resourceName" ;
1281 : XNResourceClass "resourceClass" ;
1282 : XNGeometryCallback "geometryCallback" ;
1283 : XNDestroyCallback "destroyCallback" ;
1284 : XNFilterEvents "filterEvents" ;
1285 : XNPreeditStartCallback "preeditStartCallback" ;
1286 : XNPreeditDoneCallback "preeditDoneCallback" ;
1287 : XNPreeditDrawCallback "preeditDrawCallback" ;
1288 : XNPreeditCaretCallback "preeditCaretCallback" ;
1289 : XNPreeditStateNotifyCallback "preeditStateNotifyCallback" ;
1290 : XNPreeditAttributes "preeditAttributes" ;
1291 : XNStatusStartCallback "statusStartCallback" ;
1292 : XNStatusDoneCallback "statusDoneCallback" ;
1293 : XNStatusDrawCallback "statusDrawCallback" ;
1294 : XNStatusAttributes "statusAttributes" ;
1296 : XNAreaNeeded "areaNeeded" ;
1297 : XNSpotLocation "spotLocation" ;
1298 : XNColormap "colorMap" ;
1299 : XNStdColormap "stdColorMap" ;
1300 : XNForeground "foreground" ;
1301 : XNBackground "background" ;
1302 : XNBackgroundPixmap "backgroundPixmap" ;
1303 : XNFontSet "fontSet" ;
1304 : XNLineSpace "lineSpace" ;
1305 : XNCursor "cursor" ;
1307 : XNQueryIMValuesList "queryIMValuesList" ;
1308 : XNQueryICValuesList "queryICValuesList" ;
1309 : XNVisiblePosition "visiblePosition" ;
1310 : XNR6PreeditCallback "r6PreeditCallback" ;
1311 : XNStringConversionCallback "stringConversionCallback" ;
1312 : XNStringConversion "stringConversion" ;
1313 : XNResetState "resetState" ;
1314 : XNHotKey "hotKey" ;
1315 : XNHotKeyState "hotKeyState" ;
1316 : XNPreeditState "preeditState" ;
1317 : XNSeparatorofNestedList "separatorofNestedList" ;
1319 : XBufferOverflow -1 ;
1325 FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
1327 FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ;
1329 FUNCTION: Status XCloseIM ( XIM im ) ;
1331 FUNCTION: XIC XCreateIC ( XIM im, char* key1, Window value1, char* key2, Window value2, char* key3, int value3, char* key4, char* value4, char* key5, char* value5, int key6 ) ;
1333 FUNCTION: void XDestroyIC ( XIC ic ) ;
1335 FUNCTION: void XSetICFocus ( XIC ic ) ;
1337 FUNCTION: void XUnsetICFocus ( XIC ic ) ;
1339 FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
1341 FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
1343 ! !!! category of setlocale
1345 : LC_COLLATE 1 ; inline
1346 : LC_CTYPE 2 ; inline
1347 : LC_MONETARY 3 ; inline
1348 : LC_NUMERIC 4 ; inline
1349 : LC_TIME 5 ; inline
1351 FUNCTION: char* setlocale ( int category, char* name ) ;
1353 FUNCTION: Bool XSupportsLocale ( ) ;
1355 FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ;
1361 : init-locale ( -- )
1362 LC_ALL "" setlocale [ "setlocale() failed" throw ] unless
1363 XSupportsLocale [ "XSupportsLocale() failed" throw ] unless ;
1365 : flush-dpy ( -- ) dpy get XFlush drop ;
1367 : x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
1369 : check-display ( alien -- alien' )
1371 "Cannot connect to X server - check $DISPLAY" throw
1374 : initialize-x ( display-string -- )
1376 dup [ ascii string>alien ] when
1377 XOpenDisplay check-display dpy set-global
1378 dpy get XDefaultScreen scr set-global
1379 dpy get scr get XRootWindow root set-global ;
1381 : close-x ( -- ) dpy get XCloseDisplay drop ;
1383 : with-x ( display-string quot -- )
1384 >r initialize-x r> [ close-x ] [ ] cleanup ;