[comp.windows.x] Window manager geometry updating.

healy@spice.cs.cmu.edu (James Healy) (08/25/88)

Today I noticed that both twm and awm both do strange things with the x
and y attributes of a window.  When I create a simple window and then map
it while running either twm or awm, both set the x and y window attributes
to weird values like 0 and 21.  These never get changed regardless of
where I move the windows.

The width and height attributes, however, are always updated properly.
Also uwm seems to update the x and y values correctly, as well as the
width and height.

I verified this on an IBM RT and a Sun 3, both running Mach.  Has anybody
else noticed this or this a local problem?  I'm perfectly willing to send
in a formal bug report, but I wanted to find out if this is possibly a
known bug.

Or am I just being stupid and overlooking something obvious?  If so, how
can I get the *real* x and y values for a window while using either awm or
twm?

Thanks for your help,
--Jim Healy.
ARPANET:    healy@spice.cs.cmu.edu
BITNET:     healy%spice.cs.cmu.edu@cmccvb
UUCP:       ...!{uunet, ucbvax, harvard}!spice.cs.cmu.edu!healy

healy@spice.cs.cmu.edu (James Healy) (08/26/88)

Thanks for the responses.  It seems that both twm and awm reparent each
window on the screen with same-size windows underneath the ones you see.
When a titlebar (or other decoration) gets put on a window, the parent
window is extended upward a little bit and the titlebar ornaments get
drawn in this area at the top.

The x and y attributes of the window are reported with respect to this
parent window, not the root window.  Since the parent window always
follows the window you see on the screen, the x and y coordinates never
change. To get the coordinates with respect to the root window, use the
XTranslateCoordinates function.

--Jim Healy.
ARPANET:    healy@spice.cs.cmu.edu
BITNET:     healy%spice.cs.cmu.edu@cmccvb
UUCP:       ...!{uunet, ucbvax, harvard}!spice.cs.cmu.edu!healy

klee@daisy.UUCP (Ken Lee) (08/26/88)

In article <2783@pt.cs.cmu.edu> healy@spice.cs.cmu.edu (James Healy) writes:
>Today I noticed that both twm and awm both do strange things with the x
>and y attributes of a window.  When I create a simple window and then map
>it while running either twm or awm, both set the x and y window attributes
>to weird values like 0 and 21.  These never get changed regardless of
>where I move the windows.

Many window managers, such as twm and awm, reparent windows so they can
include command banners.  The 0 and 21 you get are the window's
position relative to the new parent (the command banner is 21 pixels
thick).  They never change because you are moving the parent with the
window.  If you want position on the screen, get the position of the
parent (if it's not root) and add it to the 0 and 21.

Ken Lee
Daisy Systems Corp., Interactive Graphics Tools Dept.
-- 
uucp:  {ames!atari, ucbvax!imagen, nsc, pyramid, sgi, uunet}!daisy!klee
arpanet:  daisy!klee@sgi.com or daisy!klee@uunet.com

Don't applaud, just throw money.