[gambit-list] Gambit and GUI (GTK+)
Marc Feeley
feeley at iro.umontreal.ca
Fri Apr 1 10:50:15 EDT 2011
On 2011-04-01, at 10:20 AM, Alex Queiroz wrote:
> Hallo,
>
> On Fri, Apr 1, 2011 at 11:13 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
>>
>>> As I didn't find one I think it is probably a good idea to use C to
>>> drive the GUI part and gambit for the rest.
>>
>> It depends on the GUI library. In many GUIs there is a main event loop that is part of the GUI API. This can be a problem because that event loop takes over control of the execution, and prevents the Gambit thread scheduler, and timeouts to operate properly. Single-thread programs should be OK.
>>
>
> GTK+ at least lets you take control of the main loop. But the
> programmer must call a function to let GTK+ process events, so it must
> be called often:
>
> http://library.gnome.org/devel/gtk3/stable/gtk3-General.html#gtk-main-iteration-do
Yes. The other nice thing about GTK on X11 is that you can avoid busy waiting for events by calling (##device-port-wait-for-input! x11-display-port) where display-port is obtained with ##open-predefined using the X11 connection file descriptor. This is what's done in the Gambit Xlib-simple example (see the file examples/Xlib-simple/bounce.scm).
Marc
More information about the Gambit-list
mailing list