Hugs and Mac and GUI

Hans Aberg haberg@matematik.su.se
Fri, 17 Nov 2000 11:10:42 +0100


At 14.35 -0700 0-11-14, Alastair Reid wrote:
>The way we've dealt with Windows and X11 events elsewhere is that events are
>placed ina  queue which Haskell code can read out of.  For example, in my
>graphics library, events like mouse movement and key strokes are put into a
>channel (a threadsafe queue) for the window that receives the queue.  One
>tends
>to run one thread per window whose job is to deal with incoming events -
>possibly by forking off another thread to deal with the problem.

I looked a little bit on MacOS X, and it seems it has a mechanism doing
this stuff for you with respect to low-level events (the OS providing
queues for each window). In addition unhandled events can migrate up to the
object above it belongs to, eventually up to the program itself. There was
some changes made to the classical event handling mechanism (I do not
recall exactly what), so that windows can fade away instead of disappearing
abruptly when closed. I think it had to something do with the ownership of
events.

A Hugs port then would merely need to have a mechanism reading into those
queues. But I think a threaded version of Hugs would be better, so that one
could set interrupts for certain types of arriving events, and safely
execute some Haskell functions handling it, the way I unsafely made it for
high-level events.

So, again, it seems that one is better off porting to MacOS X, and not
earlier versions of the MacOS.

  Hans Aberg