From: Nils Goesche
Subject: CLX question
Date: 
Message-ID: <87wvf07vup.fsf@darkstar.cartan>
Hi!

All I want is draw some pixels into a window and get some mouse
events, and because the only lisp without a limited core I have
is CMUCL and CLM isn't very well documented there, I thought CLX
would suffice.  So far I have managed to have a window pop up on
the screen, and it's even white.  But somehow I can't draw pixels
into it.  Here is some code:

(in-package xlib)

(defstruct xdata
  display
  screen
  window
  gcontext)

(defun make-graphics (x y width height)
  (let ((ret (make-xdata :display (open-display "localhost"))))
    (when (xdata-display ret)
      (setf (xdata-screen ret) (car (display-roots (xdata-display ret))))
      (setf (xdata-window ret)
	    (create-window :parent (screen-root (xdata-screen ret))
			   :x x
			   :y y
			   :width width
			   :height height
			   :border-width 2
			   :background (screen-white-pixel (xdata-screen ret))
			   :class :input-output))
      (if (null (xdata-window ret))
	  (progn
	    (close-display (xdata-display ret))
	    nil)
	(progn
	  (setf (xdata-gcontext ret)
		(create-gcontext :drawable (xdata-window ret)
				 :foreground
				 (screen-black-pixel (xdata-screen ret))))
	  (map-window (xdata-window ret))
	  (display-force-output (xdata-display ret))
	  ret)))))
			       

(defun destroy-graphics (xdata)
  (free-gcontext (xdata-gcontext xdata))
  (destroy-window (xdata-window xdata))
  (close-display (xdata-display xdata)))

(defun draw-pixels ()
  (let ((x (make-graphics 100 100 200 200)))
    (when x
      (let ((wnd (xdata-window x))
	    (gc (xdata-gcontext x)))
	(dotimes (i 30)
	  (draw-point wnd gc (+ i 20) (+ 20 i)))
	(display-force-output (xdata-display x))))
    x))

The window appears, but the pixels don't show up.  Any hints?

Regards,
-- 
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

From: Mike McDonald
Subject: Re: CLX question
Date: 
Message-ID: <rHZI5.2587$Qz2.71989@typhoon.aracnet.com>
In article <··············@darkstar.cartan>,
	Nils Goesche <······@t-online.de> writes:
> Hi!

> The window appears, but the pixels don't show up.  Any hints?
> 
> Regards,

  X programming error #1: you have to deal with events, in particular, the
expose event. Any drawing you do before you receive the expose event is a
waste of time and will be ignored. Follow the example in chapter 1 of the CLX
manual.

  Mike McDonald
  ·······@mikemac.com
From: Michael J Short
Subject: Re: CLX question
Date: 
Message-ID: <39F58A9A.AE9F2A7D@tothemoon.freeserve.co.uk>
I am using free lisp, where can I get a lisp with al of the graphics libs and
extras so that I can do windows etc,

Mike McDonald wrote:

> In article <··············@darkstar.cartan>,
>         Nils Goesche <······@t-online.de> writes:
> > Hi!
>
> > The window appears, but the pixels don't show up.  Any hints?
> >
> > Regards,
>
>   X programming error #1: you have to deal with events, in particular, the
> expose event. Any drawing you do before you receive the expose event is a
> waste of time and will be ignored. Follow the example in chapter 1 of the CLX
> manual.
>
>   Mike McDonald
>   ·······@mikemac.com
From: Friedrich Dominicus
Subject: Re: CLX question
Date: 
Message-ID: <87og0ae67e.fsf@q-software-solutions.com>
Michael J Short <·········@tothemoon.freeserve.co.uk> writes:

> I am using free lisp, where can I get a lisp with al of the graphics libs and
> extras so that I can do windows etc,
free lisp. Do not know any Common Lisp with that name. Anyway you
could look at Lispworks in CLIM or it's CAPI stuff. On Windows I do
think Corman Lisp provides access to the Win32 API.

Regards
Friedrich

-- 
for e-mail reply remove all after .com 
From: Rainer Joswig
Subject: Re: CLX question
Date: 
Message-ID: <joswig-C91BFD.16273824102000@news.is-europe.net>
In article <··············@q-software-solutions.com>, 
·····@q-software-solutions.com.NO-spam wrote:

> Michael J Short <·········@tothemoon.freeserve.co.uk> writes:
> 
> > I am using free lisp, where can I get a lisp with al of the graphics libs and
> > extras so that I can do windows etc,
> free lisp.

FreeLisp is/was an offering from Harlequin. It is superseded
by "LispWorks Personal Edition" (see:
http://www.xanalys.com/software_tools/downloads/index.html ,
Xanalys is now the home of Harlequin's Lisp products).

-- 
Rainer Joswig, Hamburg, Germany
Email: ·············@corporate-world.lisp.de
Web: http://corporate-world.lisp.de/
From: Eugene Zaikonnikov
Subject: Re: CLX question
Date: 
Message-ID: <6yaebutik3.fsf@localhost.localdomain>
* "Friedrich" == Friedrich Dominicus <·····@q-software-solutions.com> writes:

>> I am using free lisp, where can I get a lisp with al of the
>> graphics libs and extras so that I can do windows etc,
Friedrich>  free lisp. Do not know any Common Lisp with that
Friedrich>  name.

Perhaps FreeLisp? IIRC FreeLisp was an implementation available from
Harlequin site before they started releasing LispWorks trial
versions. I have it burned on CDR somewhere at dusty shelf...

-- 
  Eugene