[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

store-color in CLX version 4



I noticed a bug in store-color.  In the branch that makes the call to
storenamedcolor, the flags are ignored.

The file clx.lisp claims that I'm using CLX version 4.

Is there somewhere I can get all the CLX patches?  I'd be surprised if
this hasn't been  noticed and fixed by someone else yet.

I haven't managed to draw a green line across a window yet, and I
don't know if I'm being numb-brained about colormaps or there's some
bug in the server or there's some bug in CLX.  I could do all this in
X10.  On a pseudo-color screen with max-installed-colormaps set to 1,
are you supposed to manipulate the colormap of the root window, or are
you supposed to create your own colormap?  If I try to manipulate the
colormap of the root window, there cells I allocate aren't
automatically freed when my program exits.  If I create my own
colormap, then the first pixel allocated is number 0, I get access
errors when I try to store something in that cell of the colormap.

In the file requests.lisp:

(defun store-color (colormap pixel spec &key (red-p t) (green-p t) (blue-p t))
  (declare (type colormap colormap)
	   (type pixel pixel)
	   (type (or stringable color) spec)
	   (type boolean red-p green-p blue-p))
  (let ((display (colormap-display colormap))
	(flags 0))
    (declare (type display display)
	     (type card8 flags))
    (when red-p (setq flags 1))
    (when green-p (incf flags 2))
    (when blue-p (incf flags 4))
    (with-display (display)
      (etypecase spec
	(color
	 (with-buffer-request (display *x-storecolors*)
	   (colormap colormap)
	   (card32 pixel)
	   (rgb-val (color-red spec)
		    (color-green spec)
		    (color-blue spec))
	   (card8 flags)
	   (pad8 nil)))
	 (stringable
	  (let* ((string (string spec))
		 (length (length string)))
	   (with-buffer-request (display *x-storenamedcolor*)
	     ((data card8) flags) ; <<< ----- This line added
	     (colormap colormap)
	     (card32 pixel)
	     (card16 length)
	     (pad16 nil)
	     (string string))))
	 ))))