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