[openbox] Window geometry information.

Zephaniah E. Hull warp at babylon.d2dc.net
Sun Jan 11 15:17:41 EST 2004


On Sun, Jan 11, 2004 at 02:55:26AM -0500, Ben Jansens wrote:
> 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 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.
> 
...
> 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.

Understood, what I ended up with (with the help of Tore) is:

/* Credit goes to Tore Anderson for helping me figure out how to do this
 * better.  And all of the blame now goes to me. */
void myGetGeometry(ObClient *c,
        int *rx, int *ry, unsigned int *rw, unsigned int *rh)
{
    *rx = c->frame->area.x + c->frame->size.left;
    *ry = c->frame->area.y + c->frame->size.top;
    *rw = c->frame->area.width - c->frame->size.left -
c->frame->size.right;
    *rh = c->frame->area.height - c->frame->size.top -
c->frame->size.bottom;
}

This seems to do what I want, and I posted an updated patch. (Bugzilla
#1114)

I am curious what you think of the patch though.

Thanks.

Zephaniah E. Hull.

-- 
	1024D/E65A7801 Zephaniah E. Hull <warp at babylon.d2dc.net>
	   92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
	    CCs of replies from mailing lists are requested.

In article <acuql9$2j0$1 at allhats.xcski.com>, David P. Murphy wrote:
>You cannot run Windows innocently.  Guilt of aiding & abetting, at the
>very least, is automatic.  Loading up on anti-virus and firewall software,
>even decent ones, are merely well-meaning actions to be taken into
>consideration by judge and jury when deciding your sentence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://icculus.org/pipermail/openbox/attachments/20040111/ec75a72c/attachment.pgp>


More information about the openbox mailing list