lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "David" == David  <dcuny@lanset.com> writes:

    David> Rafael Jannone wrote:

    Rafael>> What I am really talking about is having some kind of
    Rafael>> standard set of lua data structures for GUI development,
    Rafael>> but more in a sense of "let's program a GTK-like toolkit
    Rafael>> using lua instead of C".  Then you could have a number of
    Rafael>> appropriate graphical backends.

    David> Well, you have two options: write a toolkit that uses
    David> native widgets (like wxWindows or Zinc), or emulate
    David> everything yourself (just about everyone else).

    David> Using native widgets is more complex, but ultimately
    David> provides a better solution. People expect their platform to
    David> look and feel like their platform, be it Windows, Linux or
    David> a Mac. [...]

An alternative would be to make a widget server containing a Lua
interpreter. The idea (reminiscent of the dead NeWS system made by Sun
around 1990) would be to have a GUI "widget server" program listening
for script on a socket or pipe, which communicate with an application
program. The application program send lua commands to the GUI server,
and the callbacks are Lua script functions, some of which may send
back a message to the application program.

I actually made such a GUI server (called guis) for Lua4 and GTK2. It
is opensource free software, available from
http://freshmeat.net/projects/guis/ - I probably don't have much time
to work on it, but your comments are welcome!

The difficulty is to interface all (or at least most) of GTK2 to
Lua. This is a big boring task, because GTK API is rather big. I tried
to use the semi formal lispy description of GTK2 API available fot
GtkPython, and I coded a quick&dirty CommonLisp (Clisp) program to
generate the glue code between GTK2 and Lua4.

A practical problem with such stuff is the widget & memory management
issue. Most toolkits today seems to incorporate some (crude) kind of
"garbage collection" - a reference counting mechanism provided by Glib
in GTK2- and the link between it and Lua GC might be not very robust.

Perhaps Trolltech new QSA (see
http://www.trolltech.com/products/qsa/index.html for details) could be
used to easily embed Javascript to make a Javascript driven QT3 widget
server. This should require some work (I actually tried a bit to make
a QT3 program listening for commands on a pipe, and did not tried
enough to succeed on this). But I did not investigate into QSA and may
have misunderstood it.

A major but interesting Lua project would be to make a LUA based GUI
server, which would mean to develop (or adapt) a widget library for
LUA conventions and GC.

More generally, I really am missing a good scripting capabilities in
today widgets' sets, and even a standard way of doing it. (Web
interfaces are not enough, even by using Mozilla's XPCOM etc..). I
still think that NeWS idea of programming a GUI server is a good one,
and I don't understand why the Java team (which was earlier the NeWS
development team) did not propose a standard JVM embedding into X11.


Regards.

-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France