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