Subject: Re: learning lisp by doing
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 25 Aug 2005 02:55:02 -0500
Newsgroups: comp.lang.lisp
Message-ID: <Ud6dnVHoSY7L5JDeRVn-rg@speakeasy.net>
Alan Crowe  <alan@cawtech.freeserve.co.uk> wrote:
+---------------
| Rob Warnock suggests
| > 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)
| 
| I've changed the text of my first example. It now reads
| ..
|     (The intervention of the window manager, known as
|     redirection, is undesirable when you are popping up a menu
|     window, and can be turned off, that is overridden, with
|     ":override-redirect :on". Don't try this now. Since the
|     window manager has been told to stay out of it, it will not
|     put a border round your window, so there might be nothing to
|     see even if the code works.)
+---------------

Whereas if you use (set-wm-properties :user-specified-position-p t),
the WM still decorates the window (border, titlebar), but (hopefully)
puts it where you asked for it to be with (create-window :x x :y y ...).

+---------------
| I've uploaded an extra example (that I wrote a while ago) that uses
| xlib:change-properties to set the wm_name property so as to
| give the window a name. That introduces properties and sets
| the scene for menu code that will actually use
| :user-specified-position-p t or :override-redirect.
| 
| I used xlib:change-properties because I didn't know about
| xlib:set-wm-properties. It is missing from the index of my
| copy of the CLX programmer's Reference.
+---------------

Well, *I* didn't know about XLIB:CHANGE-PROPERTIES, 'cuz I never
read all the way through the CLX Programmer's Reference.  ;-}
I learned about XLIB:SET-WM-PROPERTIES from some analogous
code in one of the Elk Scheme XLIB examples, and found that
CLX provided the same function.

And I didn't know about (create-window :override-redirect :on ...),
either, so thanks for that!  ;-}

+---------------
| Is there any reason to prefer one or the other?
+---------------

Except for your observation about keyword args vs. positional,
I don't. But then, I really don't know enough about the X Windows
protocol to be giving very much advice.  :-(


-Rob

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