Hi,
here's a somewhat functional GTK+ backend, using CFFI to interface with the C libraries.
For drawing operations I have borrowed Gilbert Baumann's cairo medium (search&replaced to use cffi instead of alien and with minor updates for cairo 1.0), hence the name Gtkairo for the new backend.
I probably don't have to explain why a GTK backend is interesting, but since using cairo means to interface with C anyway, it seems logical to go the full way to a native backend, eliminating the synchronization issues between the two parallel server connections (CLX and Xlib) present in Gilbert's original work.
As a proof-of-concept, sliders, buttons, option- and check boxes are implemented as native widgets. As you can see in the screenshot below[1], scroll bars and menus are not done natively yet.
Be warned that a lot of rough edges remain. * Display glitches. Notice how some weird bars drawn in what I think are background colors sometimes appear in the address book example. In the same example, the input cursor when typing and erasing characters is not getting removed properly, leaving a trace. Interestingly, when enabling antialiasing, the cursor is drawn blurry, which might indicate that non-integer coordinates are being used. Also, the presentation highlighting rectangle leaves traces if antialiasing is enabled (which is while I have disabled it for now). * The text cursor does not show the correct horizontal position in climacs. * Menus appear but do not really work. Worth fixing, even though we would rather want native menus in the long term. * The gadgets are only a quick hack. Colored buttons (clim-fig) are missing, the slider is not quite right. Inheriting from the standard gadget panes is bogus anyway, we should build them from scratch. * Should work on Windows but does not. Using the installer from gimp-win.sf.net I see an address book window, but there are cairo font warnings in the background and moving the mouse gives an error. Although the hordes of sbcl/win32 hackers might contribute a native Windows backend sooner or later, it would be nice to get Gtkairo working on Windows, too. * ...
To install Gtkairo, extract the tarball[2] into your Backend directory and apply the trivial patch[3].
GTK+ 2.8 is required for the Cairo integration.
Please test and improve ;-), David
[1] http://www.lichteblau.com/blubba/gtkairo.png [2] http://www.lichteblau.com/blubba/gtkairo.tgz [3] http://www.lichteblau.com/blubba/gtkairo.diff
--- David Lichteblau david@lichteblau.com wrote:
Hi,
here's a somewhat functional GTK+ backend, using CFFI to interface with the C libraries.
Coool! Are there any specific versions of CFFI, and specific lisps that are needed, or should it work wherever CFFI does?
Cheers, CY
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Quoting C Y (smustudent1@yahoo.com):
Coool! Are there any specific versions of CFFI, and specific lisps that are needed, or should it work wherever CFFI does?
Tested only on SBCL, but no inherent portability issues.
One exception perhaps: If you are using one of the Lisps with userland threads that do not like blocking in native code, look for the the call to sb-sys:wait-until-fd-usable in event.lisp and find a replacement.
And the other big problem was pointed out by Christophe: The original tarball is not 64 bit clean. The attached patch fixes that (tested briefly on SBCL/x86-64).
David
David Lichteblau david@lichteblau.com writes:
And the other big problem was pointed out by Christophe: The original tarball is not 64 bit clean. The attached patch fixes that (tested briefly on SBCL/x86-64).
Excellent.
(might fixing the (gtype :unsigned-long) in gtkobject, making it a pointer, fix the problem with windows?)
In any case, I suggest you go ahead and check this in; this will make a nice headline to the next McCLIM release :-)
Cheers,
Christophe
David Lichteblau david@lichteblau.com writes:
Tested only on SBCL, but no inherent portability issues.
What's the minimum version of GTK+ required?
Paolo