* smosher (
dark.n...@gmail.com) wrote:
> Most GUI toolkits use callbacks (and most are in C++ to boot) so it
> makes implementing bindings a little difficult at the moment.
>
> Someone built an SDL package (though I'm not sure how complete it is)
> and I believe Xlib can be useful without callbacks. On the other hand,
> implementing a GUI (or more specifically, building a GUI toolkit) in
> either would not be pleasant.
I wonder about running a GUI in another thread/process linked via
a pipe pair, with those pipes being terminated in channels.
So you would have:
1 goroutine that reads from a channel and writes it to a pipe
1 goroutine that reads from the pipe and writes it to a channel
1 goroutine that does all GUI stuff, it binds to the C gtk+, it
selects on the pipe (as well as X events) and reads commands from it;
when there is an event it writes a message on the pipe describing the event.
Then the main program has a main select statement that waits on the
channel from the GUI and receives events. If it wants to do anything
it writes commands up the pipe that do the actual GUI calls.
In a way this could be done as an external C program, although doing it this
way means it is the same memory space and you might be able to do something
special for images; it would probably be a fair chunk of work to define
the channel language unless it could somehow be almost automated.
Dave
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \
\ gro.gilbert @
treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex /
\ _________________________|_____
http://www.treblig.org |_______/