[comp.windows.x] Why can't I inquire about borders?

Kimbrough@dsg.csc.ti.COM (Kerry Kimbrough) (10/30/87)

Apparently, there is no reliable way for a client to learn the border/background
pixel/pixmap used by a window (barring a priori knowledge, of course).  In
particular, a client cannot find out about a root window's border/background
(i.e.  the one at the top of the chain of CopyFromParent defaults).  Pray, why
is this?

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (10/30/87)

One of those perennial questions, I suppose.  Consider the following:

	(let ((pixmap (xlib:create-pixmap :drawable w :width 10 :height 10
					  :depth (xlib:drawable-depth w))))
	  (setf (xlib:window-border some-window) pixmap)
	  (xlib:free-pixmap pixmap))

For those who can't read it, suppose you create a pixmap, store it as a
border pixmap, and then free the pixmap. [Doesn't it irk you when people
speak in foreign tongues?]

This is legal according to the protocol (and, if you have no further
need to reference the pixmap, is a fine idea, since the server may be
cleverer than you at finding alternate implementations of what you ask
for).  When you free certain resources, like pixmaps and cursors, what
is freed is the association between the resource id and the object; the
object itself is not freed until all internal references within the
server are gone (reference counting is typically employed in the absence
of automatic garbage collection).  So, when you free the pixmap, the
border of the window remains unchanged, but there is no longer an
external name to be handed out to clients that might ask for it.  Since
resource-id allocation is controlled by clients, there is no
particularly good way for the server to create one on the fly.

swick@ATHENA.MIT.EDU (Ralph R. Swick) (10/30/87)

    Date: Thu, 29 Oct 87  17:40:53 CST
    From: Kerry Kimbrough <Kimbrough%dsg.csc.ti.com@RELAY.CS.NET>

    a client cannot find out about a root window's border/background
    (i.e.  the one at the top of the chain of CopyFromParent defaults).  Pray, why
   is this?

The background/border pixmaps may be freed immediately after creating
the window or changing the window attributes, thus there may be no valid
pixmap id to return to the client.  Background/border pixels are turned
into "pixmaps of undefined size" (see XSetWindowBackground) by the server.

karlton@decwrl.dec.com (Philip Karlton) (10/30/87)

In article <2771538053-221473@Sierra> Kimbrough@dsg.csc.ti.COM (Kerry Kimbrough) writes:
	Apparently, there is no reliable way for a client to learn the
	border/background pixel/pixmap used by a window (barring a priori
	knowledge, of course).  In particular, a client cannot find out
	about a root window's border/background (i.e.  the one at the top
	of the chain of CopyFromParent defaults).  Pray, why is this?

This is because it is legal for a client to destroy the pixmap after it has
been set as a windows border or background. It was considered wrong for there
to be a protocol request that would return an ID for an X resource which was
no longer noisnoisn