X Window Programming/CLX

From Wikibooks, open books for an open world
Jump to navigation Jump to search

CLX is the standard X Window System protocol client library for Common Lisp. You can preface all commands with xlib: or have xlib become the current package with (in-package :xlib).

Connecting to the X display[edit | edit source]

To be able to interface with X we will first need to connect to a server:

(xlib:open-default-display)       ; #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10707000) X11.0 #x2160C2CE>

or you can supply the hostname and display number yourself (if the hostname is an empty string it will connect to your localhost by default):

;; Connect to localhost:0
(xlib:open-display "" :display 0) ; #<DISPLAY localhost:0 (The X.Org Foundation R10707000) X11.0 #x2161AF16>

External links[edit | edit source]