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