[openbox] Window geometry information.

Ben Jansens ben at orodu.net
Sun Jan 11 02:55:26 EST 2004

On Thu, Jan 08, 2004 at 10:16:39PM -0500, Zephaniah E. Hull wrote:
> I am currently working on a few odd features, which I'll submit when
> done.
> However I am currently still digging about the source trying to find
> some window geometry information.
> I have found the ObClient for what I want (the window currently in
> focus), however what I need is the x and y for the window's display
> area, and the width and height.
> Note, not the entire window, just the part that the application actually
> controls.
> Hopefully it is hiding in one of the fields and I'm just blind or
> confused. (=:]

ObClient and ObFrame each have a "Rect area" which describes the position
and size of the window. But they represent different values.

The HACKING file states as follows :)

When using coordinates/sizes of windows, make sure you use the right area.
The Client.area rect is the reference point and size of the *CLIENT* window.
This value is not what you see in any shape or form, and gravity is applied
to it to translate it into what you see. The Client.frame.area is the actual
position and size of the entire frame. This is usually the value you want to
use, unless you are in client.c (probably) and adjusting/using the position
or size from the client's perspective.

Be VERY careful if you are using the client's rectangle, because what works
for a normal window will possibly break entirely for windows with a
different gravity setting :)

To recap so this makes sense I hope --

The frame's rect represents the window on the screen, simply the position
and size of the entire frame. The frame's "size" strut represents how large
the frame is on each side of the client. These combined can be used to find
the exact onscreen area of just the client window if that's what you want.

On the other hand, the client's rect represents the size and position which
the client has requested, and where it thinks it is. It is really not
related to the actual position/size of the final window except thru the
translation functions provided in frame.[ch].

Hope this helps :)

Utility functions such as the one posted would be entierly not needed as the
WM tracks the full state of all the windows it is managing.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://icculus.org/pipermail/openbox/attachments/20040111/54261b36/attachment.pgp>

More information about the openbox mailing list