On Fri, Oct 26, 2012 at 10:26 PM, Matthew Flatt wrote:
> That seems like an ok solution.
>
> I would be tempted to write
>
> (define-cstruct _XEvent ([type _int]))
>
> (define-cstruct (_XAnyEvent _XEvent) ([serial _ulong]
>))
> (define-cstruct (_XKey
Actually I think I know why it is like the way it is now..
To get an X11 event you pass in an XEvent* to XNextEvent which copies the event
to the input pointer. Essentially
void XNextEvent(XEvent * input){
switch (event_type){
case Keyboard: {
XKeyboardEvent real_event;
mem
I agree with this. The code Laurent is talking about is my x11 ffi bindings.
Laurent, feel free to make this change and push to the repo. I'm not sure why I
didn't use the super struct thing to begin with, maybe it didn't exist when I
initially wrote the bindings.
https://github.com/kazzmir/x11
That seems like an ok solution.
I would be tempted to write
(define-cstruct _XEvent ([type _int]))
(define-cstruct (_XAnyEvent _XEvent) ([serial _ulong]
))
(define-cstruct (_XKeyEvent _XEvent) ([serial _ulong]
.
Oooohh, I think I understand now: the way it was is already sufficiently
general.
The writer of the initial code took a different direction.
Instead of defining a union type, he changes the tag of the pointer
depending on what kind of type he needs in the union:
(cpointer-push-tag! e XAnyEvent-tag)
5 matches
Mail list logo