Subject: Re: learning lisp by doing
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 19 Aug 2005 23:27:12 -0500
Newsgroups: comp.lang.lisp
Message-ID: <QM2dnUCWjp69LJveRVn-vg@speakeasy.net>
Alan Crowe  <alan@cawtech.freeserve.co.uk> wrote:
+---------------
| Is "Play with CLX" a reasonable suggestion?
| I've written notes at
|   http://alan.crowe.name/clx/simple/examples.txt
| which offer a far gentler (and sadly incomplete)
| introduction to CLX programming than the usual texts.
...
| http://alan.crowe.name/clx/3D-viewer/index.html
+---------------

Thanks! This is a much better introduction than my own
clumsy first CLX attempts.  ;-}

One thing you might want to add, though. In your "examples.txt",
you include the following [understandable!] complaint:

    (my-window (xlib:create-window :parent root-window
				   :x 0 :y 0 :width 200 :height 100)))

    This is the line you have been waiting for, that creates a
    window. Frustratingly, :x and :y are required parameters.
    You have to say where you want it, even though, as a top level
    window, the window manager will intervene and put it where it
    thinks best. The window manager can also overrule your chosen
    width and height, though that is less common.

Fortunately, there is a simple solution for this!! Just add this after
your XLIB:CREATE-WINDOW call but before the XLIB:MAP-WINDOW call:

    (xlib:set-wm-properties my-window
			    :name my-window-title	; a string
			    :icon-name my-icon-title	; a string
			    :user-specified-position-p t)

The magic is the ":USER-SPECIFIED-POSITION-P T", which asks the window
manager to respect the requested X & Y from the CREATE-WINDOW call.

Now you can place your windows wherever you want.  ;-}  ;-}


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607