[comp.windows.x] subwindows wanting to know top ancestor info.

pascale@trwacs.UUCP (Rita Pascale) (06/15/91)

Having a child/subwindow and knowing the top-most
ancestor window id (under the root window but not 
including the root), how can I find the top-most
window's width and height?

The only information I have on the child window
is its drawable area, not the rest of the window
structure.  And all I know about the top level
window is its id.

Is there a simple solution?

I tried cheating by adding fields to the drawable
structure, but this blew up things using the shape
extensions.

Rita Pascale                    |  Trusted X Research Group
pascale@trwacs.fp.trw.com       |  TRW Systems Division



-- 
Rita Pascale                    |  Trusted X Research Group
pascale@trwacs.fp.trw.com       |  TRW Systems Division

klee@wsl.dec.com (Ken Lee) (06/15/91)

In article <307@trwacs.UUCP>, pascale@trwacs.UUCP (Rita Pascale) writes:
|> Having a child/subwindow and knowing the top-most
|> ancestor window id (under the root window but not 
|> including the root), how can I find the top-most
|> window's width and height?

If you know the window ID, XGetGeometry will give you the width and height.
If you don't know the window ID, XQueryTree will give you a list of ancestors.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (06/15/91)

> If you know the window ID, XGetGeometry will give you the width and
> height.  If you don't know the window ID, XQueryTree will give you a
> list of ancestors.

Well, repeated calls to XQueryTree will; XQueryTree directly gives only
the parent.  (A nit, I know :-)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (06/17/91)

> Having a child/subwindow and knowing the top-most ancestor window id
> (under the root window but not including the root), how can I find
> the top-most window's width and height?

It sounds as though this is a special case of "I have a window ID, how
can I find its size?", where the child window is just a red herring.
If this is so you should look at XGetWindowAttributes and/or
XGetGeometry.

> I tried [...], but this blew up things using the shape extensions.

What do you want for a SHAPEd window?  The current shape?  The default
rectangle (what the shape would be if you set a mask of None)?  The
minimal bounding box of the current shape?

For the first, you need to use the XShapeGetRectangles call; for the
second, XGetWindowAttributes/XGetGeometry; for the third,
XShapeQueryExtents.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu