The cl-cffi-gtk
library is a Lisp binding to GTK+ 3 (GIMP Toolkit) which is a library for creating graphical user interfaces. GTK+ 3 is licensed using the LGPL which has been adopted for the cl-cffi-gtk
library with a preamble that clarifies the terms for use with Lisp programs and is referred as the LLGPL.
The GTK+ 3 library is called the GIMP toolkit because GTK+ 3 was originally written for developing the GNU Image Manipulation Program (GIMP), but GTK+ 3 has now been used in a large number of software projects, including the GNU Network Object Model Environment (GNOME) project. GTK+ 3 is built on top of GDK (GIMP Drawing Kit) which is basically a wrapper around the low-level functions for accessing the underlying windowing functions (Xlib in the case of the X windows system), and gdk-pixbuf, a library for client-side image manipulation.
The first thing to do is to download the cl-cffi-gtk
source and to install it. The latest version is available from the repository at http://github.com/crategus/cl-cffi-gtk. The cl-cffi-gtk
library is ASDF installable and can be loaded with the command (asdf:load-system :cl-cffi-gtk)
from the Lisp prompt. The library is developed with the Lisp SBCL 1.1.9 on a Linux system and GTK+ 3.6.
At this time (August 2013) there is no GTK+ 3 library for Windows available at http://www.gtk.org. The current maintained version is GTK+ 2.24. The repository at http://github.com/crategus/cl-cffi-gtk has a branch gtk-2-24
which is tested with SBCL 1.0.54 and GTK+ 2.24 on Windows, but might be not complet and free of bugs.
GTK+ depends on the libraries GLib, GObject, GDK, GDK-Pixbuf, GIO, Pango, and Cairo. These libraries can be loaded separately with the following commands:
(asdf:load-system 'cl-cffi-gtk-glib) (asdf:load-system 'cl-cffi-gtk-gobject) (asdf:load-system 'cl-cffi-gtk-gdk) (asdf:load-system 'cl-cffi-gtk-gdk-pixbuf) (asdf:load-system 'cl-cffi-gtk-gio) (asdf:load-system 'cl-cffi-gtk-pango) (asdf:load-system 'cl-cffi-gtk-cairo)
Please consult the ASDF documentation which is available at http://common-lisp.net/project/asdf/ for configuring ASDF to find your systems.
Information about the installation can be obtained with the function
. This is an example for the output, when calling the function from the Lisp prompt after loading the library:cl-cffi-gtk-build-info
* (asdf:load-system :cl-cff-gtk)
* (cl-cffi-gtk-build-info) cl-cffi-gtk version: 1.0.0 cl-cffi-gtk build date: 11:22 7/25/2013 GTK+ version: 3.6.4 GLIB version: 2.36.0 GDK-Pixbuf version: 2.28.0 Pango version: 1.32.5 Cairo version: 1.12.14 Machine type: X86 Machine version: Intel(R) Core(TM)2 Duo CPU T7250 2.00GHz Software type: Linux Software version: 3.8.0-27-generic Lisp implementation type: SBCL Lisp implementation version: 1.1.9
The cl-cffi-gtk
library depends on the following libraries:
the Common Foreign Function Interface, purports to be a portable foreign function interface for Common Lisp. See http://common-lisp.net/project/cffi/ and http://www.crategus.com/books/cffi/.
Warning: Yout must use the version 0.11.2 or newer of the CFFI library. Older versions of CFFI are no longer compatible with the implementation of cl-cffi-gtk
.
provides a portable API to finalizers, weak hash-tables and weak pointers on all major CL implementations. See http://www.cliki.net/trivial-garbage and http://www.crategus.com/books/trivial-garbage/.
is a lispy and extensible replacement for the LOOP macro. See http://common-lisp.net/project/iterate/.
lets you write multi-threaded applications in a portable way. See http://common-lisp.net/project/bordeaux-threads/ and http://www.crategus.com/books/bordeaux-threads/.
Closer to MOP is a compatibility layer that rectifies many of the absent or incorrect MOP features as detected by MOP Feature Tests. See http://common-lisp.net/project/closer/closer-mop.html and http://www.crategus.com/books/closer-mop.
This work is based on the cl-gtk2
library which has been developed by Kalyanov Dmitry and already is a fairly complete Lisp binding to GTK+. The focus of the cl-cffi-gtk
library is to document the Lisp library much more complete and to do the implementation as consistent as possible. Most informations about GTK+ can be gained by reading the C documentation. Therefore, the C documentation from www.gtk.org is included into the Lisp files to document the Lisp binding to the GTK+ library. This way the calling conventions are easier to determine and missing functionality is easier to detect.