]> gitweb.factorcode.org Git - factor.git/commitdiff
x11 and ui.backend.x11: update to use new structs
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 31 Aug 2009 03:55:19 +0000 (22:55 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 31 Aug 2009 03:55:19 +0000 (22:55 -0500)
basis/ui/backend/x11/x11.factor
basis/x11/clipboard/clipboard.factor
basis/x11/events/events.factor
basis/x11/windows/windows.factor
basis/x11/xlib/xlib.factor

index aca80cbc96bd23a368ce81aaca4a521d214a9a05..fcaf0e2a702d6523061aad1906b058cd3714d3f8 100755 (executable)
@@ -1,14 +1,13 @@
 ! Copyright (C) 2005, 2009 Eduardo Cavazos and Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types arrays ui ui.private ui.gadgets
-ui.gadgets.private ui.gestures ui.backend ui.clipboards
-ui.gadgets.worlds ui.render ui.event-loop assocs kernel math
-namespaces opengl sequences strings x11 x11.xlib x11.events x11.xim
-x11.glx x11.clipboard x11.constants x11.windows x11.io
-io.encodings.string io.encodings.ascii io.encodings.utf8 combinators
-command-line math.vectors classes.tuple opengl.gl threads
-math.rectangles environment ascii literals
-ui.pixel-formats ui.pixel-formats.private ;
+USING: accessors alien.c-types arrays ascii assocs
+classes.struct combinators io.encodings.ascii
+io.encodings.string io.encodings.utf8 kernel literals math
+namespaces sequences strings ui ui.backend ui.clipboards
+ui.event-loop ui.gadgets ui.gadgets.private ui.gadgets.worlds
+ui.gestures ui.pixel-formats ui.pixel-formats.private
+ui.private x11 x11.clipboard x11.constants x11.events x11.glx
+x11.io x11.windows x11.xim x11.xlib environment command-line ;
 IN: ui.backend.x11
 
 SINGLETON: x11-ui-backend
@@ -25,8 +24,7 @@ C: <x11-pixmap-handle> x11-pixmap-handle
 M: world expose-event nip relayout ;
 
 M: world configure-event
-    over configured-loc >>window-loc
-    swap configured-dim >>dim
+    swap [ event-loc >>window-loc ] [ event-dim >>dim ] bi
     ! In case dimensions didn't change
     relayout-1 ;
 
@@ -103,7 +101,7 @@ CONSTANT: key-codes
     dup key-codes at [ t ] [ 1string f ] ?if ;
 
 : event-modifiers ( event -- seq )
-    XKeyEvent-state modifiers modifier ;
+    state>> modifiers modifier ;
 
 : valid-input? ( string gesture -- ? )
     over empty? [ 2drop f ] [
@@ -132,10 +130,7 @@ M: world key-up-event
     [ key-up-event>gesture ] dip propagate-key-gesture ;
 
 : mouse-event>gesture ( event -- modifiers button loc )
-    [ event-modifiers ]
-    [ XButtonEvent-button ]
-    [ mouse-event-loc ]
-    tri ;
+    [ event-modifiers ] [ button>> ] [ event-loc ] tri ;
 
 M: world button-down-event
     [ mouse-event>gesture [ <button-down> ] dip ] dip
@@ -146,7 +141,7 @@ M: world button-up-event
     send-button-up ;
 
 : mouse-event>scroll-direction ( event -- pair )
-    XButtonEvent-button {
+    button>> {
         { 4 { 0 -1 } }
         { 5 { 0 1 } }
         { 6 { -1 0 } }
@@ -154,7 +149,7 @@ M: world button-up-event
     } at ;
 
 M: world wheel-event
-    [ [ mouse-event>scroll-direction ] [ mouse-event-loc ] bi ] dip
+    [ [ mouse-event>scroll-direction ] [ event-loc ] bi ] dip
     send-wheel ;
 
 M: world enter-event motion-event ;
@@ -162,16 +157,13 @@ M: world enter-event motion-event ;
 M: world leave-event 2drop forget-rollover ;
 
 M: world motion-event
-    [ [ XMotionEvent-x ] [ XMotionEvent-y ] bi 2array ] dip
-    move-hand fire-motion ;
+    [ event-loc ] dip move-hand fire-motion ;
 
 M: world focus-in-event
-    nip
-    [ handle>> xic>> XSetICFocus ] [ focus-world ] bi ;
+    nip [ handle>> xic>> XSetICFocus ] [ focus-world ] bi ;
 
 M: world focus-out-event
-    nip
-    [ handle>> xic>> XUnsetICFocus ] [ unfocus-world ] bi ;
+    nip [ handle>> xic>> XUnsetICFocus ] [ unfocus-world ] bi ;
 
 M: world selection-notify-event
     [ handle>> window>> selection-from-event ] keep
@@ -189,22 +181,18 @@ M: world selection-notify-event
     } case ;
 
 : encode-clipboard ( string type -- bytes )
-    XSelectionRequestEvent-target
-    XA_UTF8_STRING = utf8 ascii ? encode ;
+    target>> XA_UTF8_STRING = utf8 ascii ? encode ;
 
 : set-selection-prop ( evt -- )
     dpy get swap
-    [ XSelectionRequestEvent-requestor ] keep
-    [ XSelectionRequestEvent-property ] keep
-    [ XSelectionRequestEvent-target ] keep
-    [ 8 PropModeReplace ] dip
-    [
-        XSelectionRequestEvent-selection
-        clipboard-for-atom contents>>
-    ] keep encode-clipboard dup length XChangeProperty drop ;
+    [ requestor>> ] keep
+    [ property>> ] keep
+    [ target>> 8 PropModeReplace ] keep
+    [ selection>> clipboard-for-atom contents>> ] keep
+    encode-clipboard dup length XChangeProperty drop ;
 
 M: world selection-request-event
-    drop dup XSelectionRequestEvent-target {
+    drop dup target>> {
         { [ dup supported-type? ] [ drop dup set-selection-prop send-notify-success ] }
         { [ dup "TARGETS" x-atom = ] [ drop dup set-targets-prop send-notify-success ] }
         { [ dup "TIMESTAMP" x-atom = ] [ drop dup set-timestamp-prop send-notify-success ] }
@@ -235,7 +223,7 @@ M: world client-event
     ] [ wait-for-display wait-event ] if ;
 
 M: x11-ui-backend do-events
-    wait-event dup XAnyEvent-window window dup
+    wait-event dup window>> window dup
     [ handle-event ] [ 2drop ] if ;
 
 : x-clipboard@ ( gadget clipboard -- prop win )
@@ -269,17 +257,13 @@ M: x11-ui-backend set-title ( string world -- )
     [ dpy get ] 2dip [ set-title-old ] [ set-title-new ] 3bi ;
 
 M: x11-ui-backend (set-fullscreen) ( world ? -- )
-    [
-        handle>> window>> "XClientMessageEvent" <c-object>
-        [ set-XClientMessageEvent-window ] keep
-    ] dip
-    _NET_WM_STATE_ADD _NET_WM_STATE_REMOVE ?
-    over set-XClientMessageEvent-data0
-    ClientMessage over set-XClientMessageEvent-type
-    dpy get over set-XClientMessageEvent-display
-    "_NET_WM_STATE" x-atom over set-XClientMessageEvent-message_type
-    32 over set-XClientMessageEvent-format
-    "_NET_WM_STATE_FULLSCREEN" x-atom over set-XClientMessageEvent-data1
+    XClientMessageEvent <struct>
+    swap _NET_WM_STATE_ADD _NET_WM_STATE_REMOVE ? >>data0
+    swap handle>> window>> >>window
+    dpy get >>display
+    "_NET_WM_STATE" x-atom >>message_type
+    32 >>format
+    "_NET_WM_STATE_FULLSCREEN" x-atom >>data1
     [ dpy get root get 0 SubstructureNotifyMask ] dip XSendEvent drop ;
 
 M: x11-ui-backend (open-window) ( world -- )
@@ -312,9 +296,9 @@ M: x11-pixmap-handle flush-gl-context ( handle -- )
     drop ;
 
 M: x11-ui-backend (open-offscreen-buffer) ( world -- )
-    dup [ [ dim>> ] [ handle>> ] bi* glx-pixmap ]
-    with-world-pixel-format
+    dup [ [ dim>> ] [ handle>> ] bi* glx-pixmap ] with-world-pixel-format
     <x11-pixmap-handle> >>handle drop ;
+
 M: x11-ui-backend (close-offscreen-buffer) ( handle -- )
     dpy get swap
     [ glx-pixmap>> glXDestroyGLXPixmap ]
index 20bf66c70484aaf0d5b0b811129ecc7bfee6b499..5cf645344371637ccb6a7daf4b21b0272bc434eb 100644 (file)
@@ -1,9 +1,8 @@
 ! Copyright (C) 2006, 2007 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types alien.strings alien.syntax arrays
-kernel math namespaces sequences io.encodings.string
-io.encodings.utf8 io.encodings.ascii x11 x11.xlib x11.constants
-specialized-arrays.int accessors ;
+USING: accessors alien.c-types alien.strings classes.struct
+io.encodings.utf8 kernel namespaces sequences
+specialized-arrays.int x11 x11.constants x11.xlib ;
 IN: x11.clipboard
 
 ! This code was based on by McCLIM's Backends/CLX/port.lisp
@@ -34,20 +33,15 @@ TUPLE: x-clipboard atom contents ;
     [ XGetWindowProperty drop ] keep snarf-property ;
 
 : selection-from-event ( event window -- string )
-    swap XSelectionEvent-property zero? [
-        drop f
-    ] [
-        selection-property 1 window-property
-    ] if ;
+    swap property>> 0 =
+    [ drop f ] [ selection-property 1 window-property ] if ;
 
 : own-selection ( prop win -- )
     [ dpy get ] 2dip CurrentTime XSetSelectionOwner drop
     flush-dpy ;
 
 : set-targets-prop ( evt -- )
-    dpy get swap
-    [ XSelectionRequestEvent-requestor ] keep
-    XSelectionRequestEvent-property
+    [ dpy get ] dip [ requestor>> ] [ property>> ] bi
     "TARGETS" x-atom 32 PropModeReplace
     {
         "UTF8_STRING" "STRING" "TARGETS" "TIMESTAMP"
@@ -55,28 +49,27 @@ TUPLE: x-clipboard atom contents ;
     4 XChangeProperty drop ;
 
 : set-timestamp-prop ( evt -- )
-    dpy get swap
-    [ XSelectionRequestEvent-requestor ] keep
-    [ XSelectionRequestEvent-property ] keep
-    [ "TIMESTAMP" x-atom 32 PropModeReplace ] dip
-    XSelectionRequestEvent-time <int>
+    [ dpy get ] dip
+    [ requestor>> ]
+    [ property>> "TIMESTAMP" x-atom 32 PropModeReplace ]
+    [ time>> <int> ] tri
     1 XChangeProperty drop ;
 
 : send-notify ( evt prop -- )
-    "XSelectionEvent" <c-object>
-    SelectionNotify over set-XSelectionEvent-type
-    [ set-XSelectionEvent-property ] keep
-    over XSelectionRequestEvent-display   over set-XSelectionEvent-display
-    over XSelectionRequestEvent-requestor over set-XSelectionEvent-requestor
-    over XSelectionRequestEvent-selection over set-XSelectionEvent-selection
-    over XSelectionRequestEvent-target    over set-XSelectionEvent-target
-    over XSelectionRequestEvent-time      over set-XSelectionEvent-time
-    [ dpy get swap XSelectionRequestEvent-requestor 0 0 ] dip
+    XSelectionEvent <struct>
+    SelectionNotify >>type
+    swap >>property
+    over display>>   >>display
+    over requestor>> >>requestor
+    over selection>> >>selection
+    over target>>    >>target
+    over time>>      >>time
+    [ [ dpy get ] dip requestor>> 0 0 ] dip
     XSendEvent drop
     flush-dpy ;
 
 : send-notify-success ( evt -- )
-    dup XSelectionRequestEvent-property send-notify ;
+    dup property>> send-notify ;
 
 : send-notify-failure ( evt -- )
     0 send-notify ;
index 5673dd7f76a201a8772e58776da263de16738bba..a24f6a45aad65b3b4dd0eb3484ef766b5ce86fd2 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types arrays hashtables io kernel math
-math.order namespaces prettyprint sequences strings combinators
-x11 x11.xlib ;
+USING: accessors arrays classes.struct combinators kernel
+math.order namespaces x11 x11.xlib ;
 IN: x11.events
 
 GENERIC: expose-event ( event window -- )
@@ -36,14 +35,14 @@ GENERIC: selection-request-event ( event window -- )
 GENERIC: client-event ( event window -- )
 
 : next-event ( -- event )
-    dpy get "XEvent" <c-object> [ XNextEvent drop ] keep ;
+    dpy get XEvent <struct> [ XNextEvent drop ] keep ;
 
 : mask-event ( mask -- event )
-    [ dpy get ] dip "XEvent" <c-object> [ XMaskEvent drop ] keep ;
+    [ dpy get ] dip XEvent <struct> [ XMaskEvent drop ] keep ;
 
 : events-queued ( mode -- n ) [ dpy get ] dip XEventsQueued ;
 
-: wheel? ( event -- ? ) XButtonEvent-button 4 7 between? ;
+: wheel? ( event -- ? ) button>> 4 7 between? ;
 
 : button-down-event$ ( event window -- )
     over wheel? [ wheel-event ] [ button-down-event ] if ;
@@ -52,34 +51,31 @@ GENERIC: client-event ( event window -- )
     over wheel? [ 2drop ] [ button-up-event ] if ;
 
 : handle-event ( event window -- )
-    over XAnyEvent-type {
-        { Expose [ expose-event ] }
-        { ConfigureNotify [ configure-event ] }
-        { ButtonPress [ button-down-event$ ] }
-        { ButtonRelease [ button-up-event$ ] }
-        { EnterNotify [ enter-event ] }
-        { LeaveNotify [ leave-event ] }
-        { MotionNotify [ motion-event ] }
-        { KeyPress [ key-down-event ] }
-        { KeyRelease [ key-up-event ] }
-        { FocusIn [ focus-in-event ] }
-        { FocusOut [ focus-out-event ] }
-        { SelectionNotify [ selection-notify-event ] }
-        { SelectionRequest [ selection-request-event ] }
-        { ClientMessage [ client-event ] }
+    over type>> {
+        { Expose [ XExposeEvent>> expose-event ] }
+        { ConfigureNotify [ XConfigureEvent>> configure-event ] }
+        { ButtonPress [ XButtonEvent>> button-down-event$ ] }
+        { ButtonRelease [ XButtonEvent>> button-up-event$ ] }
+        { EnterNotify [ XCrossingEvent>> enter-event ] }
+        { LeaveNotify [ XCrossingEvent>> leave-event ] }
+        { MotionNotify [ XMotionEvent>> motion-event ] }
+        { KeyPress [ XKeyEvent>> key-down-event ] }
+        { KeyRelease [ XKeyEvent>> key-up-event ] }
+        { FocusIn [ XFocusChangeEvent>> focus-in-event ] }
+        { FocusOut [ XFocusChangeEvent>> focus-out-event ] }
+        { SelectionNotify [ XSelectionEvent>> selection-notify-event ] }
+        { SelectionRequest [ XSelectionRequestEvent>> selection-request-event ] }
+        { ClientMessage [ XClientMessageEvent>> client-event ] }
         [ 3drop ]
     } case ;
 
-: configured-loc ( event -- dim )
-    [ XConfigureEvent-x ] [ XConfigureEvent-y ] bi 2array ;
+: event-loc ( event -- loc )
+    [ x>> ] [ y>> ] bi 2array ;
 
-: configured-dim ( event -- dim )
-    [ XConfigureEvent-width ] [ XConfigureEvent-height ] bi 2array ;
-
-: mouse-event-loc ( event -- loc )
-    [ XButtonEvent-x ] [ XButtonEvent-y ] bi 2array ;
+: event-dim ( event -- dim )
+    [ width>> ] [ height>> ] bi 2array ;
 
 : close-box? ( event -- ? )
-    [ XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom = ]
-    [ XClientMessageEvent-data0 "WM_DELETE_WINDOW" x-atom = ]
+    [ message_type>> "WM_PROTOCOLS" x-atom = ]
+    [ data0>> "WM_DELETE_WINDOW" x-atom = ]
     bi and ;
index 54cf205c144e8bb2a0bf96268208fcad1a5c08e7..ad0a8b11a67e06aef97f7add0082c4b8864056b4 100644 (file)
@@ -1,15 +1,15 @@
 ! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types hashtables kernel math math.vectors
-math.bitwise namespaces sequences x11 x11.xlib x11.constants x11.glx
-arrays fry ;
+USING: accessors kernel math math.bitwise math.vectors
+namespaces sequences x11 x11.xlib x11.constants x11.glx arrays
+fry classes.struct ;
 IN: x11.windows
 
 : create-window-mask ( -- n )
     { CWBackPixel CWBorderPixel CWColormap CWEventMask } flags ;
 
 : create-colormap ( visinfo -- colormap )
-    [ dpy get root get ] dip XVisualInfo-visual AllocNone
+    [ dpy get root get ] dip visual>> AllocNone
     XCreateColormap ;
 
 : event-mask ( -- n )
@@ -28,15 +28,15 @@ IN: x11.windows
     } flags ;
 
 : window-attributes ( visinfo -- attributes )
-    "XSetWindowAttributes" <c-object>
-    0 over set-XSetWindowAttributes-background_pixel
-    0 over set-XSetWindowAttributes-border_pixel
-    [ [ create-colormap ] dip set-XSetWindowAttributes-colormap ] keep
-    event-mask over set-XSetWindowAttributes-event_mask ;
+    XSetWindowAttributes <struct>
+    0 >>background_pixel
+    0 >>border_pixel
+    event-mask >>event_mask
+    swap create-colormap >>colormap ;
 
 : set-size-hints ( window -- )
-    "XSizeHints" <c-object>
-    USPosition over set-XSizeHints-flags
+    XSizeHints <struct>
+    USPosition >>flags
     [ dpy get ] 2dip XSetWMNormalHints ;
 
 : auto-position ( window loc -- )
@@ -47,8 +47,8 @@ IN: x11.windows
 : create-window ( loc dim visinfo -- window )
     pick [
         [ [ [ dpy get root get ] dip >xy ] dip { 1 1 } vmax >xy 0 ] dip
-        [ XVisualInfo-depth InputOutput ] keep
-        [ XVisualInfo-visual create-window-mask ] keep
+        [ depth>> InputOutput ] keep
+        [ visual>> create-window-mask ] keep
         window-attributes XCreateWindow
         dup
     ] dip auto-position ;
index c8a4bfa0dc88fbd56a5e3f6276d9b9b9ab000880..48d556de1ddb28b6a4374b77c26cca506154f56b 100644 (file)
 ! add to this library and are wondering what part of the file to
 ! modify, just find the function or data structure in the manual
 ! and note the section.
-
-USING: kernel arrays alien alien.c-types alien.strings
-alien.syntax math math.bitwise words sequences namespaces
-continuations io io.encodings.ascii x11.syntax ;
+USING: accessors kernel arrays alien alien.c-types alien.strings
+alien.syntax classes.struct math math.bitwise words sequences
+namespaces continuations io io.encodings.ascii x11.syntax ;
 IN: x11.xlib
 
 LIBRARY: xlib
@@ -66,10 +65,10 @@ ALIAS: *Atom *ulong
 !
 
 ! This struct is incomplete
-C-STRUCT: Display
-{ "void*" "ext_data" }
-{ "void*" "free_funcs" }
-{ "int" "fd" } ;
+STRUCT: Display
+{ ext_data void* }
+{ free_funcs void* }
+{ fd int } ;
 
 X-FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
 
@@ -114,22 +113,22 @@ X-FUNCTION: int XCloseDisplay ( Display* display ) ;
 : CWColormap         ( -- n ) 13 2^ ; inline
 : CWCursor           ( -- n ) 14 2^ ; inline
 
-C-STRUCT: XSetWindowAttributes
-        { "Pixmap" "background_pixmap" }
-        { "ulong" "background_pixel" }
-        { "Pixmap" "border_pixmap" }
-        { "ulong" "border_pixel" }
-        { "int" "bit_gravity" }
-        { "int" "win_gravity" }
-        { "int" "backing_store" }
-        { "ulong" "backing_planes" }
-        { "ulong" "backing_pixel" }
-        { "Bool" "save_under" }
-        { "long" "event_mask" }
-        { "long" "do_not_propagate_mask" }
-        { "Bool" "override_redirect" }
-        { "Colormap" "colormap" }
-        { "Cursor" "cursor" } ;
+STRUCT: XSetWindowAttributes
+{ background_pixmap Pixmap }
+{ background_pixel ulong }
+{ border_pixmap Pixmap }
+{ border_pixel ulong }
+{ bit_gravity int }
+{ win_gravity int }
+{ backing_store int }
+{ backing_planes ulong }
+{ backing_pixel ulong }
+{ save_under Bool }
+{ event_mask long }
+{ do_not_propagate_mask long }
+{ override_redirect Bool }
+{ colormap Colormap }
+{ cursor Cursor } ;
 
 CONSTANT: UnmapGravity          0
 
@@ -169,14 +168,14 @@ X-FUNCTION: int XMapRaised ( Display* display, Window w ) ;
 : CWSibling     ( -- n ) 5 2^ ; inline
 : CWStackMode   ( -- n ) 6 2^ ; inline
 
-C-STRUCT: XWindowChanges
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" "height" }
-        { "int" "border_width" }
-        { "Window" "sibling" }
-        { "int" "stack_mode" } ;
+STRUCT: XWindowChanges
+{ x int }
+{ y int }
+{ width int }
+{ height int }
+{ border_width int }
+{ sibling Window }
+{ stack_mode int } ;
 
 X-FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
 X-FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
@@ -211,30 +210,30 @@ X-FUNCTION: Status XQueryTree (
   Window* parent_return,
   Window** children_return, uint* nchildren_return ) ;
 
-C-STRUCT: XWindowAttributes
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" " height" }
-        { "int" "border_width" }
-        { "int" "depth" }
-        { "Visual*" "visual" }
-        { "Window" "root" }
-        { "int" "class" }
-        { "int" "bit_gravity" }
-        { "int" "win_gravity" }
-        { "int" "backing_store" }
-        { "ulong" "backing_planes" }
-        { "ulong" "backing_pixel" }
-        { "Bool" "save_under" }
-        { "Colormap" "colormap" }
-        { "Bool" "map_installed" }
-        { "int" "map_state" }
-        { "long" "all_event_masks" }
-        { "long" "your_event_mask" }
-        { "long" "do_not_propagate_mask" }
-        { "Bool" "override_redirect" }
-        { "Screen*" "screen" } ;
+STRUCT: XWindowAttributes
+{ x int }
+{ y int }
+{ width int }
+{  height int }
+{ border_width int }
+{ depth int }
+{ visual Visual* }
+{ root Window }
+{ class int }
+{ bit_gravity int }
+{ win_gravity int }
+{ backing_store int }
+{ backing_planes ulong }
+{ backing_pixel ulong }
+{ save_under Bool }
+{ colormap Colormap }
+{ map_installed Bool }
+{ map_state int }
+{ all_event_masks long }
+{ your_event_mask long }
+{ do_not_propagate_mask long }
+{ override_redirect Bool }
+{ screen Screen* } ;
 
 X-FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
 
@@ -292,13 +291,13 @@ X-FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap ) ;
 ! 6 - Color Management Functions
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XColor
-        { "ulong" "pixel" }
-        { "ushort" "red" }
-        { "ushort" "green" }
-        { "ushort" "blue" }
-        { "char" "flags" }
-        { "char" "pad" } ;
+STRUCT: XColor
+{ pixel ulong }
+{ red ushort }
+{ green ushort }
+{ blue ushort }
+{ flags char }
+{ pad char } ;
 
 X-FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
 X-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
@@ -353,30 +352,30 @@ CONSTANT: GXorInverted          HEX: d
 CONSTANT: GXnand                HEX: e
 CONSTANT: GXset                 HEX: f
 
-C-STRUCT: XGCValues
-        { "int" "function" }
-        { "ulong" "plane_mask" }
-        { "ulong" "foreground" }
-        { "ulong" "background" }
-        { "int" "line_width" }
-        { "int" "line_style" }
-        { "int" "cap_style" }
-        { "int" "join_style" }
-        { "int" "fill_style" }
-        { "int" "fill_rule" }
-        { "int" "arc_mode" }
-        { "Pixmap" "tile" }
-        { "Pixmap" "stipple" }
-        { "int" "ts_x_origin" }
-        { "int" "ts_y_origin" }
-        { "Font" "font" }
-        { "int" "subwindow_mode" }
-        { "Bool" "graphics_exposures" }
-        { "int" "clip_x_origin" }
-        { "int" "clip_y_origin" }
-        { "Pixmap" "clip_mask" }
-        { "int" "dash_offset" }
-        { "char" "dashes" } ;
+STRUCT: XGCValues
+{ function int }
+{ plane_mask ulong }
+{ foreground ulong }
+{ background ulong }
+{ line_width int }
+{ line_style int }
+{ cap_style int }
+{ join_style int }
+{ fill_style int }
+{ fill_rule int }
+{ arc_mode int }
+{ tile Pixmap }
+{ stipple Pixmap }
+{ ts_x_origin int }
+{ ts_y_origin int }
+{ font Font }
+{ subwindow_mode int }
+{ graphics_exposures Bool }
+{ clip_x_origin int }
+{ clip_y_origin int }
+{ clip_mask Pixmap }
+{ dash_offset int }
+{ dashes char } ;
 
 X-FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
 X-FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
@@ -402,35 +401,35 @@ X-FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y,
 
 ! 8.5 - Font Metrics
 
-C-STRUCT: XCharStruct
-        { "short" "lbearing" }
-        { "short" "rbearing" }
-        { "short" "width" }
-        { "short" "ascent" }
-        { "short" "descent" }
-        { "ushort" "attributes" } ;
+STRUCT: XCharStruct
+{ lbearing short }
+{ rbearing short }
+{ width short }
+{ ascent short }
+{ descent short }
+{ attributes ushort } ;
 
 X-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
 X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
 X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
 
-C-STRUCT: XFontStruct
-        { "XExtData*" "ext_data" }
-        { "Font" "fid" }
-        { "uint" "direction" }
-        { "uint" "min_char_or_byte2" }
-        { "uint" "max_char_or_byte2" }
-        { "uint" "min_byte1" }
-        { "uint" "max_byte1" }
-        { "Bool" "all_chars_exist" }
-        { "uint" "default_char" }
-        { "int" "n_properties" }
-        { "XFontProp*" "properties" }
-        { "XCharStruct" "min_bounds" }
-        { "XCharStruct" "max_bounds" }
-        { "XCharStruct*" "per_char" }
-        { "int" "ascent" }
-        { "int" "descent" } ;
+STRUCT: XFontStruct
+{ ext_data XExtData* }
+{ fid Font }
+{ direction uint }
+{ min_char_or_byte2 uint }
+{ max_char_or_byte2 uint }
+{ min_byte1 uint }
+{ max_byte1 uint }
+{ all_chars_exist Bool }
+{ default_char uint }
+{ n_properties int }
+{ properties XFontProp* }
+{ min_bounds XCharStruct }
+{ max_bounds XCharStruct }
+{ per_char XCharStruct* }
+{ ascent int }
+{ descent int } ;
 
 X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
 
@@ -449,41 +448,41 @@ X-FUNCTION: Status XDrawString (
 
 CONSTANT: AllPlanes -1
 
-C-STRUCT: XImage-funcs
-    { "void*" "create_image" }
-    { "void*" "destroy_image" }
-    { "void*" "get_pixel" }
-    { "void*" "put_pixel" }
-    { "void*" "sub_image" }
-    { "void*" "add_pixel" } ;
-
-C-STRUCT: XImage
-    { "int"          "width" }
-    { "int"          "height" }
-    { "int"          "xoffset" }
-    { "int"          "format" }
-    { "char*"        "data" }
-    { "int"          "byte_order" }
-    { "int"          "bitmap_unit" }
-    { "int"          "bitmap_bit_order" }
-    { "int"          "bitmap_pad" }
-    { "int"          "depth" }
-    { "int"          "bytes_per_line" }
-    { "int"          "bits_per_pixel" }
-    { "ulong"        "red_mask" }
-    { "ulong"        "green_mask" }
-    { "ulong"        "blue_mask" }
-    { "XPointer"     "obdata" }
-    { "XImage-funcs" "f" } ;
+STRUCT: XImage-funcs
+{ create_image void* }
+{ destroy_image void* }
+{ get_pixel void* }
+{ put_pixel void* }
+{ sub_image void* }
+{ add_pixel void* } ;
+
+STRUCT: XImage
+{ width int }
+{ height int }
+{ xoffset int }
+{ format int }
+{ data char* }
+{ byte_order int }
+{ bitmap_unit int }
+{ bitmap_bit_order int }
+{ bitmap_pad int }
+{ depth int }
+{ bytes_per_line int }
+{ bits_per_pixel int }
+{ red_mask ulong }
+{ green_mask ulong }
+{ blue_mask ulong }
+{ obdata XPointer }
+{ f XImage-funcs } ;
 
 X-FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format ) ;
 X-FUNCTION: int XDestroyImage ( XImage* ximage ) ;
 
 : XImage-size ( ximage -- size )
-    [ XImage-height ] [ XImage-bytes_per_line ] bi * ;
+    [ height>> ] [ bytes_per_line>> ] bi * ;
 
 : XImage-pixels ( ximage -- byte-array )
-    [ XImage-data ] [ XImage-size ] bi memory>byte-array ;
+    [ data>> ] [ XImage-size ] bi memory>byte-array ;
 
 !
 ! 9 - Window and Session Manager Functions
@@ -536,11 +535,11 @@ CONSTANT: ButtonRelease         5
 CONSTANT: MotionNotify          6
 CONSTANT: EnterNotify           7
 CONSTANT: LeaveNotify           8
-CONSTANT: FocusIn                       9
+CONSTANT: FocusIn               9
 CONSTANT: FocusOut              10
 CONSTANT: KeymapNotify          11
-CONSTANT: Expose                        12
-CONSTANT: GraphicsExpose                13
+CONSTANT: Expose                12
+CONSTANT: GraphicsExpose        13
 CONSTANT: NoExpose              14
 CONSTANT: VisibilityNotify      15
 CONSTANT: CreateNotify          16
@@ -548,28 +547,28 @@ CONSTANT: DestroyNotify         17
 CONSTANT: UnmapNotify           18
 CONSTANT: MapNotify             19
 CONSTANT: MapRequest            20
-CONSTANT: ReparentNotify                21
-CONSTANT: ConfigureNotify               22
+CONSTANT: ReparentNotify        21
+CONSTANT: ConfigureNotify       22
 CONSTANT: ConfigureRequest      23
 CONSTANT: GravityNotify         24
 CONSTANT: ResizeRequest         25
-CONSTANT: CirculateNotify               26
+CONSTANT: CirculateNotify       26
 CONSTANT: CirculateRequest      27
-CONSTANT: PropertyNotify                28
-CONSTANT: SelectionClear                29
+CONSTANT: PropertyNotify        28
+CONSTANT: SelectionClear        29
 CONSTANT: SelectionRequest      30
-CONSTANT: SelectionNotify               31
-CONSTANT: ColormapNotify                32
+CONSTANT: SelectionNotify       31
+CONSTANT: ColormapNotify        32
 CONSTANT: ClientMessage         33
 CONSTANT: MappingNotify         34
 CONSTANT: LASTEvent             35
 
-C-STRUCT: XAnyEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" } ;
+STRUCT: XAnyEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -596,22 +595,22 @@ CONSTANT: Button5 5
 : Mod4Mask    ( -- n ) 1 6 shift ; inline
 : Mod5Mask    ( -- n ) 1 7 shift ; inline
 
-C-STRUCT: XButtonEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Window" "root" }
-        { "Window" "subwindow" }
-        { "Time" "time" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "x_root" }
-        { "int" "y_root" }
-        { "uint" "state" }
-        { "uint" "button" }
-        { "Bool" "same_screen" } ;
+STRUCT: XButtonEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ root Window }
+{ subwindow Window }
+{ time Time }
+{ x int }
+{ y int }
+{ x_root int }
+{ y_root int }
+{ state uint }
+{ button uint }
+{ same_screen Bool } ;
 
 TYPEDEF: XButtonEvent XButtonPressedEvent
 TYPEDEF: XButtonEvent XButtonReleasedEvent
@@ -619,445 +618,438 @@ TYPEDEF: XButtonEvent XButtonReleasedEvent
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XKeyEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Window" "root" }
-        { "Window" "subwindow" }
-        { "Time" "time" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "x_root" }
-        { "int" "y_root" }
-        { "uint" "state" }
-        { "uint" "keycode" }
-        { "Bool" "same_screen" } ;
+STRUCT: XKeyEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ root Window }
+{ subwindow Window }
+{ time Time }
+{ x int }
+{ y int }
+{ x_root int }
+{ y_root int }
+{ state uint }
+{ keycode uint }
+{ same_screen Bool } ;
 
 TYPEDEF: XKeyEvent XKeyPressedEvent
 TYPEDEF: XKeyEvent XKeyReleasedEvent
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XMotionEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Window" "root" }
-        { "Window" "subwindow" }
-        { "Time" "time" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "x_root" }
-        { "int" "y_root" }
-        { "uint" "state" }
-        { "char" "is_hint" }
-        { "Bool" "same_screen" } ;
+STRUCT: XMotionEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ root Window }
+{ subwindow Window }
+{ time Time }
+{ x int }
+{ y int }
+{ x_root int }
+{ y_root int }
+{ state uint }
+{ is_hint char }
+{ same_screen Bool } ;
 
 TYPEDEF: XMotionEvent XPointerMovedEvent
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XCrossingEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Window" "root" }
-        { "Window" "subwindow" }
-        { "Time" "time" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "x_root" }
-        { "int" "y_root" }
-        { "int" "mode" }
-        { "int" "detail" }
-        { "Bool" "same_screen" }
-        { "Bool" "focus" }
-        { "uint" "state" } ;
+STRUCT: XCrossingEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ root Window }
+{ subwindow Window }
+{ time Time }
+{ x int }
+{ y int }
+{ x_root int }
+{ y_root int }
+{ mode int }
+{ detail int }
+{ same_screen Bool }
+{ focus Bool }
+{ state uint } ;
 
 TYPEDEF: XCrossingEvent XEnterWindowEvent
 TYPEDEF: XCrossingEvent XLeaveWindowEvent
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XFocusChangeEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "int" "mode" }
-        { "int" "detail" } ;
+STRUCT: XFocusChangeEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ mode int }
+{ detail int } ;
 
 TYPEDEF: XFocusChangeEvent XFocusInEvent
 TYPEDEF: XFocusChangeEvent XFocusOutEvent
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XExposeEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" "height" }
-        { "int" "count" } ;
+STRUCT: XExposeEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ x int }
+{ y int }
+{ width int }
+{ height int }
+{ count int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XGraphicsExposeEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Drawable" "drawable" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" "height" }
-        { "int" "count" }
-        { "int" "major_code" }
-        { "int" "minor_code" } ;
-
-C-STRUCT: XNoExposeEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Drawable" "drawable" }
-        { "int" "major_code" }
-        { "int" "minor_code" } ;
+STRUCT: XGraphicsExposeEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ drawable Drawable }
+{ x int }
+{ y int }
+{ width int }
+{ height int }
+{ count int }
+{ major_code int }
+{ minor_code int } ;
+
+STRUCT: XNoExposeEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ drawable Drawable }
+{ major_code int }
+{ minor_code int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XVisibilityEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "int" "state" } ;
+STRUCT: XVisibilityEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ state int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XCreateWindowEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "parent" }
-        { "Window" "window" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" "height" }
-        { "int" "border_width" }
-        { "Bool" "override_redirect" } ;
+STRUCT: XCreateWindowEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ parent Window }
+{ window Window }
+{ x int }
+{ y int }
+{ width int }
+{ height int }
+{ border_width int }
+{ override_redirect Bool } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XDestroyWindowEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" } ;
+STRUCT: XDestroyWindowEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XUnmapEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" }
-        { "Bool" "from_configure" } ;
+STRUCT: XUnmapEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window }
+{ from_configure Bool } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XMapEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" }
-        { "Bool" "override_redirect" } ;
+STRUCT: XMapEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window }
+{ override_redirect Bool } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XMapRequestEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "parent" }
-        { "Window" "window" } ;
+STRUCT: XMapRequestEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ parent Window }
+{ window Window } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XReparentEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" }
-        { "Window" "parent" }
-        { "int" "x" }
-        { "int" "y" }
-        { "Bool" "override_redirect" } ;
+STRUCT: XReparentEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window }
+{ parent Window }
+{ x int }
+{ y int }
+{ override_redirect Bool } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XConfigureEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" "height" }
-        { "int" "border_width" }
-        { "Window" "above" }
-        { "Bool" "override_redirect" } ;
+STRUCT: XConfigureEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window }
+{ x int }
+{ y int }
+{ width int }
+{ height int }
+{ border_width int }
+{ above Window }
+{ override_redirect Bool } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XGravityEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" }
-        { "int" "x" }
-        { "int" "y" } ;
+STRUCT: XGravityEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window }
+{ x int }
+{ y int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XResizeRequestEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "int" "width" }
-        { "int" "height" } ;
+STRUCT: XResizeRequestEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ width int }
+{ height int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XConfigureRequestEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "parent" }
-        { "Window" "window" }
-        { "int" "x" }
-        { "int" "y" }
-        { "int" "width" }
-        { "int" "height" }
-        { "int" "border_width" }
-        { "Window" "above" }
-        { "int" "detail" }
-        { "ulong" "value_mask" } ;
+STRUCT: XConfigureRequestEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ parent Window }
+{ window Window }
+{ x int }
+{ y int }
+{ width int }
+{ height int }
+{ border_width int }
+{ above Window }
+{ detail int }
+{ value_mask ulong } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XCirculateEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "event" }
-        { "Window" "window" }
-        { "int" "place" } ;
+STRUCT: XCirculateEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ event Window }
+{ window Window }
+{ place int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XCirculateRequestEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "parent" }
-        { "Window" "window" }
-        { "int" "place" } ;
+STRUCT: XCirculateRequestEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ parent Window }
+{ window Window }
+{ place int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XPropertyEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Atom" "atom" }
-        { "Time" "time" }
-        { "int" "state" } ;
+STRUCT: XPropertyEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ atom Atom }
+{ time Time }
+{ state int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XSelectionClearEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Atom" "selection" }
-        { "Time" "time" } ;
+STRUCT: XSelectionClearEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ selection Atom }
+{ time Time } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XSelectionRequestEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "owner" }
-        { "Window" "requestor" }
-        { "Atom" "selection" }
-        { "Atom" "target" }
-        { "Atom" "property" }
-        { "Time" "time" } ;
+STRUCT: XSelectionRequestEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ owner Window }
+{ requestor Window }
+{ selection Atom }
+{ target Atom }
+{ property Atom }
+{ time Time } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XSelectionEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "requestor" }
-        { "Atom" "selection" }
-        { "Atom" "target" }
-        { "Atom" "property" }
-        { "Time" "time" } ;
+STRUCT: XSelectionEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ requestor Window }
+{ selection Atom }
+{ target Atom }
+{ property Atom }
+{ time Time } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XColormapEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Colormap" "colormap" }
-        { "Bool" "new" }
-        { "int" "state" } ;
+STRUCT: XColormapEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ colormap Colormap }
+{ new Bool }
+{ state int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XClientMessageEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "Atom" "message_type" }
-        { "int" "format" }
-        { "long" "data0" }
-        { "long" "data1" }
-        { "long" "data2" }
-        { "long" "data3" }
-        { "long" "data4" }
-!       union {
-!               char  b[20];
-!               short s[10];
-!               long  l[5];
-!       } data;
-;
+STRUCT: XClientMessageEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ message_type Atom }
+{ format int }
+{ data0 long }
+{ data1 long }
+{ data2 long }
+{ data3 long }
+{ data4 long } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XMappingEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        { "int" "request" }
-        { "int" "first_keycode" }
-        { "int" "count" } ;
+STRUCT: XMappingEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ request int }
+{ first_keycode int }
+{ count int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XErrorEvent
-        { "int" "type" }
-        { "Display*" "display" }
-        { "XID" "resourceid" }
-        { "ulong" "serial" }
-        { "uchar" "error_code" }
-        { "uchar" "request_code" }
-        { "uchar" "minor_code" } ;
+STRUCT: XErrorEvent
+{ type int }
+{ display Display* }
+{ resourceid XID }
+{ serial ulong }
+{ error_code uchar }
+{ request_code uchar }
+{ minor_code uchar } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-C-STRUCT: XKeymapEvent
-        { "int" "type" }
-        { "ulong" "serial" }
-        { "Bool" "send_event" }
-        { "Display*" "display" }
-        { "Window" "window" }
-        ! char key_vector[32];
-        { "int" "pad" }
-        { "int" "pad" }
-        { "int" "pad" }
-        { "int" "pad" }
-        { "int" "pad" }
-        { "int" "pad" }
-        { "int" "pad" }
-        { "int" "pad" } ;
-
-C-UNION: XEvent
-        "int"
-        "XAnyEvent"
-        "XKeyEvent"
-        "XButtonEvent"
-        "XMotionEvent"
-        "XCrossingEvent"
-        "XFocusChangeEvent"
-        "XExposeEvent"
-        "XGraphicsExposeEvent"
-        "XNoExposeEvent"
-        "XVisibilityEvent"
-        "XCreateWindowEvent"
-        "XDestroyWindowEvent"
-        "XUnmapEvent"
-        "XMapEvent"
-        "XMapRequestEvent"
-        "XReparentEvent"
-        "XConfigureEvent"
-        "XGravityEvent"
-        "XResizeRequestEvent"
-        "XConfigureRequestEvent"
-        "XCirculateEvent"
-        "XCirculateRequestEvent"
-        "XPropertyEvent"
-        "XSelectionClearEvent"
-        "XSelectionRequestEvent"
-        "XSelectionEvent"
-        "XColormapEvent"
-        "XClientMessageEvent"
-        "XMappingEvent"
-        "XErrorEvent"
-        "XKeymapEvent"
-        { "long" 24 } ;
+STRUCT: XKeymapEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ window Window }
+{ pad int }
+{ pad int }
+{ pad int }
+{ pad int }
+{ pad int }
+{ pad int }
+{ pad int }
+{ pad int } ;
+
+UNION-STRUCT: XEvent
+{ int int }
+{ XAnyEvent XAnyEvent }
+{ XKeyEvent XKeyEvent }
+{ XButtonEvent XButtonEvent }
+{ XMotionEvent XMotionEvent }
+{ XCrossingEvent XCrossingEvent }
+{ XFocusChangeEvent XFocusChangeEvent }
+{ XExposeEvent XExposeEvent }
+{ XGraphicsExposeEvent XGraphicsExposeEvent }
+{ XNoExposeEvent XNoExposeEvent }
+{ XVisibilityEvent XVisibilityEvent }
+{ XCreateWindowEvent XCreateWindowEvent }
+{ XDestroyWindowEvent XDestroyWindowEvent }
+{ XUnmapEvent XUnmapEvent }
+{ XMapEvent XMapEvent }
+{ XMapRequestEvent XMapRequestEvent }
+{ XReparentEvent XReparentEvent }
+{ XConfigureEvent XConfigureEvent }
+{ XGravityEvent XGravityEvent }
+{ XResizeRequestEvent XResizeRequestEvent }
+{ XConfigureRequestEvent XConfigureRequestEvent }
+{ XCirculateEvent XCirculateEvent }
+{ XCirculateRequestEvent XCirculateRequestEvent }
+{ XPropertyEvent XPropertyEvent }
+{ XSelectionClearEvent XSelectionClearEvent }
+{ XSelectionRequestEvent XSelectionRequestEvent }
+{ XSelectionEvent XSelectionEvent }
+{ XColormapEvent XColormapEvent }
+{ XClientMessageEvent XClientMessageEvent }
+{ XMappingEvent XMappingEvent }
+{ XErrorEvent XErrorEvent }
+{ XKeymapEvent XKeymapEvent }
+{ padding long[24] } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! 11 - Event Handling Functions
@@ -1148,25 +1140,25 @@ X-FUNCTION: Status XWithdrawWindow (
 : PAllHints    ( -- n )
     { PPosition PSize PMinSize PMaxSize PResizeInc PAspect } flags ; foldable
 
-C-STRUCT: XSizeHints
-    { "long" "flags" }
-    { "int" "x" }
-    { "int" "y" }
-    { "int" "width" }
-    { "int" "height" }
-    { "int" "min_width" }
-    { "int" "min_height" }
-    { "int" "max_width" }
-    { "int" "max_height" }
-    { "int" "width_inc" }
-    { "int" "height_inc" }
-    { "int" "min_aspect_x" }
-    { "int" "min_aspect_y" }
-    { "int" "max_aspect_x" }
-    { "int" "max_aspect_y" }
-    { "int" "base_width" }
-    { "int" "base_height" }
-    { "int" "win_gravity" } ;
+STRUCT: XSizeHints
+    { flags long }
+    { x int }
+    { y int }
+    { width int }
+    { height int }
+    { min_width int }
+    { min_height int }
+    { max_width int }
+    { max_height int }
+    { width_inc int }
+    { height_inc int }
+    { min_aspect_x int }
+    { min_aspect_y int }
+    { max_aspect_x int }
+    { max_aspect_y int }
+    { base_width int }
+    { base_height int }
+    { win_gravity int } ;
 
 ! 14.1.10.  Setting and Reading the WM_PROTOCOLS Property
 
@@ -1208,17 +1200,17 @@ CONSTANT: VisualColormapSizeMask        HEX: 80
 CONSTANT: VisualBitsPerRGBMask          HEX: 100
 CONSTANT: VisualAllMask                 HEX: 1FF
 
-C-STRUCT: XVisualInfo
-        { "Visual*" "visual" }
-        { "VisualID" "visualid" }
-        { "int" "screen" }
-        { "uint" "depth" }
-        { "int" "class" }
-        { "ulong" "red_mask" }
-        { "ulong" "green_mask" }
-        { "ulong" "blue_mask" }
-        { "int" "colormap_size" }
-        { "int" "bits_per_rgb" } ;
+STRUCT: XVisualInfo
+        { visual Visual* }
+        { visualid VisualID }
+        { screen int }
+        { depth uint }
+        { class int }
+        { red_mask ulong }
+        { green_mask ulong }
+        { blue_mask ulong }
+        { colormap_size int }
+        { bits_per_rgb int } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! Appendix D - Compatibility Functions