I like your registry approach. I'd like to see the same done for file decriptors, so that sockets, sound, and anything else can use the same batch of code for monitoring descriptors.
Calling back into the VM is certainly tricky. One approach would be to add a module_initialise_forUnix() function which parallels module_initialise(). This function would be called with a list of Unix-specific functions the same way module_initialise() is called with a list of generic Squeak functions.
-Lex
Bert Freudenberg bert@isg.cs.uni-magdeburg.de wrote:
Hi folks,
I'm implementing tablet support for X. This usually works by using XOpenDevice to, well, open the device, and then handling Device* events in the main loop.
So I need to install an event handler in the main HandleEvent loop. Which is sorta difficult to do from a module (JoystickTabletPlugin in this case). It's not even easy to get at the stDisplay connection, which is a global in sqXWindow.
I had the same problem for the Netscape browser support and "solved" it by explicitly calling the plugin* functions in sqXWindow which are statically linked from sqUnixMozilla - which works, but is kind of non-general.
I could do the same now, which would require the tablet support to be always compiled internal. Or, we could invent a general callback list where plugins could hook into the main loop (and startup/shutdown functions). Something like
struct { int (*init)(Display*, Window); int (*handle)(XEvent*); int (*shutdown)(); } hooks[];
But still, the plugin would have to tell the VM somehow it wants to register those functions. For this, I have no idea. Who has?
-- Bert
squeak-dev@lists.squeakfoundation.org