[plt-scheme] Extensibility of MrEd

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Sep 9 13:03:01 EDT 2008

At Tue, 09 Sep 2008 09:46:58 -0700, Ben Goetter wrote:
> /* mzscheme extension - hocuspocus.c */
> Scheme_Object* register_hocuspocus(whatever-thunks-to-a-HWND h)
> { /* save away existing wndproc of h, install sniffer proc in its stead */ }
> { /* if msg is one of ours, crack the params and queue a hocuspocus 
> callback on h's frame%, else invoke previous proc */ }
> The callback needs to end up in the context of the frame% corresponding 
> to that particular window, as if it had been dispatched via send in 
> Scheme, and should arrive with the same priority as other interactive 
> events.  At present it's not obvious to me how to do either of these.

At the Scheme level, there's a `get-eventspace' method on
`top-level-window<%>', so you should have access to the relevant
eventspace whenever you have access to a frame's HWND.

Meanwhile, `mred/private/kernel' exports `middle-queue-key'. Its value
is recognized specially by `queue-callback' when supplied as the
"boolean" second argument, and it causes a callback to be added with
the same priority as a GUI event. (Of course, the module
`mred/private/kernel' is meant to be private to MrEd, but if you have
enough privileges to load an extension, then it's probably fine also to
access that module.)


Posted on the users mailing list.