[Openmcl-devel] Events, Windows, and OpenMCL

Brent Fulgham bfulg at pacbell.net
Sun Dec 10 21:40:40 UTC 2006

In playing with the MCL 5.1 demo program, I notice that the Window  
class included in the image allows one to instantiate the window, and  
it immediately pops up:

Welcome to the demo version of Macintosh Common Lisp Version 5.1!
? (defvar *T* (make-instance 'window))

The window identifies itself as part of the MCL program (at least, no  
separate process or tray icon is created), and I continue to be able  
to interact with the MCL console to create new forms, etc.

I've written (or rather, stolen) a window implementation based on  
Mikel's Clotho/Bosco stuff, and so I also get a nice window to pop up  
from my OpenMCL session.  However, my window is "dead" in that it  
doesn't respond to events though I can update images in a graphic  
context embedded in the window.

I fully understand that the problem is that the window I generated is  
not being serviced by any kind of an event/message loop.  However, if  
I were to do so from the constructor of the window I would end up  
with a "locked" OpenMCL console since it would never return from the  
window (until the event loop was exited).

So, I see a few options and I'm curious if anyone can provide context/ 
suggestions for the right way to go.

1.  Each window could be launched in its own thread which would  
execute the run-loop.  I'm not sure if there would be any threading  
concerns here, but I imagine this would be a fairly simple approach.   
However, examining the MCL running image with the OS X development  
tool "Thread Viewer" shows no new threads created as I open windows.   
So, another possibility is:

2.  A single event loop thread could be started if the "Carbon" or  
"Cocoa" environments were activated in OpenMCL.  New windows could be  
created, then this thread could be notified to begin servicing the  
windows as part of its event loop.  I'm guessing this is the approach  
MCL uses but of course have no way of knowing.

Does anyone have any comments (or dire warnings) about either of  
these approaches?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20061210/781d4667/attachment.html>

More information about the Openmcl-devel mailing list