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 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 ) ;
276 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
277 ! 5 - Pixmap and Cursor Functions
278 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
280 ! 5.1 - Creating and Freeing Pixmaps
282 FUNCTION: Pixmap XCreatePixmap ( Display* display, Drawable d, uint width, uint height, uint depth ) ;
283 FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap ) ;
286 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
287 ! 6 - Color Management Functions
288 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
298 FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
299 FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
300 FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
302 ! 6.4 Creating, Copying, and Destroying Colormaps
304 FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
306 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
307 ! 7 - Graphics Context Functions
308 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
310 : GCFunction 1 0 shift ; inline
311 : GCPlaneMask 1 1 shift ; inline
312 : GCForeground 1 2 shift ; inline
313 : GCBackground 1 3 shift ; inline
314 : GCLineWidth 1 4 shift ; inline
315 : GCLineStyle 1 5 shift ; inline
316 : GCCapStyle 1 6 shift ; inline
317 : GCJoinStyle 1 7 shift ; inline
318 : GCFillStyle 1 8 shift ; inline
319 : GCFillRule 1 9 shift ; inline
320 : GCTile 1 10 shift ; inline
321 : GCStipple 1 11 shift ; inline
322 : GCTileStipXOrigin 1 12 shift ; inline
323 : GCTileStipYOrigin 1 13 shift ; inline
324 : GCFont 1 14 shift ; inline
325 : GCSubwindowMode 1 15 shift ; inline
326 : GCGraphicsExposures 1 16 shift ; inline
327 : GCClipXOrigin 1 17 shift ; inline
328 : GCClipYOrigin 1 18 shift ; inline
329 : GCClipMask 1 19 shift ; inline
330 : GCDashOffset 1 20 shift ; inline
331 : GCDashList 1 21 shift ; inline
332 : GCArcMode 1 22 shift ; inline
334 : GXclear HEX: 0 ; inline
335 : GXand HEX: 1 ; inline
336 : GXandReverse HEX: 2 ; inline
337 : GXcopy HEX: 3 ; inline
338 : GXandInverted HEX: 4 ; inline
339 : GXnoop HEX: 5 ; inline
340 : GXxor HEX: 6 ; inline
341 : GXor HEX: 7 ; inline
342 : GXnor HEX: 8 ; inline
343 : GXequiv HEX: 9 ; inline
344 : GXinvert HEX: a ; inline
345 : GXorReverse HEX: b ; inline
346 : GXcopyInverted HEX: c ; inline
347 : GXorInverted HEX: d ; inline
348 : GXnand HEX: e ; inline
349 : GXset HEX: f ; inline
353 { "ulong" "plane_mask" }
354 { "ulong" "foreground" }
355 { "ulong" "background" }
356 { "int" "line_width" }
357 { "int" "line_style" }
358 { "int" "cap_style" }
359 { "int" "join_style" }
360 { "int" "fill_style" }
361 { "int" "fill_rule" }
364 { "Pixmap" "stipple" }
365 { "int" "ts_x_origin" }
366 { "int" "ts_y_origin" }
368 { "int" "subwindow_mode" }
369 { "Bool" "graphics_exposures" }
370 { "int" "clip_x_origin" }
371 { "int" "clip_y_origin" }
372 { "Pixmap" "clip_mask" }
373 { "int" "dash_offset" }
374 { "char" "dashes" } ;
376 FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
377 FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
378 FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
379 FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
380 FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
381 FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
382 FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
384 FUNCTION: GContext XGContextFromGC ( GC gc ) ;
386 FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
388 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
389 ! 8 - Graphics Functions
390 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
392 FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
393 FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
394 FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
395 FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
396 FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
400 C-STRUCT: XCharStruct
401 { "short" "lbearing" }
402 { "short" "rbearing" }
405 { "short" "descent" }
406 { "ushort" "attributes" } ;
408 FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
409 FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
410 FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
412 C-STRUCT: XFontStruct
413 { "XExtData*" "ext_data" }
415 { "uint" "direction" }
416 { "uint" "min_char_or_byte2" }
417 { "uint" "max_char_or_byte2" }
418 { "uint" "min_byte1" }
419 { "uint" "max_byte1" }
420 { "Bool" "all_chars_exist" }
421 { "uint" "default_char" }
422 { "int" "n_properties" }
423 { "XFontProp*" "properties" }
424 { "XCharStruct" "min_bounds" }
425 { "XCharStruct" "max_bounds" }
426 { "XCharStruct*" "per_char" }
428 { "int" "descent" } ;
430 FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
434 FUNCTION: Status XDrawString (
443 ! 8.7 - Transferring Images between Client and Server
445 : XYBitmap 0 ; inline
446 : XYPixmap 1 ; inline
448 : AllPlanes -1 ; inline
450 C-STRUCT: XImage-funcs
451 { "void*" "create_image" }
452 { "void*" "destroy_image" }
453 { "void*" "get_pixel" }
454 { "void*" "put_pixel" }
455 { "void*" "sub_image" }
456 { "void*" "add_pixel" } ;
464 { "int" "byte_order" }
465 { "int" "bitmap_unit" }
466 { "int" "bitmap_bit_order" }
467 { "int" "bitmap_pad" }
469 { "int" "bytes_per_line" }
470 { "int" "bits_per_pixel" }
471 { "ulong" "red_mask" }
472 { "ulong" "green_mask" }
473 { "ulong" "blue_mask" }
474 { "XPointer" "obdata" }
475 { "XImage-funcs" "f" } ;
477 FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format ) ;
478 FUNCTION: int XDestroyImage ( XImage *ximage ) ;
480 : XImage-size ( ximage -- size )
481 [ XImage-height ] [ XImage-bytes_per_line ] bi * ;
483 : XImage-pixels ( ximage -- byte-array )
484 [ XImage-data ] [ XImage-size ] bi memory>byte-array ;
487 ! 9 - Window and Session Manager Functions
490 FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
491 FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
492 FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
493 FUNCTION: Status XGrabServer ( Display* display ) ;
494 FUNCTION: Status XUngrabServer ( Display* display ) ;
495 FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
497 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
499 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
503 : NoEventMask 0 ; inline
504 : KeyPressMask 1 0 shift ; inline
505 : KeyReleaseMask 1 1 shift ; inline
506 : ButtonPressMask 1 2 shift ; inline
507 : ButtonReleaseMask 1 3 shift ; inline
508 : EnterWindowMask 1 4 shift ; inline
509 : LeaveWindowMask 1 5 shift ; inline
510 : PointerMotionMask 1 6 shift ; inline
511 : PointerMotionHintMask 1 7 shift ; inline
512 : Button1MotionMask 1 8 shift ; inline
513 : Button2MotionMask 1 9 shift ; inline
514 : Button3MotionMask 1 10 shift ; inline
515 : Button4MotionMask 1 11 shift ; inline
516 : Button5MotionMask 1 12 shift ; inline
517 : ButtonMotionMask 1 13 shift ; inline
518 : KeymapStateMask 1 14 shift ; inline
519 : ExposureMask 1 15 shift ; inline
520 : VisibilityChangeMask 1 16 shift ; inline
521 : StructureNotifyMask 1 17 shift ; inline
522 : ResizeRedirectMask 1 18 shift ; inline
523 : SubstructureNotifyMask 1 19 shift ; inline
524 : SubstructureRedirectMask 1 20 shift ; inline
525 : FocusChangeMask 1 21 shift ; inline
526 : PropertyChangeMask 1 22 shift ; inline
527 : ColormapChangeMask 1 23 shift ; inline
528 : OwnerGrabButtonMask 1 24 shift ; inline
530 : KeyPress 2 ; inline
531 : KeyRelease 3 ; inline
532 : ButtonPress 4 ; inline
533 : ButtonRelease 5 ; inline
534 : MotionNotify 6 ; inline
535 : EnterNotify 7 ; inline
536 : LeaveNotify 8 ; inline
538 : FocusOut 10 ; inline
539 : KeymapNotify 11 ; inline
541 : GraphicsExpose 13 ; inline
542 : NoExpose 14 ; inline
543 : VisibilityNotify 15 ; inline
544 : CreateNotify 16 ; inline
545 : DestroyNotify 17 ; inline
546 : UnmapNotify 18 ; inline
547 : MapNotify 19 ; inline
548 : MapRequest 20 ; inline
549 : ReparentNotify 21 ; inline
550 : ConfigureNotify 22 ; inline
551 : ConfigureRequest 23 ; inline
552 : GravityNotify 24 ; inline
553 : ResizeRequest 25 ; inline
554 : CirculateNotify 26 ; inline
555 : CirculateRequest 27 ; inline
556 : PropertyNotify 28 ; inline
557 : SelectionClear 29 ; inline
558 : SelectionRequest 30 ; inline
559 : SelectionNotify 31 ; inline
560 : ColormapNotify 32 ; inline
561 : ClientMessage 33 ; inline
562 : MappingNotify 34 ; inline
563 : LASTEvent 35 ; inline
568 { "Bool" "send_event" }
569 { "Display*" "display" }
570 { "Window" "window" } ;
572 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
574 ! 10.5 Keyboard and Pointer Events
582 : Button1Mask 1 8 shift ; inline
583 : Button2Mask 1 9 shift ; inline
584 : Button3Mask 1 10 shift ; inline
585 : Button4Mask 1 11 shift ; inline
586 : Button5Mask 1 12 shift ; inline
588 : ShiftMask 1 0 shift ; inline
589 : LockMask 1 1 shift ; inline
590 : ControlMask 1 2 shift ; inline
591 : Mod1Mask 1 3 shift ; inline
592 : Mod2Mask 1 4 shift ; inline
593 : Mod3Mask 1 5 shift ; inline
594 : Mod4Mask 1 6 shift ; inline
595 : Mod5Mask 1 7 shift ; inline
597 C-STRUCT: XButtonEvent
600 { "Bool" "send_event" }
601 { "Display*" "display" }
602 { "Window" "window" }
604 { "Window" "subwindow" }
612 { "Bool" "same_screen" } ;
614 TYPEDEF: XButtonEvent XButtonPressedEvent
615 TYPEDEF: XButtonEvent XButtonReleasedEvent
618 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
623 { "Bool" "send_event" }
624 { "Display*" "display" }
625 { "Window" "window" }
627 { "Window" "subwindow" }
635 { "Bool" "same_screen" } ;
637 TYPEDEF: XKeyEvent XKeyPressedEvent
638 TYPEDEF: XKeyEvent XKeyReleasedEvent
640 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
642 C-STRUCT: XMotionEvent
645 { "Bool" "send_event" }
646 { "Display*" "display" }
647 { "Window" "window" }
649 { "Window" "subwindow" }
657 { "Bool" "same_screen" } ;
659 TYPEDEF: XMotionEvent XPointerMovedEvent
661 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
663 C-STRUCT: XCrossingEvent
666 { "Bool" "send_event" }
667 { "Display*" "display" }
668 { "Window" "window" }
670 { "Window" "subwindow" }
678 { "Bool" "same_screen" }
682 TYPEDEF: XCrossingEvent XEnterWindowEvent
683 TYPEDEF: XCrossingEvent XLeaveWindowEvent
685 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
687 C-STRUCT: XFocusChangeEvent
690 { "Bool" "send_event" }
691 { "Display*" "display" }
692 { "Window" "window" }
696 TYPEDEF: XFocusChangeEvent XFocusInEvent
697 TYPEDEF: XFocusChangeEvent XFocusOutEvent
699 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
701 C-STRUCT: XExposeEvent
704 { "Bool" "send_event" }
705 { "Display*" "display" }
706 { "Window" "window" }
713 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
715 C-STRUCT: XGraphicsExposeEvent
718 { "Bool" "send_event" }
719 { "Display*" "display" }
720 { "Drawable" "drawable" }
726 { "int" "major_code" }
727 { "int" "minor_code" } ;
729 C-STRUCT: XNoExposeEvent
732 { "Bool" "send_event" }
733 { "Display*" "display" }
734 { "Drawable" "drawable" }
735 { "int" "major_code" }
736 { "int" "minor_code" } ;
738 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
740 C-STRUCT: XVisibilityEvent
743 { "Bool" "send_event" }
744 { "Display*" "display" }
745 { "Window" "window" }
748 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
750 C-STRUCT: XCreateWindowEvent
753 { "Bool" "send_event" }
754 { "Display*" "display" }
755 { "Window" "parent" }
756 { "Window" "window" }
761 { "int" "border_width" }
762 { "Bool" "override_redirect" } ;
764 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
766 C-STRUCT: XDestroyWindowEvent
769 { "Bool" "send_event" }
770 { "Display*" "display" }
772 { "Window" "window" } ;
774 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
776 C-STRUCT: XUnmapEvent
779 { "Bool" "send_event" }
780 { "Display*" "display" }
782 { "Window" "window" }
783 { "Bool" "from_configure" } ;
785 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
790 { "Bool" "send_event" }
791 { "Display*" "display" }
793 { "Window" "window" }
794 { "Bool" "override_redirect" } ;
796 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
798 C-STRUCT: XMapRequestEvent
801 { "Bool" "send_event" }
802 { "Display*" "display" }
803 { "Window" "parent" }
804 { "Window" "window" } ;
806 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
808 C-STRUCT: XReparentEvent
811 { "Bool" "send_event" }
812 { "Display*" "display" }
814 { "Window" "window" }
815 { "Window" "parent" }
818 { "Bool" "override_redirect" } ;
820 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
822 C-STRUCT: XConfigureEvent
825 { "Bool" "send_event" }
826 { "Display*" "display" }
828 { "Window" "window" }
833 { "int" "border_width" }
835 { "Bool" "override_redirect" } ;
837 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
839 C-STRUCT: XGravityEvent
842 { "Bool" "send_event" }
843 { "Display*" "display" }
845 { "Window" "window" }
849 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
851 C-STRUCT: XResizeRequestEvent
854 { "Bool" "send_event" }
855 { "Display*" "display" }
856 { "Window" "window" }
860 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
862 C-STRUCT: XConfigureRequestEvent
865 { "Bool" "send_event" }
866 { "Display*" "display" }
867 { "Window" "parent" }
868 { "Window" "window" }
873 { "int" "border_width" }
876 { "ulong" "value_mask" } ;
878 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
880 C-STRUCT: XCirculateEvent
883 { "Bool" "send_event" }
884 { "Display*" "display" }
886 { "Window" "window" }
889 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
891 C-STRUCT: XCirculateRequestEvent
894 { "Bool" "send_event" }
895 { "Display*" "display" }
896 { "Window" "parent" }
897 { "Window" "window" }
900 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
902 C-STRUCT: XPropertyEvent
905 { "Bool" "send_event" }
906 { "Display*" "display" }
907 { "Window" "window" }
912 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
914 C-STRUCT: XSelectionClearEvent
917 { "Bool" "send_event" }
918 { "Display*" "display" }
919 { "Window" "window" }
920 { "Atom" "selection" }
923 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
925 C-STRUCT: XSelectionRequestEvent
928 { "Bool" "send_event" }
929 { "Display*" "display" }
931 { "Window" "requestor" }
932 { "Atom" "selection" }
934 { "Atom" "property" }
937 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
939 C-STRUCT: XSelectionEvent
942 { "Bool" "send_event" }
943 { "Display*" "display" }
944 { "Window" "requestor" }
945 { "Atom" "selection" }
947 { "Atom" "property" }
950 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
952 C-STRUCT: XColormapEvent
955 { "Bool" "send_event" }
956 { "Display*" "display" }
957 { "Window" "window" }
958 { "Colormap" "colormap" }
962 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
964 C-STRUCT: XClientMessageEvent
967 { "Bool" "send_event" }
968 { "Display*" "display" }
969 { "Window" "window" }
970 { "Atom" "message_type" }
984 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
986 C-STRUCT: XMappingEvent
989 { "Bool" "send_event" }
990 { "Display*" "display" }
991 { "Window" "window" }
993 { "int" "first_keycode" }
996 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
998 C-STRUCT: XErrorEvent
1000 { "Display*" "display" }
1001 { "XID" "resourceid" }
1002 { "ulong" "serial" }
1003 { "uchar" "error_code" }
1004 { "uchar" "request_code" }
1005 { "uchar" "minor_code" } ;
1007 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1009 C-STRUCT: XKeymapEvent
1011 { "ulong" "serial" }
1012 { "Bool" "send_event" }
1013 { "Display*" "display" }
1014 { "Window" "window" }
1015 ! char key_vector[32];
1034 "XGraphicsExposeEvent"
1037 "XCreateWindowEvent"
1038 "XDestroyWindowEvent"
1045 "XResizeRequestEvent"
1046 "XConfigureRequestEvent"
1048 "XCirculateRequestEvent"
1050 "XSelectionClearEvent"
1051 "XSelectionRequestEvent"
1054 "XClientMessageEvent"
1060 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1061 ! 11 - Event Handling Functions
1062 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1064 FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
1065 FUNCTION: Status XFlush ( Display* display ) ;
1066 FUNCTION: Status XSync ( Display* display, int discard ) ;
1067 FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
1068 FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
1070 ! 11.3 - Event Queue Management
1072 : QueuedAlready 0 ; inline
1073 : QueuedAfterReading 1 ; inline
1074 : QueuedAfterFlush 2 ; inline
1076 FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
1077 FUNCTION: int XPending ( Display* display ) ;
1079 ! 11.6 - Sending Events to Other Applications
1081 FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
1083 ! 11.8 - Handling Protocol Errors
1085 FUNCTION: int XSetErrorHandler ( void* handler ) ;
1087 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1088 ! 12 - Input Device Functions
1089 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1093 FUNCTION: int XGrabPointer (
1104 FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
1105 FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
1106 FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
1107 FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
1109 FUNCTION: Status XGetInputFocus ( Display* display,
1110 Window* focus_return,
1111 int* revert_to_return ) ;
1113 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 ) ;
1115 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1116 ! 14 - Inter-Client Communication Functions
1117 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1119 ! 14.1 Client to Window Manager Communication
1121 FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
1122 FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
1124 ! 14.1.1. Manipulating Top-Level Windows
1126 FUNCTION: Status XIconifyWindow (
1127 Display* display, Window w, int screen_number ) ;
1129 FUNCTION: Status XWithdrawWindow (
1130 Display* display, Window w, int screen_number ) ;
1132 ! 14.1.6 - Setting and Reading the WM_HINTS Property
1134 ! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
1136 : USPosition ( -- n ) 0 2^ ; inline
1137 : USSize ( -- n ) 1 2^ ; inline
1138 : PPosition ( -- n ) 2 2^ ; inline
1139 : PSize ( -- n ) 3 2^ ; inline
1140 : PMinSize ( -- n ) 4 2^ ; inline
1141 : PMaxSize ( -- n ) 5 2^ ; inline
1142 : PResizeInc ( -- n ) 6 2^ ; inline
1143 : PAspect ( -- n ) 7 2^ ; inline
1144 : PBaseSize ( -- n ) 8 2^ ; inline
1145 : PWinGravity ( -- n ) 9 2^ ; inline
1146 : PAllHints ( -- n )
1147 { PPosition PSize PMinSize PMaxSize PResizeInc PAspect } flags ; foldable
1149 C-STRUCT: XSizeHints
1155 { "int" "min_width" }
1156 { "int" "min_height" }
1157 { "int" "max_width" }
1158 { "int" "max_height" }
1159 { "int" "width_inc" }
1160 { "int" "height_inc" }
1161 { "int" "min_aspect_x" }
1162 { "int" "min_aspect_y" }
1163 { "int" "max_aspect_x" }
1164 { "int" "max_aspect_y" }
1165 { "int" "base_width" }
1166 { "int" "base_height" }
1167 { "int" "win_gravity" } ;
1169 ! 14.1.10. Setting and Reading the WM_PROTOCOLS Property
1171 FUNCTION: Status XSetWMProtocols (
1172 Display* display, Window w, Atom* protocols, int count ) ;
1174 FUNCTION: Status XGetWMProtocols (
1177 Atom** protocols_return,
1178 int* count_return ) ;
1180 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1181 ! 16 - Application Utility Functions
1182 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1184 ! 16.1 Keyboard Utility Functions
1186 FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
1188 FUNCTION: int XLookupString (
1189 XKeyEvent* event_struct,
1190 void* buffer_return,
1192 KeySym* keysym_return,
1193 XComposeStatus* status_in_out ) ;
1195 ! 16.7 Determining the Appropriate Visual Type
1197 : VisualNoMask HEX: 0 ; inline
1198 : VisualIDMask HEX: 1 ; inline
1199 : VisualScreenMask HEX: 2 ; inline
1200 : VisualDepthMask HEX: 4 ; inline
1201 : VisualClassMask HEX: 8 ; inline
1202 : VisualRedMaskMask HEX: 10 ; inline
1203 : VisualGreenMaskMask HEX: 20 ; inline
1204 : VisualBlueMaskMask HEX: 40 ; inline
1205 : VisualColormapSizeMask HEX: 80 ; inline
1206 : VisualBitsPerRGBMask HEX: 100 ; inline
1207 : VisualAllMask HEX: 1FF ; inline
1209 C-STRUCT: XVisualInfo
1210 { "Visual*" "visual" }
1211 { "VisualID" "visualid" }
1215 { "ulong" "red_mask" }
1216 { "ulong" "green_mask" }
1217 { "ulong" "blue_mask" }
1218 { "int" "colormap_size" }
1219 { "int" "bits_per_rgb" } ;
1221 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1222 ! Appendix D - Compatibility Functions
1223 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1225 FUNCTION: Status XSetStandardProperties (
1233 XSizeHints* hints ) ;
1235 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1237 : XA_PRIMARY 1 ; inline
1238 : XA_SECONDARY 2 ; inline
1240 : XA_ATOM 4 ; inline
1241 : XA_BITMAP 5 ; inline
1242 : XA_CARDINAL 6 ; inline
1243 : XA_COLORMAP 7 ; inline
1244 : XA_CURSOR 8 ; inline
1245 : XA_CUT_BUFFER0 9 ; inline
1246 : XA_CUT_BUFFER1 10 ; inline
1247 : XA_CUT_BUFFER2 11 ; inline
1248 : XA_CUT_BUFFER3 12 ; inline
1249 : XA_CUT_BUFFER4 13 ; inline
1250 : XA_CUT_BUFFER5 14 ; inline
1251 : XA_CUT_BUFFER6 15 ; inline
1252 : XA_CUT_BUFFER7 16 ; inline
1253 : XA_DRAWABLE 17 ; inline
1254 : XA_FONT 18 ; inline
1255 : XA_INTEGER 19 ; inline
1256 : XA_PIXMAP 20 ; inline
1257 : XA_POINT 21 ; inline
1258 : XA_RECTANGLE 22 ; inline
1259 : XA_RESOURCE_MANAGER 23 ; inline
1260 : XA_RGB_COLOR_MAP 24 ; inline
1261 : XA_RGB_BEST_MAP 25 ; inline
1262 : XA_RGB_BLUE_MAP 26 ; inline
1263 : XA_RGB_DEFAULT_MAP 27 ; inline
1264 : XA_RGB_GRAY_MAP 28 ; inline
1265 : XA_RGB_GREEN_MAP 29 ; inline
1266 : XA_RGB_RED_MAP 30 ; inline
1267 : XA_STRING 31 ; inline
1268 : XA_VISUALID 32 ; inline
1269 : XA_WINDOW 33 ; inline
1270 : XA_WM_COMMAND 34 ; inline
1271 : XA_WM_HINTS 35 ; inline
1272 : XA_WM_CLIENT_MACHINE 36 ; inline
1273 : XA_WM_ICON_NAME 37 ; inline
1274 : XA_WM_ICON_SIZE 38 ; inline
1275 : XA_WM_NAME 39 ; inline
1276 : XA_WM_NORMAL_HINTS 40 ; inline
1277 : XA_WM_SIZE_HINTS 41 ; inline
1278 : XA_WM_ZOOM_HINTS 42 ; inline
1279 : XA_MIN_SPACE 43 ; inline
1280 : XA_NORM_SPACE 44 ; inline
1281 : XA_MAX_SPACE 45 ; inline
1282 : XA_END_SPACE 46 ; inline
1283 : XA_SUPERSCRIPT_X 47 ; inline
1284 : XA_SUPERSCRIPT_Y 48 ; inline
1285 : XA_SUBSCRIPT_X 49 ; inline
1286 : XA_SUBSCRIPT_Y 50 ; inline
1287 : XA_UNDERLINE_POSITION 51 ; inline
1288 : XA_UNDERLINE_THICKNESS 52 ; inline
1289 : XA_STRIKEOUT_ASCENT 53 ; inline
1290 : XA_STRIKEOUT_DESCENT 54 ; inline
1291 : XA_ITALIC_ANGLE 55 ; inline
1292 : XA_X_HEIGHT 56 ; inline
1293 : XA_QUAD_WIDTH 57 ; inline
1294 : XA_WEIGHT 58 ; inline
1295 : XA_POINT_SIZE 59 ; inline
1296 : XA_RESOLUTION 60 ; inline
1297 : XA_COPYRIGHT 61 ; inline
1298 : XA_NOTICE 62 ; inline
1299 : XA_FONT_NAME 63 ; inline
1300 : XA_FAMILY_NAME 64 ; inline
1301 : XA_FULL_NAME 65 ; inline
1302 : XA_CAP_HEIGHT 66 ; inline
1303 : XA_WM_CLASS 67 ; inline
1304 : XA_WM_TRANSIENT_FOR 68 ; inline
1306 : XA_LAST_PREDEFINED 68 ; inline
1308 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1309 ! The rest of the stuff is not from the book.
1310 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1312 FUNCTION: void XFree ( void* data ) ;
1313 FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
1314 FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
1315 FUNCTION: int XBell ( Display* display, int percent ) ;
1319 : XIMPreeditArea HEX: 0001 ;
1320 : XIMPreeditCallbacks HEX: 0002 ;
1321 : XIMPreeditPosition HEX: 0004 ;
1322 : XIMPreeditNothing HEX: 0008 ;
1323 : XIMPreeditNone HEX: 0010 ;
1324 : XIMStatusArea HEX: 0100 ;
1325 : XIMStatusCallbacks HEX: 0200 ;
1326 : XIMStatusNothing HEX: 0400 ;
1327 : XIMStatusNone HEX: 0800 ;
1329 : XNVaNestedList "XNVaNestedList" ;
1330 : XNQueryInputStyle "queryInputStyle" ;
1331 : XNClientWindow "clientWindow" ;
1332 : XNInputStyle "inputStyle" ;
1333 : XNFocusWindow "focusWindow" ;
1334 : XNResourceName "resourceName" ;
1335 : XNResourceClass "resourceClass" ;
1336 : XNGeometryCallback "geometryCallback" ;
1337 : XNDestroyCallback "destroyCallback" ;
1338 : XNFilterEvents "filterEvents" ;
1339 : XNPreeditStartCallback "preeditStartCallback" ;
1340 : XNPreeditDoneCallback "preeditDoneCallback" ;
1341 : XNPreeditDrawCallback "preeditDrawCallback" ;
1342 : XNPreeditCaretCallback "preeditCaretCallback" ;
1343 : XNPreeditStateNotifyCallback "preeditStateNotifyCallback" ;
1344 : XNPreeditAttributes "preeditAttributes" ;
1345 : XNStatusStartCallback "statusStartCallback" ;
1346 : XNStatusDoneCallback "statusDoneCallback" ;
1347 : XNStatusDrawCallback "statusDrawCallback" ;
1348 : XNStatusAttributes "statusAttributes" ;
1350 : XNAreaNeeded "areaNeeded" ;
1351 : XNSpotLocation "spotLocation" ;
1352 : XNColormap "colorMap" ;
1353 : XNStdColormap "stdColorMap" ;
1354 : XNForeground "foreground" ;
1355 : XNBackground "background" ;
1356 : XNBackgroundPixmap "backgroundPixmap" ;
1357 : XNFontSet "fontSet" ;
1358 : XNLineSpace "lineSpace" ;
1359 : XNCursor "cursor" ;
1361 : XNQueryIMValuesList "queryIMValuesList" ;
1362 : XNQueryICValuesList "queryICValuesList" ;
1363 : XNVisiblePosition "visiblePosition" ;
1364 : XNR6PreeditCallback "r6PreeditCallback" ;
1365 : XNStringConversionCallback "stringConversionCallback" ;
1366 : XNStringConversion "stringConversion" ;
1367 : XNResetState "resetState" ;
1368 : XNHotKey "hotKey" ;
1369 : XNHotKeyState "hotKeyState" ;
1370 : XNPreeditState "preeditState" ;
1371 : XNSeparatorofNestedList "separatorofNestedList" ;
1373 : XBufferOverflow -1 ;
1379 FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
1381 FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ;
1383 FUNCTION: Status XCloseIM ( XIM im ) ;
1385 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 ) ;
1387 FUNCTION: void XDestroyIC ( XIC ic ) ;
1389 FUNCTION: void XSetICFocus ( XIC ic ) ;
1391 FUNCTION: void XUnsetICFocus ( XIC ic ) ;
1393 FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
1395 FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
1397 ! !!! category of setlocale
1399 : LC_COLLATE 1 ; inline
1400 : LC_CTYPE 2 ; inline
1401 : LC_MONETARY 3 ; inline
1402 : LC_NUMERIC 4 ; inline
1403 : LC_TIME 5 ; inline
1405 FUNCTION: char* setlocale ( int category, char* name ) ;
1407 FUNCTION: Bool XSupportsLocale ( ) ;
1409 FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ;
1415 : init-locale ( -- )
1416 LC_ALL "" setlocale [ "setlocale() failed" print flush ] unless
1417 XSupportsLocale [ "XSupportsLocale() failed" print flush ] unless ;
1419 : flush-dpy ( -- ) dpy get XFlush drop ;
1421 : x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
1423 : check-display ( alien -- alien' )
1425 "Cannot connect to X server - check $DISPLAY" throw
1428 : initialize-x ( display-string -- )
1430 dup [ ascii string>alien ] when
1431 XOpenDisplay check-display dpy set-global
1432 dpy get XDefaultScreen scr set-global
1433 dpy get scr get XRootWindow root set-global ;
1435 : close-x ( -- ) dpy get XCloseDisplay drop ;
1437 : with-x ( display-string quot -- )
1438 [ initialize-x ] dip [ close-x ] [ ] cleanup ;