Hello,
Here's the procedure 'configure-request' from cons-wm:
http://gist.github.com/246754
It's dealing with two kinds of X11 structs, XConfigureRequestEvent and
XWindowChanges. The XConfigureRequestEvent struct is declared in Scheme
(well, in the Ypsilon FFI library) as:
(c-structure XConfigureRequestEvent
(int type)
(unsigned-long 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)
(unsigned-long value_mask)
)
The code for XWindowChanges is similar.
The shorthand syntax I mentioned a few days ago for standard records can
also be applied here. In this case, there'd be the macros
'is-XConfigureRequestEvent' and 'is-XWindowChanges'. Given such macros
the 'configure-request' procedure would be written as:
(define configure-request
(let ((wc (make-XWindowChanges)))
(lambda (ev)
(is-XWindowChanges wc)
(is-XConfigureRequestEvent ev)
(wc.x! ev.x)
(wc.y! ev.y)
(wc.width! ev.width)
(wc.height! ev.height)
(wc.border_width! ev.border_width)
(wc.sibling! ev.above)
(wc.stack_mode! ev.detail)
(XConfigureWindow dpy ev.window ev.value_mask wc)
(XSync dpy False))))
Ed