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