]> gitweb.factorcode.org Git - factor.git/blob - basis/x11/xlib/xlib.factor
98305e83045bf3ccc646460f9c4f9f58981f6694
[factor.git] / basis / x11 / xlib / xlib.factor
1 ! Copyright (C) 2005, 2006 Eduardo Cavazos
2 ! See http://factorcode.org/license.txt for BSD license.
3 !
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.
13 USING: accessors kernel arrays alien alien.c-types alien.strings
14 alien.syntax classes.struct math math.bitwise words sequences
15 namespaces continuations io io.encodings.ascii x11.syntax ;
16 FROM: alien.c-types => short ;
17 IN: x11.xlib
18
19 LIBRARY: xlib
20
21 TYPEDEF: ulong XID
22 TYPEDEF: XID Window
23 TYPEDEF: XID Drawable
24 TYPEDEF: XID Font
25 TYPEDEF: XID Pixmap
26 TYPEDEF: XID Cursor
27 TYPEDEF: XID Colormap
28 TYPEDEF: XID GContext
29 TYPEDEF: XID KeySym
30
31 TYPEDEF: ulong Atom
32
33 TYPEDEF: char* XPointer
34 TYPEDEF: void* Screen*
35 TYPEDEF: void* GC
36 TYPEDEF: void* Visual*
37 TYPEDEF: void* XExtData*
38 TYPEDEF: void* XFontProp*
39 TYPEDEF: void* XComposeStatus*
40 TYPEDEF: void* XIM
41 TYPEDEF: void* XIC
42
43 TYPEDEF: int Status
44
45 TYPEDEF: int Bool
46
47 TYPEDEF: ulong VisualID
48 TYPEDEF: ulong Time
49
50 TYPEDEF: void* Window**
51 TYPEDEF: void* Atom**
52
53 ALIAS: <XID> <ulong>
54 ALIAS: <Window> <XID>
55 ALIAS: <Drawable> <XID>
56 ALIAS: <KeySym> <XID>
57 ALIAS: <Atom> <ulong>
58
59 ALIAS: *XID *ulong
60 ALIAS: *Window *XID
61 ALIAS: *Drawable *XID
62 ALIAS: *KeySym *XID
63 ALIAS: *Atom *ulong
64 !
65 ! 2 - Display Functions
66 !
67
68 ! This struct is incomplete
69 STRUCT: Display
70 { ext_data void* }
71 { free_funcs void* }
72 { fd int } ;
73
74 X-FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
75
76 ! 2.2 Obtaining Information about the Display, Image Formats, or Screens
77
78 X-FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ;
79 X-FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ;
80 X-FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ;
81 X-FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ;
82 X-FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ;
83 X-FUNCTION: int XDefaultScreen ( Display* display ) ;
84 X-FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ;
85 X-FUNCTION: Window XDefaultRootWindow ( Display* display ) ;
86 X-FUNCTION: int XProtocolVersion ( Display* display ) ;
87 X-FUNCTION: int XProtocolRevision ( Display* display ) ;
88 X-FUNCTION: int XQLength ( Display* display ) ;
89 X-FUNCTION: int XScreenCount ( Display* display ) ;
90 X-FUNCTION: int XConnectionNumber ( Display* display ) ;
91
92 ! 2.5 Closing the Display
93 X-FUNCTION: int XCloseDisplay ( Display* display ) ;
94
95 !
96 ! 3 - Window Functions
97 !
98
99 ! 3.2 - Window Attributes
100
101 : CWBackPixmap       ( -- n ) 0 2^ ; inline
102 : CWBackPixel        ( -- n ) 1 2^ ; inline
103 : CWBorderPixmap     ( -- n ) 2 2^ ; inline
104 : CWBorderPixel      ( -- n ) 3 2^ ; inline
105 : CWBitGravity       ( -- n ) 4 2^ ; inline
106 : CWWinGravity       ( -- n ) 5 2^ ; inline
107 : CWBackingStore     ( -- n ) 6 2^ ; inline
108 : CWBackingPlanes    ( -- n ) 7 2^ ; inline
109 : CWBackingPixel     ( -- n ) 8 2^ ; inline
110 : CWOverrideRedirect ( -- n ) 9 2^ ; inline
111 : CWSaveUnder        ( -- n ) 10 2^ ; inline
112 : CWEventMask        ( -- n ) 11 2^ ; inline
113 : CWDontPropagate    ( -- n ) 12 2^ ; inline
114 : CWColormap         ( -- n ) 13 2^ ; inline
115 : CWCursor           ( -- n ) 14 2^ ; inline
116
117 STRUCT: XSetWindowAttributes
118 { background_pixmap Pixmap }
119 { background_pixel ulong }
120 { border_pixmap Pixmap }
121 { border_pixel ulong }
122 { bit_gravity int }
123 { win_gravity int }
124 { backing_store int }
125 { backing_planes ulong }
126 { backing_pixel ulong }
127 { save_under Bool }
128 { event_mask long }
129 { do_not_propagate_mask long }
130 { override_redirect Bool }
131 { colormap Colormap }
132 { cursor Cursor } ;
133
134 CONSTANT: UnmapGravity          0
135
136 CONSTANT: ForgetGravity         0
137 CONSTANT: NorthWestGravity      1
138 CONSTANT: NorthGravity          2
139 CONSTANT: NorthEastGravity      3
140 CONSTANT: WestGravity           4
141 CONSTANT: CenterGravity         5
142 CONSTANT: EastGravity           6
143 CONSTANT: SouthWestGravity      7
144 CONSTANT: SouthGravity          8
145 CONSTANT: SouthEastGravity      9
146 CONSTANT: StaticGravity         10
147
148 ! 3.3 - Creating Windows
149
150 X-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 ) ;
151 X-FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
152 X-FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
153 X-FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
154 X-FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
155 X-FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
156 X-FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
157
158 ! 3.5 Mapping Windows
159
160 X-FUNCTION: int XMapRaised ( Display* display, Window w ) ;
161
162 ! 3.7 - Configuring Windows
163
164 : CWX           ( -- n ) 0 2^ ; inline
165 : CWY           ( -- n ) 1 2^ ; inline
166 : CWWidth       ( -- n ) 2 2^ ; inline
167 : CWHeight      ( -- n ) 3 2^ ; inline
168 : CWBorderWidth ( -- n ) 4 2^ ; inline
169 : CWSibling     ( -- n ) 5 2^ ; inline
170 : CWStackMode   ( -- n ) 6 2^ ; inline
171
172 STRUCT: XWindowChanges
173 { x int }
174 { y int }
175 { width int }
176 { height int }
177 { border_width int }
178 { sibling Window }
179 { stack_mode int } ;
180
181 X-FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
182 X-FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
183 X-FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ;
184 X-FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ;
185
186
187 ! 3.8 Changing Window Stacking Order
188
189 X-FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ;
190 X-FUNCTION: Status XLowerWindow ( Display* display, Window w ) ;
191
192 ! 3.9 - Changing Window Attributes
193
194 X-FUNCTION: Status XChangeWindowAttributes (
195   Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ;
196 X-FUNCTION: Status XSetWindowBackground (
197   Display* display, Window w, ulong background_pixel ) ;
198 X-FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ;
199 X-FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
200
201 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
202 ! 4 - Window Information Functions
203 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
204
205 ! 4.1 - Obtaining Window Information
206
207 X-FUNCTION: Status XQueryTree (
208   Display* display,
209   Window w,
210   Window* root_return,
211   Window* parent_return,
212   Window** children_return, uint* nchildren_return ) ;
213
214 STRUCT: XWindowAttributes
215 { x int }
216 { y int }
217 { width int }
218 {  height int }
219 { border_width int }
220 { depth int }
221 { visual Visual* }
222 { root Window }
223 { class int }
224 { bit_gravity int }
225 { win_gravity int }
226 { backing_store int }
227 { backing_planes ulong }
228 { backing_pixel ulong }
229 { save_under Bool }
230 { colormap Colormap }
231 { map_installed Bool }
232 { map_state int }
233 { all_event_masks long }
234 { your_event_mask long }
235 { do_not_propagate_mask long }
236 { override_redirect Bool }
237 { screen Screen* } ;
238
239 X-FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
240
241 CONSTANT: IsUnmapped            0
242 CONSTANT: IsUnviewable          1
243 CONSTANT: IsViewable            2
244
245 X-FUNCTION: Status XGetGeometry (
246   Display* display,
247   Drawable d,
248   Window* root_return,
249   int* x_return,
250   int* y_return,
251   uint* width_return,
252   uint* height_return,
253   uint* border_width_return,
254   uint* depth_return ) ;
255
256 ! 4.2 - Translating Screen Coordinates
257
258 X-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 ) ;
259
260 ! 4.3 - Properties and Atoms
261
262 X-FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
263
264 X-FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
265
266 ! 4.4 - Obtaining and Changing Window Properties
267
268 X-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 ) ;
269
270 X-FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
271
272 ! 4.5 Selections
273
274 X-FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ;
275
276 X-FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
277
278 X-FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
279
280
281 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
282 ! 5 - Pixmap and Cursor Functions
283 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
284
285 ! 5.1 - Creating and Freeing Pixmaps
286
287 X-FUNCTION: Pixmap XCreatePixmap ( Display* display, Drawable d, uint width, uint height, uint depth ) ;
288 X-FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap ) ;
289
290
291 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
292 ! 6 - Color Management Functions
293 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
294
295 STRUCT: XColor
296 { pixel ulong }
297 { red ushort }
298 { green ushort }
299 { blue ushort }
300 { flags char }
301 { pad char } ;
302
303 X-FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
304 X-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
305 X-FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
306
307 ! 6.4 Creating, Copying, and Destroying Colormaps
308
309 X-FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
310
311 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
312 ! 7 - Graphics Context Functions
313 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
314
315 : GCFunction          ( -- n ) 0 2^ ; inline
316 : GCPlaneMask         ( -- n ) 1 2^ ; inline
317 : GCForeground        ( -- n ) 2 2^ ; inline
318 : GCBackground        ( -- n ) 3 2^ ; inline
319 : GCLineWidth         ( -- n ) 4 2^ ; inline
320 : GCLineStyle         ( -- n ) 5 2^ ; inline
321 : GCCapStyle          ( -- n ) 6 2^ ; inline
322 : GCJoinStyle         ( -- n ) 7 2^ ; inline
323 : GCFillStyle         ( -- n ) 8 2^ ; inline
324 : GCFillRule          ( -- n ) 9 2^ ; inline
325 : GCTile              ( -- n ) 10 2^ ; inline
326 : GCStipple           ( -- n ) 11 2^ ; inline
327 : GCTileStipXOrigin   ( -- n ) 12 2^ ; inline
328 : GCTileStipYOrigin   ( -- n ) 13 2^ ; inline
329 : GCFont              ( -- n ) 14 2^ ; inline
330 : GCSubwindowMode     ( -- n ) 15 2^ ; inline
331 : GCGraphicsExposures ( -- n ) 16 2^ ; inline
332 : GCClipXOrigin       ( -- n ) 17 2^ ; inline
333 : GCClipYOrigin       ( -- n ) 18 2^ ; inline
334 : GCClipMask          ( -- n ) 19 2^ ; inline
335 : GCDashOffset        ( -- n ) 20 2^ ; inline
336 : GCDashList          ( -- n ) 21 2^ ; inline
337 : GCArcMode           ( -- n ) 22 2^ ; inline
338
339 CONSTANT: GXclear               HEX: 0
340 CONSTANT: GXand                 HEX: 1
341 CONSTANT: GXandReverse          HEX: 2
342 CONSTANT: GXcopy                HEX: 3
343 CONSTANT: GXandInverted         HEX: 4
344 CONSTANT: GXnoop                HEX: 5
345 CONSTANT: GXxor                 HEX: 6
346 CONSTANT: GXor                  HEX: 7
347 CONSTANT: GXnor                 HEX: 8
348 CONSTANT: GXequiv               HEX: 9
349 CONSTANT: GXinvert              HEX: a
350 CONSTANT: GXorReverse           HEX: b
351 CONSTANT: GXcopyInverted        HEX: c
352 CONSTANT: GXorInverted          HEX: d
353 CONSTANT: GXnand                HEX: e
354 CONSTANT: GXset                 HEX: f
355
356 STRUCT: XGCValues
357 { function int }
358 { plane_mask ulong }
359 { foreground ulong }
360 { background ulong }
361 { line_width int }
362 { line_style int }
363 { cap_style int }
364 { join_style int }
365 { fill_style int }
366 { fill_rule int }
367 { arc_mode int }
368 { tile Pixmap }
369 { stipple Pixmap }
370 { ts_x_origin int }
371 { ts_y_origin int }
372 { font Font }
373 { subwindow_mode int }
374 { graphics_exposures Bool }
375 { clip_x_origin int }
376 { clip_y_origin int }
377 { clip_mask Pixmap }
378 { dash_offset int }
379 { dashes char } ;
380
381 X-FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
382 X-FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
383 X-FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
384 X-FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
385 X-FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
386 X-FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
387 X-FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
388
389 X-FUNCTION: GContext XGContextFromGC ( GC gc ) ;
390
391 X-FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
392
393 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
394 ! 8 - Graphics Functions
395 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
396
397 X-FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
398 X-FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
399 X-FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
400 X-FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
401 X-FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
402
403 ! 8.5 - Font Metrics
404
405 STRUCT: XCharStruct
406 { lbearing short }
407 { rbearing short }
408 { width short }
409 { ascent short }
410 { descent short }
411 { attributes ushort } ;
412
413 X-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
414 X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
415 X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
416
417 STRUCT: XFontStruct
418 { ext_data XExtData* }
419 { fid Font }
420 { direction uint }
421 { min_char_or_byte2 uint }
422 { max_char_or_byte2 uint }
423 { min_byte1 uint }
424 { max_byte1 uint }
425 { all_chars_exist Bool }
426 { default_char uint }
427 { n_properties int }
428 { properties XFontProp* }
429 { min_bounds XCharStruct }
430 { max_bounds XCharStruct }
431 { per_char XCharStruct* }
432 { ascent int }
433 { descent int } ;
434
435 X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
436
437 ! 8.6 - Drawing Text
438
439 X-FUNCTION: Status XDrawString (
440         Display* display,
441         Drawable d,
442         GC gc,
443         int x,
444         int y,
445         char* string,
446         int length ) ;
447
448 ! 8.7 - Transferring Images between Client and Server
449
450 CONSTANT: AllPlanes -1
451
452 STRUCT: XImage-funcs
453 { create_image void* }
454 { destroy_image void* }
455 { get_pixel void* }
456 { put_pixel void* }
457 { sub_image void* }
458 { add_pixel void* } ;
459
460 STRUCT: XImage
461 { width int }
462 { height int }
463 { xoffset int }
464 { format int }
465 { data char* }
466 { byte_order int }
467 { bitmap_unit int }
468 { bitmap_bit_order int }
469 { bitmap_pad int }
470 { depth int }
471 { bytes_per_line int }
472 { bits_per_pixel int }
473 { red_mask ulong }
474 { green_mask ulong }
475 { blue_mask ulong }
476 { obdata XPointer }
477 { f XImage-funcs } ;
478
479 X-FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format ) ;
480 X-FUNCTION: int XDestroyImage ( XImage* ximage ) ;
481
482 : XImage-size ( ximage -- size )
483     [ height>> ] [ bytes_per_line>> ] bi * ;
484
485 : XImage-pixels ( ximage -- byte-array )
486     [ data>> ] [ XImage-size ] bi memory>byte-array ;
487
488 !
489 ! 9 - Window and Session Manager Functions
490 !
491
492 X-FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
493 X-FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
494 X-FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
495 X-FUNCTION: Status XGrabServer ( Display* display ) ;
496 X-FUNCTION: Status XUngrabServer ( Display* display ) ;
497 X-FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
498
499 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
500 ! 10 - Events
501 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
502
503 ! 10.3 - Event Masks
504
505 : NoEventMask              ( -- n ) 0 ; inline
506 : KeyPressMask             ( -- n ) 0 2^ ; inline
507 : KeyReleaseMask           ( -- n ) 1 2^ ; inline
508 : ButtonPressMask          ( -- n ) 2 2^ ; inline
509 : ButtonReleaseMask        ( -- n ) 3 2^ ; inline
510 : EnterWindowMask          ( -- n ) 4 2^ ; inline
511 : LeaveWindowMask          ( -- n ) 5 2^ ; inline
512 : PointerMotionMask        ( -- n ) 6 2^ ; inline
513 : PointerMotionHintMask    ( -- n ) 7 2^ ; inline
514 : Button1MotionMask        ( -- n ) 8 2^ ; inline
515 : Button2MotionMask        ( -- n ) 9 2^ ; inline
516 : Button3MotionMask        ( -- n ) 10 2^ ; inline
517 : Button4MotionMask        ( -- n ) 11 2^ ; inline
518 : Button5MotionMask        ( -- n ) 12 2^ ; inline
519 : ButtonMotionMask         ( -- n ) 13 2^ ; inline
520 : KeymapStateMask          ( -- n ) 14 2^ ; inline
521 : ExposureMask             ( -- n ) 15 2^ ; inline
522 : VisibilityChangeMask     ( -- n ) 16 2^ ; inline
523 : StructureNotifyMask      ( -- n ) 17 2^ ; inline
524 : ResizeRedirectMask       ( -- n ) 18 2^ ; inline
525 : SubstructureNotifyMask   ( -- n ) 19 2^ ; inline
526 : SubstructureRedirectMask ( -- n ) 20 2^ ; inline
527 : FocusChangeMask          ( -- n ) 21 2^ ; inline
528 : PropertyChangeMask       ( -- n ) 22 2^ ; inline
529 : ColormapChangeMask       ( -- n ) 23 2^ ; inline
530 : OwnerGrabButtonMask      ( -- n ) 24 2^ ; inline
531
532 CONSTANT: KeyPress              2
533 CONSTANT: KeyRelease            3
534 CONSTANT: ButtonPress           4
535 CONSTANT: ButtonRelease         5
536 CONSTANT: MotionNotify          6
537 CONSTANT: EnterNotify           7
538 CONSTANT: LeaveNotify           8
539 CONSTANT: FocusIn               9
540 CONSTANT: FocusOut              10
541 CONSTANT: KeymapNotify          11
542 CONSTANT: Expose                12
543 CONSTANT: GraphicsExpose        13
544 CONSTANT: NoExpose              14
545 CONSTANT: VisibilityNotify      15
546 CONSTANT: CreateNotify          16
547 CONSTANT: DestroyNotify         17
548 CONSTANT: UnmapNotify           18
549 CONSTANT: MapNotify             19
550 CONSTANT: MapRequest            20
551 CONSTANT: ReparentNotify        21
552 CONSTANT: ConfigureNotify       22
553 CONSTANT: ConfigureRequest      23
554 CONSTANT: GravityNotify         24
555 CONSTANT: ResizeRequest         25
556 CONSTANT: CirculateNotify       26
557 CONSTANT: CirculateRequest      27
558 CONSTANT: PropertyNotify        28
559 CONSTANT: SelectionClear        29
560 CONSTANT: SelectionRequest      30
561 CONSTANT: SelectionNotify       31
562 CONSTANT: ColormapNotify        32
563 CONSTANT: ClientMessage         33
564 CONSTANT: MappingNotify         34
565 CONSTANT: LASTEvent             35
566
567 STRUCT: XAnyEvent
568 { type int }
569 { serial ulong }
570 { send_event Bool }
571 { display Display* }
572 { window Window } ;
573
574 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
575
576 ! 10.5 Keyboard and Pointer Events
577
578 CONSTANT: Button1 1
579 CONSTANT: Button2 2
580 CONSTANT: Button3 3
581 CONSTANT: Button4 4
582 CONSTANT: Button5 5
583
584 : Button1Mask ( -- n ) 1 8  shift ; inline
585 : Button2Mask ( -- n ) 1 9  shift ; inline
586 : Button3Mask ( -- n ) 1 10 shift ; inline
587 : Button4Mask ( -- n ) 1 11 shift ; inline
588 : Button5Mask ( -- n ) 1 12 shift ; inline
589
590 : ShiftMask   ( -- n ) 1 0 shift ; inline
591 : LockMask    ( -- n ) 1 1 shift ; inline
592 : ControlMask ( -- n ) 1 2 shift ; inline
593 : Mod1Mask    ( -- n ) 1 3 shift ; inline
594 : Mod2Mask    ( -- n ) 1 4 shift ; inline
595 : Mod3Mask    ( -- n ) 1 5 shift ; inline
596 : Mod4Mask    ( -- n ) 1 6 shift ; inline
597 : Mod5Mask    ( -- n ) 1 7 shift ; inline
598
599 STRUCT: XButtonEvent
600 { type int }
601 { serial ulong }
602 { send_event Bool }
603 { display Display* }
604 { window Window }
605 { root Window }
606 { subwindow Window }
607 { time Time }
608 { x int }
609 { y int }
610 { x_root int }
611 { y_root int }
612 { state uint }
613 { button uint }
614 { same_screen Bool } ;
615
616 TYPEDEF: XButtonEvent XButtonPressedEvent
617 TYPEDEF: XButtonEvent XButtonReleasedEvent
618
619
620 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
621
622 STRUCT: XKeyEvent
623 { type int }
624 { serial ulong }
625 { send_event Bool }
626 { display Display* }
627 { window Window }
628 { root Window }
629 { subwindow Window }
630 { time Time }
631 { x int }
632 { y int }
633 { x_root int }
634 { y_root int }
635 { state uint }
636 { keycode uint }
637 { same_screen Bool } ;
638
639 TYPEDEF: XKeyEvent XKeyPressedEvent
640 TYPEDEF: XKeyEvent XKeyReleasedEvent
641
642 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
643
644 STRUCT: XMotionEvent
645 { type int }
646 { serial ulong }
647 { send_event Bool }
648 { display Display* }
649 { window Window }
650 { root Window }
651 { subwindow Window }
652 { time Time }
653 { x int }
654 { y int }
655 { x_root int }
656 { y_root int }
657 { state uint }
658 { is_hint char }
659 { same_screen Bool } ;
660
661 TYPEDEF: XMotionEvent XPointerMovedEvent
662
663 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
664
665 STRUCT: XCrossingEvent
666 { type int }
667 { serial ulong }
668 { send_event Bool }
669 { display Display* }
670 { window Window }
671 { root Window }
672 { subwindow Window }
673 { time Time }
674 { x int }
675 { y int }
676 { x_root int }
677 { y_root int }
678 { mode int }
679 { detail int }
680 { same_screen Bool }
681 { focus Bool }
682 { state uint } ;
683
684 TYPEDEF: XCrossingEvent XEnterWindowEvent
685 TYPEDEF: XCrossingEvent XLeaveWindowEvent
686
687 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
688
689 STRUCT: XFocusChangeEvent
690 { type int }
691 { serial ulong }
692 { send_event Bool }
693 { display Display* }
694 { window Window }
695 { mode int }
696 { detail int } ;
697
698 TYPEDEF: XFocusChangeEvent XFocusInEvent
699 TYPEDEF: XFocusChangeEvent XFocusOutEvent
700
701 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
702
703 STRUCT: XExposeEvent
704 { type int }
705 { serial ulong }
706 { send_event Bool }
707 { display Display* }
708 { window Window }
709 { x int }
710 { y int }
711 { width int }
712 { height int }
713 { count int } ;
714
715 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
716
717 STRUCT: XGraphicsExposeEvent
718 { type int }
719 { serial ulong }
720 { send_event Bool }
721 { display Display* }
722 { drawable Drawable }
723 { x int }
724 { y int }
725 { width int }
726 { height int }
727 { count int }
728 { major_code int }
729 { minor_code int } ;
730
731 STRUCT: XNoExposeEvent
732 { type int }
733 { serial ulong }
734 { send_event Bool }
735 { display Display* }
736 { drawable Drawable }
737 { major_code int }
738 { minor_code int } ;
739
740 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
741
742 STRUCT: XVisibilityEvent
743 { type int }
744 { serial ulong }
745 { send_event Bool }
746 { display Display* }
747 { window Window }
748 { state int } ;
749
750 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
751
752 STRUCT: XCreateWindowEvent
753 { type int }
754 { serial ulong }
755 { send_event Bool }
756 { display Display* }
757 { parent Window }
758 { window Window }
759 { x int }
760 { y int }
761 { width int }
762 { height int }
763 { border_width int }
764 { override_redirect Bool } ;
765
766 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
767
768 STRUCT: XDestroyWindowEvent
769 { type int }
770 { serial ulong }
771 { send_event Bool }
772 { display Display* }
773 { event Window }
774 { window Window } ;
775
776 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
777
778 STRUCT: XUnmapEvent
779 { type int }
780 { serial ulong }
781 { send_event Bool }
782 { display Display* }
783 { event Window }
784 { window Window }
785 { from_configure Bool } ;
786
787 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
788
789 STRUCT: XMapEvent
790 { type int }
791 { serial ulong }
792 { send_event Bool }
793 { display Display* }
794 { event Window }
795 { window Window }
796 { override_redirect Bool } ;
797
798 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
799
800 STRUCT: XMapRequestEvent
801 { type int }
802 { serial ulong }
803 { send_event Bool }
804 { display Display* }
805 { parent Window }
806 { window Window } ;
807
808 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
809
810 STRUCT: XReparentEvent
811 { type int }
812 { serial ulong }
813 { send_event Bool }
814 { display Display* }
815 { event Window }
816 { window Window }
817 { parent Window }
818 { x int }
819 { y int }
820 { override_redirect Bool } ;
821
822 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
823
824 STRUCT: XConfigureEvent
825 { type int }
826 { serial ulong }
827 { send_event Bool }
828 { display Display* }
829 { event Window }
830 { window Window }
831 { x int }
832 { y int }
833 { width int }
834 { height int }
835 { border_width int }
836 { above Window }
837 { override_redirect Bool } ;
838
839 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
840
841 STRUCT: XGravityEvent
842 { type int }
843 { serial ulong }
844 { send_event Bool }
845 { display Display* }
846 { event Window }
847 { window Window }
848 { x int }
849 { y int } ;
850
851 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
852
853 STRUCT: XResizeRequestEvent
854 { type int }
855 { serial ulong }
856 { send_event Bool }
857 { display Display* }
858 { window Window }
859 { width int }
860 { height int } ;
861
862 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
863
864 STRUCT: XConfigureRequestEvent
865 { type int }
866 { serial ulong }
867 { send_event Bool }
868 { display Display* }
869 { parent Window }
870 { window Window }
871 { x int }
872 { y int }
873 { width int }
874 { height int }
875 { border_width int }
876 { above Window }
877 { detail int }
878 { value_mask ulong } ;
879
880 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
881
882 STRUCT: XCirculateEvent
883 { type int }
884 { serial ulong }
885 { send_event Bool }
886 { display Display* }
887 { event Window }
888 { window Window }
889 { place int } ;
890
891 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
892
893 STRUCT: XCirculateRequestEvent
894 { type int }
895 { serial ulong }
896 { send_event Bool }
897 { display Display* }
898 { parent Window }
899 { window Window }
900 { place int } ;
901
902 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
903
904 STRUCT: XPropertyEvent
905 { type int }
906 { serial ulong }
907 { send_event Bool }
908 { display Display* }
909 { window Window }
910 { atom Atom }
911 { time Time }
912 { state int } ;
913
914 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
915
916 STRUCT: XSelectionClearEvent
917 { type int }
918 { serial ulong }
919 { send_event Bool }
920 { display Display* }
921 { window Window }
922 { selection Atom }
923 { time Time } ;
924
925 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
926
927 STRUCT: XSelectionRequestEvent
928 { type int }
929 { serial ulong }
930 { send_event Bool }
931 { display Display* }
932 { owner Window }
933 { requestor Window }
934 { selection Atom }
935 { target Atom }
936 { property Atom }
937 { time Time } ;
938
939 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
940
941 STRUCT: XSelectionEvent
942 { type int }
943 { serial ulong }
944 { send_event Bool }
945 { display Display* }
946 { requestor Window }
947 { selection Atom }
948 { target Atom }
949 { property Atom }
950 { time Time } ;
951
952 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
953
954 STRUCT: XColormapEvent
955 { type int }
956 { serial ulong }
957 { send_event Bool }
958 { display Display* }
959 { window Window }
960 { colormap Colormap }
961 { new Bool }
962 { state int } ;
963
964 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
965
966 STRUCT: XClientMessageEvent
967 { type int }
968 { serial ulong }
969 { send_event Bool }
970 { display Display* }
971 { window Window }
972 { message_type Atom }
973 { format int }
974 { data0 long }
975 { data1 long }
976 { data2 long }
977 { data3 long }
978 { data4 long } ;
979
980 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
981
982 STRUCT: XMappingEvent
983 { type int }
984 { serial ulong }
985 { send_event Bool }
986 { display Display* }
987 { window Window }
988 { request int }
989 { first_keycode int }
990 { count int } ;
991
992 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
993
994 STRUCT: XErrorEvent
995 { type int }
996 { display Display* }
997 { resourceid XID }
998 { serial ulong }
999 { error_code uchar }
1000 { request_code uchar }
1001 { minor_code uchar } ;
1002
1003 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1004
1005 STRUCT: XKeymapEvent
1006 { type int }
1007 { serial ulong }
1008 { send_event Bool }
1009 { display Display* }
1010 { window Window }
1011 { pad int }
1012 { pad int }
1013 { pad int }
1014 { pad int }
1015 { pad int }
1016 { pad int }
1017 { pad int }
1018 { pad int } ;
1019
1020 UNION-STRUCT: XEvent
1021 { int int }
1022 { XAnyEvent XAnyEvent }
1023 { XKeyEvent XKeyEvent }
1024 { XButtonEvent XButtonEvent }
1025 { XMotionEvent XMotionEvent }
1026 { XCrossingEvent XCrossingEvent }
1027 { XFocusChangeEvent XFocusChangeEvent }
1028 { XExposeEvent XExposeEvent }
1029 { XGraphicsExposeEvent XGraphicsExposeEvent }
1030 { XNoExposeEvent XNoExposeEvent }
1031 { XVisibilityEvent XVisibilityEvent }
1032 { XCreateWindowEvent XCreateWindowEvent }
1033 { XDestroyWindowEvent XDestroyWindowEvent }
1034 { XUnmapEvent XUnmapEvent }
1035 { XMapEvent XMapEvent }
1036 { XMapRequestEvent XMapRequestEvent }
1037 { XReparentEvent XReparentEvent }
1038 { XConfigureEvent XConfigureEvent }
1039 { XGravityEvent XGravityEvent }
1040 { XResizeRequestEvent XResizeRequestEvent }
1041 { XConfigureRequestEvent XConfigureRequestEvent }
1042 { XCirculateEvent XCirculateEvent }
1043 { XCirculateRequestEvent XCirculateRequestEvent }
1044 { XPropertyEvent XPropertyEvent }
1045 { XSelectionClearEvent XSelectionClearEvent }
1046 { XSelectionRequestEvent XSelectionRequestEvent }
1047 { XSelectionEvent XSelectionEvent }
1048 { XColormapEvent XColormapEvent }
1049 { XClientMessageEvent XClientMessageEvent }
1050 { XMappingEvent XMappingEvent }
1051 { XErrorEvent XErrorEvent }
1052 { XKeymapEvent XKeymapEvent }
1053 { padding long[24] } ;
1054
1055 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1056 ! 11 - Event Handling Functions
1057 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1058
1059 X-FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
1060 X-FUNCTION: Status XFlush ( Display* display ) ;
1061 X-FUNCTION: Status XSync ( Display* display, int discard ) ;
1062 X-FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
1063 X-FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
1064
1065 ! 11.3 - Event Queue Management
1066
1067 CONSTANT: QueuedAlready 0
1068 CONSTANT: QueuedAfterReading 1
1069 CONSTANT: QueuedAfterFlush 2
1070
1071 X-FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
1072 X-FUNCTION: int XPending ( Display* display ) ;
1073
1074 ! 11.6 - Sending Events to Other Applications
1075
1076 X-FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
1077
1078 ! 11.8 - Handling Protocol Errors
1079
1080 X-FUNCTION: int XSetErrorHandler ( void* handler ) ;
1081
1082 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1083 ! 12 - Input Device Functions
1084 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1085
1086 CONSTANT: None 0
1087
1088 X-FUNCTION: int XGrabPointer (
1089   Display* display,
1090   Window grab_window,
1091   Bool owner_events,
1092   uint event_mask,
1093   int pointer_mode,
1094   int keyboard_mode,
1095   Window confine_to,
1096   Cursor cursor,
1097   Time time ) ;
1098
1099 X-FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
1100 X-FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
1101 X-FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
1102 X-FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
1103
1104 X-FUNCTION: Status XGetInputFocus ( Display* display,
1105                                   Window*  focus_return,
1106                                   int*     revert_to_return ) ;
1107
1108 X-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 ) ;
1109
1110 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1111 ! 14 - Inter-Client Communication Functions
1112 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1113
1114 ! 14.1 Client to Window Manager Communication
1115
1116 X-FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
1117 X-FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
1118
1119 ! 14.1.1.  Manipulating Top-Level Windows
1120
1121 X-FUNCTION: Status XIconifyWindow (
1122         Display* display, Window w, int screen_number ) ;
1123
1124 X-FUNCTION: Status XWithdrawWindow (
1125         Display* display, Window w, int screen_number ) ;
1126
1127 ! 14.1.6 - Setting and Reading the WM_HINTS Property
1128
1129 ! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
1130
1131 : USPosition   ( -- n ) 0 2^ ; inline
1132 : USSize       ( -- n ) 1 2^ ; inline
1133 : PPosition    ( -- n ) 2 2^ ; inline
1134 : PSize        ( -- n ) 3 2^ ; inline
1135 : PMinSize     ( -- n ) 4 2^ ; inline
1136 : PMaxSize     ( -- n ) 5 2^ ; inline
1137 : PResizeInc   ( -- n ) 6 2^ ; inline
1138 : PAspect      ( -- n ) 7 2^ ; inline
1139 : PBaseSize    ( -- n ) 8 2^ ; inline
1140 : PWinGravity  ( -- n ) 9 2^ ; inline
1141 : PAllHints    ( -- n )
1142     { PPosition PSize PMinSize PMaxSize PResizeInc PAspect } flags ; foldable
1143
1144 STRUCT: XSizeHints
1145     { flags long }
1146     { x int }
1147     { y int }
1148     { width int }
1149     { height int }
1150     { min_width int }
1151     { min_height int }
1152     { max_width int }
1153     { max_height int }
1154     { width_inc int }
1155     { height_inc int }
1156     { min_aspect_x int }
1157     { min_aspect_y int }
1158     { max_aspect_x int }
1159     { max_aspect_y int }
1160     { base_width int }
1161     { base_height int }
1162     { win_gravity int } ;
1163
1164 ! 14.1.10.  Setting and Reading the WM_PROTOCOLS Property
1165
1166 X-FUNCTION: Status XSetWMProtocols (
1167         Display* display, Window w, Atom* protocols, int count ) ;
1168
1169 X-FUNCTION: Status XGetWMProtocols (
1170         Display* display,
1171         Window w,
1172         Atom** protocols_return,
1173         int* count_return ) ;
1174
1175 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1176 ! 16 - Application Utility Functions
1177 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1178
1179 ! 16.1 Keyboard Utility Functions
1180
1181 X-FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
1182
1183 X-FUNCTION: int XLookupString (
1184         XKeyEvent* event_struct,
1185         void* buffer_return,
1186         int bytes_buffer,
1187         KeySym* keysym_return,
1188         XComposeStatus* status_in_out ) ;
1189
1190 ! 16.7 Determining the Appropriate Visual Type
1191
1192 CONSTANT: VisualNoMask                  HEX: 0
1193 CONSTANT: VisualIDMask                  HEX: 1
1194 CONSTANT: VisualScreenMask              HEX: 2
1195 CONSTANT: VisualDepthMask               HEX: 4
1196 CONSTANT: VisualClassMask               HEX: 8
1197 CONSTANT: VisualRedMaskMask             HEX: 10
1198 CONSTANT: VisualGreenMaskMask           HEX: 20
1199 CONSTANT: VisualBlueMaskMask            HEX: 40
1200 CONSTANT: VisualColormapSizeMask        HEX: 80
1201 CONSTANT: VisualBitsPerRGBMask          HEX: 100
1202 CONSTANT: VisualAllMask                 HEX: 1FF
1203
1204 STRUCT: XVisualInfo
1205         { visual Visual* }
1206         { visualid VisualID }
1207         { screen int }
1208         { depth uint }
1209         { class int }
1210         { red_mask ulong }
1211         { green_mask ulong }
1212         { blue_mask ulong }
1213         { colormap_size int }
1214         { bits_per_rgb int } ;
1215
1216 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1217 ! Appendix D - Compatibility Functions
1218 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1219
1220 X-FUNCTION: Status XSetStandardProperties (
1221         Display* display,
1222         Window w,
1223         char* window_name,
1224         char* icon_name,
1225         Pixmap icon_pixmap,
1226         char** argv,
1227         int argc,
1228         XSizeHints* hints ) ;
1229
1230 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1231
1232 CONSTANT: XA_PRIMARY  1
1233 CONSTANT: XA_SECONDARY 2
1234 CONSTANT: XA_ARC 3
1235 CONSTANT: XA_ATOM 4
1236 CONSTANT: XA_BITMAP 5
1237 CONSTANT: XA_CARDINAL 6
1238 CONSTANT: XA_COLORMAP 7
1239 CONSTANT: XA_CURSOR 8
1240 CONSTANT: XA_CUT_BUFFER0 9
1241 CONSTANT: XA_CUT_BUFFER1 10
1242 CONSTANT: XA_CUT_BUFFER2 11
1243 CONSTANT: XA_CUT_BUFFER3 12
1244 CONSTANT: XA_CUT_BUFFER4 13
1245 CONSTANT: XA_CUT_BUFFER5 14
1246 CONSTANT: XA_CUT_BUFFER6 15
1247 CONSTANT: XA_CUT_BUFFER7 16
1248 CONSTANT: XA_DRAWABLE 17
1249 CONSTANT: XA_FONT 18
1250 CONSTANT: XA_INTEGER 19
1251 CONSTANT: XA_PIXMAP 20
1252 CONSTANT: XA_POINT 21
1253 CONSTANT: XA_RECTANGLE 22
1254 CONSTANT: XA_RESOURCE_MANAGER 23
1255 CONSTANT: XA_RGB_COLOR_MAP 24
1256 CONSTANT: XA_RGB_BEST_MAP 25
1257 CONSTANT: XA_RGB_BLUE_MAP 26
1258 CONSTANT: XA_RGB_DEFAULT_MAP 27
1259 CONSTANT: XA_RGB_GRAY_MAP 28
1260 CONSTANT: XA_RGB_GREEN_MAP 29
1261 CONSTANT: XA_RGB_RED_MAP 30
1262 CONSTANT: XA_STRING 31
1263 CONSTANT: XA_VISUALID 32
1264 CONSTANT: XA_WINDOW 33
1265 CONSTANT: XA_WM_COMMAND 34
1266 CONSTANT: XA_WM_HINTS 35
1267 CONSTANT: XA_WM_CLIENT_MACHINE 36
1268 CONSTANT: XA_WM_ICON_NAME 37
1269 CONSTANT: XA_WM_ICON_SIZE 38
1270 CONSTANT: XA_WM_NAME 39
1271 CONSTANT: XA_WM_NORMAL_HINTS 40
1272 CONSTANT: XA_WM_SIZE_HINTS 41
1273 CONSTANT: XA_WM_ZOOM_HINTS 42
1274 CONSTANT: XA_MIN_SPACE 43
1275 CONSTANT: XA_NORM_SPACE 44
1276 CONSTANT: XA_MAX_SPACE 45
1277 CONSTANT: XA_END_SPACE 46
1278 CONSTANT: XA_SUPERSCRIPT_X 47
1279 CONSTANT: XA_SUPERSCRIPT_Y 48
1280 CONSTANT: XA_SUBSCRIPT_X 49
1281 CONSTANT: XA_SUBSCRIPT_Y 50
1282 CONSTANT: XA_UNDERLINE_POSITION 51
1283 CONSTANT: XA_UNDERLINE_THICKNESS 52
1284 CONSTANT: XA_STRIKEOUT_ASCENT 53
1285 CONSTANT: XA_STRIKEOUT_DESCENT 54
1286 CONSTANT: XA_ITALIC_ANGLE 55
1287 CONSTANT: XA_X_HEIGHT 56
1288 CONSTANT: XA_QUAD_WIDTH 57
1289 CONSTANT: XA_WEIGHT 58
1290 CONSTANT: XA_POINT_SIZE 59
1291 CONSTANT: XA_RESOLUTION 60
1292 CONSTANT: XA_COPYRIGHT 61
1293 CONSTANT: XA_NOTICE 62
1294 CONSTANT: XA_FONT_NAME 63
1295 CONSTANT: XA_FAMILY_NAME 64
1296 CONSTANT: XA_FULL_NAME 65
1297 CONSTANT: XA_CAP_HEIGHT 66
1298 CONSTANT: XA_WM_CLASS 67
1299 CONSTANT: XA_WM_TRANSIENT_FOR 68
1300
1301 CONSTANT: XA_LAST_PREDEFINED 68
1302     
1303 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1304 ! The rest of the stuff is not from the book.
1305 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1306
1307 X-FUNCTION: void XFree ( void* data ) ;
1308 X-FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
1309 X-FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
1310 X-FUNCTION: int XBell ( Display* display, int percent ) ;
1311
1312 ! !!! INPUT METHODS
1313
1314 CONSTANT: XIMPreeditArea      HEX: 0001
1315 CONSTANT: XIMPreeditCallbacks HEX: 0002
1316 CONSTANT: XIMPreeditPosition  HEX: 0004
1317 CONSTANT: XIMPreeditNothing   HEX: 0008
1318 CONSTANT: XIMPreeditNone      HEX: 0010
1319 CONSTANT: XIMStatusArea       HEX: 0100
1320 CONSTANT: XIMStatusCallbacks  HEX: 0200
1321 CONSTANT: XIMStatusNothing    HEX: 0400
1322 CONSTANT: XIMStatusNone       HEX: 0800
1323
1324 CONSTANT: XNVaNestedList "XNVaNestedList"
1325 CONSTANT: XNQueryInputStyle "queryInputStyle"
1326 CONSTANT: XNClientWindow "clientWindow"
1327 CONSTANT: XNInputStyle "inputStyle"
1328 CONSTANT: XNFocusWindow "focusWindow"
1329 CONSTANT: XNResourceName "resourceName"
1330 CONSTANT: XNResourceClass "resourceClass"
1331 CONSTANT: XNGeometryCallback "geometryCallback"
1332 CONSTANT: XNDestroyCallback "destroyCallback"
1333 CONSTANT: XNFilterEvents "filterEvents"
1334 CONSTANT: XNPreeditStartCallback "preeditStartCallback"
1335 CONSTANT: XNPreeditDoneCallback "preeditDoneCallback"
1336 CONSTANT: XNPreeditDrawCallback "preeditDrawCallback"
1337 CONSTANT: XNPreeditCaretCallback "preeditCaretCallback"
1338 CONSTANT: XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
1339 CONSTANT: XNPreeditAttributes "preeditAttributes"
1340 CONSTANT: XNStatusStartCallback "statusStartCallback"
1341 CONSTANT: XNStatusDoneCallback "statusDoneCallback"
1342 CONSTANT: XNStatusDrawCallback "statusDrawCallback"
1343 CONSTANT: XNStatusAttributes "statusAttributes"
1344 CONSTANT: XNArea "area"
1345 CONSTANT: XNAreaNeeded "areaNeeded"
1346 CONSTANT: XNSpotLocation "spotLocation"
1347 CONSTANT: XNColormap "colorMap"
1348 CONSTANT: XNStdColormap "stdColorMap"
1349 CONSTANT: XNForeground "foreground"
1350 CONSTANT: XNBackground "background"
1351 CONSTANT: XNBackgroundPixmap "backgroundPixmap"
1352 CONSTANT: XNFontSet "fontSet"
1353 CONSTANT: XNLineSpace "lineSpace"
1354 CONSTANT: XNCursor "cursor"
1355
1356 CONSTANT: XNQueryIMValuesList "queryIMValuesList"
1357 CONSTANT: XNQueryICValuesList "queryICValuesList"
1358 CONSTANT: XNVisiblePosition "visiblePosition"
1359 CONSTANT: XNR6PreeditCallback "r6PreeditCallback"
1360 CONSTANT: XNStringConversionCallback "stringConversionCallback"
1361 CONSTANT: XNStringConversion "stringConversion"
1362 CONSTANT: XNResetState "resetState"
1363 CONSTANT: XNHotKey "hotKey"
1364 CONSTANT: XNHotKeyState "hotKeyState"
1365 CONSTANT: XNPreeditState "preeditState"
1366 CONSTANT: XNSeparatorofNestedList "separatorofNestedList"
1367
1368 CONSTANT: XBufferOverflow -1
1369 CONSTANT: XLookupNone      1
1370 CONSTANT: XLookupChars     2
1371 CONSTANT: XLookupKeySym    3
1372 CONSTANT: XLookupBoth      4
1373
1374 X-FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
1375
1376 X-FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ;
1377
1378 X-FUNCTION: Status XCloseIM ( XIM im ) ;
1379
1380 X-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 ) ;
1381
1382 X-FUNCTION: void XDestroyIC ( XIC ic ) ;
1383
1384 X-FUNCTION: void XSetICFocus ( XIC ic ) ;
1385         
1386 X-FUNCTION: void XUnsetICFocus ( XIC ic ) ;
1387
1388 X-FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
1389
1390 X-FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
1391
1392 ! !!! category of setlocale
1393 CONSTANT: LC_ALL      0
1394 CONSTANT: LC_COLLATE  1
1395 CONSTANT: LC_CTYPE    2
1396 CONSTANT: LC_MONETARY 3
1397 CONSTANT: LC_NUMERIC  4
1398 CONSTANT: LC_TIME     5
1399
1400 X-FUNCTION: char* setlocale ( int category, char* name ) ;
1401
1402 X-FUNCTION: Bool XSupportsLocale ( ) ;
1403
1404 X-FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ;