Commit 89a67b64 authored by fgilham's avatar fgilham

Telent CLX import

parent f5c564ec
$Id: CHANGES,v 1.6 2007/08/21 15:49:27 fgilham Exp $
Details of changes since R5:
NOTE: this file is not updated any more. Changes since checking into
version control can be found from darcs in some way shape or form.
There may however be some Dark Ages between when this file was last
updated and the version that was the initial version control checkin.
Changes in CLX 5.02:
Fix a declaration in the DEFINE-ERROR macro.
Quote type argument to TYPE-CHECK consistently.
Changes in CLX 5.01:
Support for MIT-MAGIC-COOKIE-1 authorization has been added.
All VALUES declarations have been changed to CLX-VALUES declarations.
VALUES is a CL type name and cannot be used as a declaration name.
All ARRAY-REGISTER declarations have been removed as Genera no longer
needs them.
Many type declarations have been corrected or tightened up now that some
Lisps look at them.
Print functions have been defined for bitmap and pixmap formats.
The DISPLAY-PLIST slot will be initialized to NIL.
When debugging, don't optimize SPEED in the buffer macros.
Make the CARD8<->CHAR and the window manager code work for sparse
character sets (where some codes do not have corresponding characters).
The default gcontext extension set and copy functions will take the
correct number of arguments.
PUT-IMAGE will now work for 24-bit images.
The buffer accessors for MEMBER8, etc., will use the standard mechanisms
for reporting type errors.
POINTER-CONTROL have been fixed.
Symbolics systems will do lazy macroexpansion in the buffer macros.
A variety of changes for Symbolics Minima systems have been made.
Some system-dependent code has been added for CMU Common Lisp.
-*- Text -*-
$Id: NEWS,v 1.1 2007/08/21 15:49:27 fgilham Exp $
-- Changes in telent CLX 0.7.3, Tue Mar 28 2006 ---
Support for Allegro CL (6.2 and later) (Mikel Evins)
Latin 1 keysyms (Christophe Rhodes)
Some protocol fixes (Douglas Crosher)
Define a RENDER-OP typ (Douglas Crosher)
--- Changes in SBCL CLX 0.7.2, Tue Jan 10 2006 ---
OpenMCL fixes
DPMS extension support
Xauthority ipv6 parsing fixes
Thanks to Bryan O'Connor, Matthew Kennedy, Christophe Rhodes
--- Changes in SBCL CLX 0.7.1, Wed Aug 24 2005 ---
Works in SBCL 0.9.2 and newer.
--- Changes in SBCL CLX 0.7.0, Sun May 1 2005 ---
The SBCL support now depends on version 0.9.0 or greater.
--- Changes in SBCL CLX 0.6.1, Mon Mar 28 2005 ---
experimental GLX extension support (from Janis Dzerins)
The ICCCM-compliant selection handling in demo/clipboard.lisp is now
more ICCCM-compliant.
The implementation of the RENDER client protocol has been
enhanced. (Gilbert Baumann)
event descriptions have been fixed.
--- Changes in SBCL CLX 0.6, Tue Nov 16 2004 ---
A port to ECL has been merged (Juan Jose Garcia Ripoll)
With the addition of an implementation of DYNAMIC-EXTENT &REST lists
to SBCL, various functions (e.g. READ-INPUT, QUEUE-EVENT) in CLX
should cons less.
A Texinfo version of the CLX manual has been added (in manual/), thanks
to the work of Gilbert Baumann and Shawn Betts.
The portable-clx mailing list has been created for development discussion
and bug reports. See
A demonstration of ICCCM-compliant selection handling for select and paste
has been included in demo/clipboard.lisp
Bug fix: change the sizes of certain fields in a WM-SIZE-HINT to be 32
bits wide, as per the ICCCM specifications. Fixes a problem seen with
the MacOS X11 window manger, that uses very large hint values.
(Patch from Eric Marsden)
Bug fix: +POINTER-EVENT-MASK-VECTOR+ is supposed to be a vector of
keywords. It wasn't, but it is now. (Milan Zamazal)
Bug fix: xrender now compiles properly when *DEF-CLX-CLASS-USE-DEFCLASS*
(Milan again)
--- Changes in SBCL CLX 0.5.4, Tue Nov 11 00:02:43 2003 ---
A change in the implementation of PROCESS-BLOCK and PROCESS-WAKEUP
under multithreaded SBCL. Previous versions used queues and condition
variables, but this seems to have undesireable performance
characteristics; the newer version uses a polling loop calling
sched_yield() inside, which greatly improves responsiveness, but is
more CPU-hungry (as perceived by top(1), at least; in theory it
only hogs the CPU when nobody else wants it).
--- Changes in SBCL CLX 0.5.3, Sat Sep 6 12:14:39 UTC 2003 ---
We allow a PIXMAP-DEPTH of 12 in clx.lisp, despite not having any
image routines for it, to allow clx to load when running under eXceed.
Image routines are unlikely to work in such circumstances.
Bug fixes
* ERROR idiom (xvidmode.lisp)
* Add timestamp in NEWS file
--- Changes in SBCL CLX 0.5.2, about twenty minutes before 0.5.3 ---
OPEN-DEFAULT-DISPLAY now takes an optional argument for the display
name, which has the same "protocol/host:display.screen" format as used
by the C libX11 (XOpenDisplay). OPEN-DISPLAY is not actively
deprecated, but is much less useful by comparison
Inclusion of two new tests/demos (from Ingvar Mattson):
* demo/clclock: a simple clock application;
* demo/mandel: a Mandelbrot set viewer.
Bug fixes
* Fix bad type declarations in TEXT-EXTENTS-SERVER and
* Fix FORMAT argument mismatch error in WRITE-BITMAP-FILE (image.lisp)
--- Changes in SBCL CLX 0.5.1, Wed Jun 25 14:20:31 BST 2003 ---
experimental RENDER extension support (from Gilbert Baumann)
note: the API to this is as yet unfinalized, as indeed the protocol
and specification appear to be in flux. Nevertheless,
feedback is welcome to the portable-clx-devel mailing list.
Bug fixes
* fix bugs in the image test: always draw glyphs in white on black
(not 1 on 0 -- i.e. dark red/blue on black in 24 bit truecolour);
don't abuse the X-HOT and Y-HOT slots for communicating persistent
information any more.
* Disable the "optimized" pixarray read/write routines, on the basis
that the newly fixed image test reveals that they are broken.
* fix type bugs in DEFINE-GCONTEXT-ACCESSOR, which previously
signalled a type error if :COPY-FUNCTION was not provided, and a
different type error if it was.
Other notes
* we use the SBCL extensions to the condition system to customize
compiler behaviour. As such, the system will only build without
breaking into the debugger using the supplied .asd, as we inhibit
error signalling from DEFCONSTANT; the benefits of this are easier
code sharing, as we minimize divergence within the clx source
proper from other implementations.
* we also use an SBCL extension to maximize efficiency: we set
SB-EXT:*DERIVE-FUNCTION-TYPES* to true for the duration of the
compilation of the clx library. Should functions in CLX be
redefined in a type-incompatible way, their callers in CLX (but not
outside) will need to be recompiled.
--- Changes in SBCL CLX 0.5, Fri May 30 01:16:34 BST 2003 ---
XFree86-VidModeExtension extension support (courtesy of Iban Hatchondo)
OPEN-DEFAULT-DISPLAY (opens display in $DISPLAY environment variable) exported
Implement CLX MP dependencies for SBCL: HOLDING-LOCK, PROCESS-BLOCK, etc
Many bug fixes
* asking for text extents on unchached fonts could potentially deadlock
* lots of compiler warnings, style-warnings, notes cleared up
Style and ANSI cleanups
* Much renaming of constants from *foo* to +foo+
* Change old-style COMPILE LOAD EVAL to new-style :COMPILE-TOPLEVEL
$Id: README,v 1.4 2007/08/21 15:49:27 fgilham Exp $
This directory contains CLX, an X11 client library for Common
Lisp. The code was originally taken from a CMUCL distribution, was
modified somewhat in order to make it compile and run under SBCL, then
a selection of patches were added from other CLXes around the net.
= Features
- SHAPE extension support (Gilbert Baumann)
- XFREE86-VIDMODE extension support (Iban Hatchondo)
- experimental RENDER extension support
(Gilbert Baumann and Christian Sunesson)
- X authority support that works with ssh forwarding (Eric Marsden via CMUCL)
- OPEN-DEFAULT-DISPLAY function which, as the name suggests, does that (dan)
- various bug fixes (Iban Hatchondo and a cast of several)
- a manual in texinfo format (Shawn Betts, Gilbert Baumann)
= Compatibility
This CLX distribution is intended to work under the latest released
version of SBCL - please report the bug if it doesn't. It should
usually also work with earlier versions back to 0.9.0, and possibly
earlier still, but may need manual adjustment to the clx.asd file (to
remove use of newly-introduced features).
It has also been used as a basis for CLX ports on other Lisp
implementations, but these instructions are only good for SBCL. If
you're running something else, you need to know (a) that it builds
with asdf (and asdf-install, if the planets are in alignment) and
(b) what asdf is anyway. might help
you there. If you've installed this using some non-SBCL Lisp, please
send mail describing the process so that future versions can incorporate
your instructions.
If you are following SBCL CVS and this CLX does not run in it, please
check the darcs repositor{y,ies} for this CLX distribution to see if
your bug has been fixed already.
darcs get # version from which releases are made # patches merged by Christophe # OpenMCL tree by bryan o'connor?
= Building using asdf-install
* (require 'asdf)
* (require 'asdf-install)
* (asdf-install:install 'clx) ; download and install automatically, or
* (asdf-install:install "clx-x.y.z.tar.gz") ; if you've downloaded already
= Building by hand
If you don't trust asdf-install, here's how to do it manually -
1. Untar this tree somewhere
2. Add a symlink to clx.asd from one of the directories listed in your
If that makes no sense to you yet, choose one of -
2a. personal installation:
$ cd $HOME/.sbcl/systems # you may have to create this directory
$ ln -s /path/to/clx/source/clx.asd .
2b. systemwide installations: you need to ask SBCL where it lives
$ sbcl --noinform --eval '(format t "~A~%" (posix-getenv "SBCL_HOME"))' </dev/null
$ cd /usr/local/lib/sbcl/site-systems
$ ln -s /path/to/clx/source/clx.asd .
* (require 'asdf)
* (require 'clx)
This will load all the files, after compiling anything that needs compiling
4. To test CLX (and get a small amount of Lisp advocacy), try loading
the file "demo/menu", and then executing the function
* (load "clx/demo/menu")
* (xlib::just-say-lisp)
5. If you're new to Lisp, be advised that despite the examples in
demo/, it's generally /not/ considered good style to switch to the
:xlib package and write your code in it. Spend some time with a
language reference to familiarize yourself with USE-PACKAGE, or
better yet, the USE option to DEFPACKAGE.
= Known problems:
(none reported)
= Bug reports, new features, patches
Please send bug reports to the portable-clx list:
Note that your post will be held for approval if you are not subscribed.
Heavy lifting by <Raymond.Wiker at>
ASDFized version and ongoing by Daniel Barlow <dan at>
and (mostly, these days) Christophe Rhodes <csr21 at>
$Id: README-CMUCL,v 1.1 2007/08/21 15:49:27 fgilham Exp $
This is an import of Telent-CLX as of 0.7.3.
All files are included. A few changes to fix bugs related to CMUCL have been added, as well as
the CVS id. I've tried to make few changes so it will be easy to merge again when desired.
The following files from this directory are compiled and loaded by CMUCL when it builds
$Id: README-R5,v 1.1 2007/08/21 15:49:27 fgilham Exp $
Original CLX README, retained for historical information
These files contain beta code, but they have been tested to some extent under
Symbolics, TI, Lucid and Franz. The files have been given .l suffixes to keep
them within 12 characters, to keep SysV sites happy. Please rename them with
more appropriate suffixes for your system.
For Franz systems, see exclREADME.
For Symbolics systems, first rename all the .l files to .lisp. Then edit your
sys.translations file so that sys:x11;clx; points to this directory and put a
clx.system file in your sys:site;directory that has the form
(si:set-system-source-file "clx" "sys:x11;clx;defsystem.lisp")
in it. After that CLX can be compiled with the "Compile System CLX" command
and loaded with the "Load System CLX" command.
For TI systems, rename all the .l files to .lisp, and make a clx.translations
file in your sys:site; directory pointing to this directory and a
sys:site;clx.system file like the one described for symbolics systems above,
but with the defsystem file being in the clx:clx; directory. Then CLX can be
compiled with (make-system "CLX" :compile :noconfirm) and loaded with
(make-system "CLX" :noconfirm).
For Lucid systems, you should rename all the .l files to .lisp too (This might
not be possible on SysV systems). After loading the defsystem.l file, CLX can
be compiled with the (compile-clx) function and loaded with the
(load-clx) form.
The ms-patch.uu file is a patch to Lucid version 2 systems. You probably
don't need it, as you are probably running Lucid version 3 or later, but if
you are still using Lucid version 2, you need this patch. You'll need to
uudecode it to produce the binary.
For kcl systems, after loading the defsystem.l file, CLX can be compiled with
the (compile-clx) function and loaded with the (load-clx) form.
For more information, see defsystem.l and provide.l.
......@@ -17,9 +17,6 @@
;;; Texas Instruments Incorporated provides this software "as is" without
;;; express or implied warranty.
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/clx/attributes.lisp,v 1.6 1999/03/16 23:37:36 pw Exp $")
;;; The special variable *window-attributes* is an alist containg:
;;; (drawable attributes attribute-changes geometry geometry-changes)
......@@ -43,12 +40,15 @@
;;; All WITH-STATE has to do (re)bind *Window-attributes* to a list including
;;; the new drawable. The caches are initialized to NIL and allocated as needed.
(ext:file-comment "$Id: attributes.lisp,v 1.7 2007/08/21 15:49:27 fgilham Exp $")
(in-package :xlib)
(eval-when (compile load eval) ;needed by Franz Lisp
(defconstant *attribute-size* 44)
(defconstant *geometry-size* 24)
(defconstant *context-size* (max *attribute-size* *geometry-size* (* 16 4))))
(eval-when (:compile-toplevel :load-toplevel :execute)
(defconstant +attribute-size+ 44)
(defconstant +geometry-size+ 24)
(defconstant +context-size+ (max +attribute-size+ +geometry-size+ (* 16 4))))
(defvar *window-attributes* nil) ;; Bound to an alist of (drawable . state) within WITH-STATE
......@@ -57,7 +57,7 @@
(defun allocate-context ()
(or (threaded-atomic-pop *context-free-list* reply-next reply-buffer)
(make-reply-buffer *context-size*)))
(make-reply-buffer +context-size+)))
(defun deallocate-context (context)
(declare (type reply-buffer context))
......@@ -69,12 +69,12 @@
(defmacro state-geometry-changes (state) `(fifth ,state))
(defmacro drawable-equal-function ()
(if (member 'drawable *clx-cached-types*)
(if (member 'drawable +clx-cached-types+)
''eq ;; Allows the compiler to use the microcoded ASSQ primitive on LISPM's
(defmacro window-equal-function ()
(if (member 'window *clx-cached-types*)
(if (member 'window +clx-cached-types+)
......@@ -158,7 +158,7 @@
(setf (aref changes 0) (logior (aref changes 0) (ash 1 number))) ;; set mask bit
(setf (aref changes (1+ number)) value)) ;; save value
; Send change to the server
(with-buffer-request ((window-display window) *x-changewindowattributes*)
(with-buffer-request ((window-display window) +x-changewindowattributes+)
(window window)
(card32 (ash 1 number) value)))))
......@@ -185,7 +185,7 @@
(setf (aref changes 0) (logior (aref changes 0) (ash 1 number))) ;; set mask bit
(setf (aref changes (1+ number)) value)) ;; save value
; Send change to the server
(with-buffer-request ((drawable-display drawable) *x-configurewindow*)
(with-buffer-request ((drawable-display drawable) +x-configurewindow+)
(drawable drawable)
(card16 (ash 1 number))
(card29 value)))))
......@@ -207,7 +207,7 @@
(deallocate-gcontext-state (state-attribute-changes state-entry))
(setf (state-attribute-changes state-entry) nil))
;; Get window attributes
(with-buffer-request-and-reply (display *x-getwindowattributes* size :sizes (8))
(with-buffer-request-and-reply (display +x-getwindowattributes+ size :sizes (8))
((window window))
(let ((repbuf (or (state-attributes state-entry) (allocate-context))))
(declare (type reply-buffer repbuf))
......@@ -237,7 +237,7 @@
(deallocate-gcontext-state (state-geometry-changes state-entry))
(setf (state-geometry-changes state-entry) nil))
;; Get drawable attributes
(with-buffer-request-and-reply (display *x-getgeometry* size :sizes (8))
(with-buffer-request-and-reply (display +x-getgeometry+ size :sizes (8))
((drawable drawable))
(let ((repbuf (or (state-geometry state-entry) (allocate-context))))
(declare (type reply-buffer repbuf))
......@@ -255,7 +255,7 @@
(mask (aref changes 0)))
(declare (type display display)
(type mask32 mask))
(with-buffer-request (display *x-changewindowattributes*)
(with-buffer-request (display +x-changewindowattributes+)
(window window)
(card32 mask)
(progn ;; Insert a word in the request for each one bit in the mask
......@@ -282,7 +282,7 @@
(mask (aref changes 0)))
(declare (type display display)
(type mask16 mask))
(with-buffer-request (display *x-configurewindow*)
(with-buffer-request (display +x-configurewindow+)
(window window)
(card16 mask)
(progn ;; Insert a word in the request for each one bit in the mask
......@@ -352,6 +352,8 @@
(t (x-type-error background '(or (member :none :parent-relative) integer pixmap))))
#+Genera (eval-when (compile) (compiler:function-defined 'window-background))
(defsetf window-background set-window-background)
(defun set-window-border (window border)
......@@ -365,6 +367,8 @@
(t (x-type-error border '(or (member :copy) integer pixmap))))
#+Genera (eval-when (compile) (compiler:function-defined 'window-border))
(defsetf window-border set-window-border)
(defun window-bit-gravity (window)
......@@ -372,11 +376,11 @@
(declare (type window window))
(declare (clx-values bit-gravity))
(with-attributes (window :sizes 8)
(member8-vector-get 14 *bit-gravity-vector*)))
(member8-vector-get 14 +bit-gravity-vector+)))
(defun set-window-bit-gravity (window gravity)
window 4 (encode-type (member-vector *bit-gravity-vector*) gravity))
window 4 (encode-type (member-vector +bit-gravity-vector+) gravity))
(defsetf window-bit-gravity set-window-bit-gravity)
......@@ -386,11 +390,11 @@
(declare (type window window))
(declare (clx-values win-gravity))
(with-attributes (window :sizes 8)
(member8-vector-get 15 *win-gravity-vector*)))
(member8-vector-get 15 +win-gravity-vector+)))
(defun set-window-gravity (window gravity)
window 5 (encode-type (member-vector *win-gravity-vector*) gravity))
window 5 (encode-type (member-vector +win-gravity-vector+) gravity))
(defsetf window-gravity set-window-gravity)
......@@ -630,6 +634,8 @@
(change-drawable-geometry window 5 (encode-type window sibling))))
#+Genera (eval-when (compile) (compiler:function-defined 'window-priority))
(defsetf window-priority (window &optional sibling) (mode)
;; A bit strange, but retains setf form.
`(set-window-priority ,mode ,window ,sibling))
;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: XLIB; -*-
;;; (c) copyright 2006 Richard Kreuter
;;; (c) copyright 2007 by Christophe Rhodes
;;; Permission is granted to any individual or institution to use,
;;; copy, modify, and distribute this software, provided that this
;;; complete copyright and permission notice is maintained, intact, in
;;; all copies and supporting documentation.
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
(ext:file-comment "$Id: big-requests.lisp,v 1.1 2007/08/21 15:49:27 fgilham Exp $")
(in-package "XLIB")
;;; No new events or errors are defined by this extension. (Big
;;; Requests Extension, section 3)
;;; The name of this extension is "BIG-REQUESTS" (Big Requests
;;; Extension, section 4)
(define-extension "BIG-REQUESTS")
(defun enable-big-requests (display)
(declare (type display display))
(let ((opcode (extension-opcode display "BIG-REQUESTS")))
(with-buffer-request-and-reply (display opcode nil)
((data 0))
(let ((maximum-request-length (card32-get 8)))
(setf (display-extended-max-request-length display)
This diff is collapsed.
......@@ -18,9 +18,9 @@
;;; Texas Instruments Incorporated provides this software "as is" without
;;; express or implied warranty.
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/clx/bufmac.lisp,v 1.4 1998/12/19 15:21:15 dtc Exp $")
(ext:file-comment "$Id: bufmac.lisp,v 1.5 2007/08/21 15:49:27 fgilham Exp $")
(in-package :xlib)
;;; -*- Mode: Lisp; Package: Xlib; Log: clx.log -*-
(ext:file-comment "$Id: build-clx.lisp,v 1.4 2007/08/21 15:49:27 fgilham Exp $")
;;; Load this file if you want to compile CLX in its entirety.
(proclaim '(optimize (speed 3) (safety 1) (space 1)
(compilation-speed 0)))
;;; Hide CLOS from CLX, so objects stay implemented as structures.
(when (find-package "CLOS")
(rename-package (find-package "CLOS") "NO-CLOS-HERE"))
(when (find-package "PCL")
(rename-package (find-package "PCL") "NO-PCL-HERE"))
(when (find-package "SB-PCL")
(rename-package (find-package "SB-PCL") "NO-SB-PCL-HERE"))
(when (find-package "XLIB")
(delete-package "XLIB"))
(unless (find-package "XLIB")
(make-package "XLIB" :use '("COMMON-LISP")))
(compile-file "clx:defsystem.lisp" :error-file nil :load t)
(progn (compile-file "clx:defsystem.lisp")
(load "clx:defsystem"))
(with-compilation-unit ()
(#+cmu xlib:compile-clx #-cmu compile-clx (pathname "CLX:")))
;;;(in-package :xlib)
;;;(common-lisp:use-package (list :common-lisp))
(ext:file-comment "$Id: clx-module.lisp,v 1.1 2007/08/21 15:49:27 fgilham Exp $")
(provide :clx)
(load "clx:defsystem.lisp")
(load-clx (translate-logical-pathname "CLX:"))
This diff is collapsed.
;;; -*- Package: XLIB -*-
;;; **********************************************************************
;;; This code was written as part of the CMU Common Lisp project at
;;; Carnegie Mellon University, and has been placed in the public domain.
;;; If you want to use this code or any part of CMU Common Lisp, please contact
;;; Scott Fahlman or
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/clx/cmudep.lisp,v 1.3 2007/08/21 15:49:27 fgilham Rel $")
;;; **********************************************************************
(in-package "XLIB")
(alien:def-alien-routine ("connect_to_server" xlib::connect-to-server)
(host c-call:c-string)
(port c-call:int))
......@@ -20,6 +20,9 @@
;;; Created 04/09/87 14:30:41 by LaMott G. OREN
(ext:file-comment "$Id: debug.lisp,v 1.2 2007/08/21 15:49:29 fgilham Exp $")
(in-package :xlib)
(export '(display-listen
......@@ -20,6 +20,9 @@
;;; Created 07/15/87 by LaMott G. OREN
(ext:file-comment "$Id: describe.lisp,v 1.2 2007/08/21 15:49:29 fgilham Exp $")
(in-package :xlib)
(defparameter *request-parameters* (make-array (length *request-names*)))
......@@ -76,7 +79,7 @@
(format t " Bytes:~%~v@t" margin)
(dotimes (k (- length (- j start)))
(format t "~a" (int-char (card8-get j)))
(format t "~a" (code-char (card8-get j)))
(incf j)))
(format t " Bytes:~%~v@t" margin)
;;; -*- Mode: LISP; Syntax: Common-lisp; Package: (XTEST (XLIB LISP)); Base: 10; Lowercase: Yes -*-
(in-package :xtest :use '(:xlib :lisp))
;;; This code was intended for CLUE. --FMG
(ext:file-comment "$Id: event-test.lisp,v 1.2 2007/08/21 15:49:29 fgilham Exp $")
(defpackage "XTEST"
(:use :xlib :common-lisp)
(in-package "XTEST")
(defstruct event