[mcclim-devel] gtkairo

David Lichteblau david at lichteblau.com
Sun Apr 9 17:03:34 UTC 2006


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



More information about the mcclim-devel mailing list