[comp.windows.x] Obtaining a windows border pixel

scheele@spp2.UUCP (Mark Scheele ) (09/10/88)

Can a Window Manager obtain the border pixel of a client.
I want to color the background of my WM shell based on the
color of the clients border, I can't seem to find a call to
get this information.

Bruce Beisel
TRW
One Space Park
Redondo Beach, CA 90278
213-217-4916

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (09/13/88)

> Can a Window Manager obtain the border pixel of a client?

Nope.  The server converts the background and border pixmaps (pixels are
basically a shorthand for solid-color pixmap) to whatever internal
representation is most efficient, and is not required to bump the reference
count of the PIXMAP data structure.  Since the client is allowed to immediately
free the pixmap after creating the window (see CreateWindow in the Protocol
document), there might not be a pixmap corresponding to the indicated id (or
worse yet, it could be the wrong one).


						Jim Fulton
						MIT X Consortium

ler@hpfclp.SDE.HP.COM (Larry Rupp) (09/14/88)

> Can a Window Manager obtain the border pixel of a client.

You could use the same technique that "xwd" uses to get the border of a
window (in a somewhat abbreviated manner).
i.e.
	- use XGetWindowAttributes to determine if the window
	  actually *does* have a border.
	- use XGetImage with x = y = -1 and width = height = 1;
	  this will return a single pixel "image" which is the border
	  pixel northwest of the windows's 0,0 pixel.

It seems it should be possible to use XGetPixel but it is restricted to
accessing pixels within the image.  Be sure to check the caveats for
XGetImage regarding unmapped and obscured windows!

Larry Rupp