Eduardo Cavazos
2009-03-01 02:52:31 UTC
Hello,
http://proteus.freeshell.org/_xlib-larceny-a.sch
The coverage of the api is near complete, but the typedefs need to be
corrected. I.e. a bunch are simply "void*" which is incorrect. Some
should be aliased to "bytevector" (Larceny's boxed).
Note that the binding code itself is "Scheme agnostic", relying on
macros at the head to work with Larceny's names. So hopefully others can
reuse these.
Anywho, they're good enough to run the test program below.
Ed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "/src/larceny_src/lib/xlib.fasl")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define dpy (XOpenDisplay #f))
(define root (XDefaultRootWindow dpy))
(define win (XCreateSimpleWindow dpy root 100 100 200 200 0 0 0))
(XMapWindow dpy win)
(XFlush dpy)
(XSelectInput dpy win (bitwise-ior ExposureMask ButtonPressMask))
(define ev (make-XEvent))
(let ((root-return (make-bytevector 4))
(child-return (make-bytevector 4))
(root-x-return (make-bytevector 4))
(root-y-return (make-bytevector 4))
(win-x-return (make-bytevector 4))
(win-y-return (make-bytevector 4))
(mask-return (make-bytevector 4)))
(let loop ()
(XNextEvent dpy ev)
(display (XAnyEvent-type ev))
(newline)
(XQueryPointer dpy win root-return child-return
root-x-return root-y-return
win-x-return win-y-return
mask-return)
(display (list (bytevector-u32-native-ref win-x-return 0)
(bytevector-u32-native-ref win-y-return 0)))
(newline)
(loop)))
http://proteus.freeshell.org/_xlib-larceny-a.sch
The coverage of the api is near complete, but the typedefs need to be
corrected. I.e. a bunch are simply "void*" which is incorrect. Some
should be aliased to "bytevector" (Larceny's boxed).
Note that the binding code itself is "Scheme agnostic", relying on
macros at the head to work with Larceny's names. So hopefully others can
reuse these.
Anywho, they're good enough to run the test program below.
Ed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "/src/larceny_src/lib/xlib.fasl")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define dpy (XOpenDisplay #f))
(define root (XDefaultRootWindow dpy))
(define win (XCreateSimpleWindow dpy root 100 100 200 200 0 0 0))
(XMapWindow dpy win)
(XFlush dpy)
(XSelectInput dpy win (bitwise-ior ExposureMask ButtonPressMask))
(define ev (make-XEvent))
(let ((root-return (make-bytevector 4))
(child-return (make-bytevector 4))
(root-x-return (make-bytevector 4))
(root-y-return (make-bytevector 4))
(win-x-return (make-bytevector 4))
(win-y-return (make-bytevector 4))
(mask-return (make-bytevector 4)))
(let loop ()
(XNextEvent dpy ev)
(display (XAnyEvent-type ev))
(newline)
(XQueryPointer dpy win root-return child-return
root-x-return root-y-return
win-x-return win-y-return
mask-return)
(display (list (bytevector-u32-native-ref win-x-return 0)
(bytevector-u32-native-ref win-y-return 0)))
(newline)
(loop)))