ms2@doc.ic.ac.uk (M Shelley) (05/14/91)
Beginner Alert ============== When I want to find the geometry of a window, I use XGetGeometry (surprise) However, when I am using a window manager, I get strange results for the position of the window. Presumably this is due to the window manager creating a slightly larger window to accomodate the border etc and then reparenting my window. How do I find the position of the window I created relative to the root rather than its decoration window? Cheers muchly (in advance) Martin ----------------------------------------------------------------------- Martin A. Shelley, BSc3 ms2@uk.ac.ic.cc Imperial College London SW7. "Sole intention : it's learning to fly, Condition grounded, but determined to try" - Pink Floyd -----------------------------------------------------------------------
das15@cunixa.cc.columbia.edu (Douglas A Scott) (05/18/91)
In article <1991May14.152349.8968@doc.ic.ac.uk> ms2@doc.ic.ac.uk (M Shelley) writes: >Beginner Alert >============== > >When I want to find the geometry of a window, I use XGetGeometry (surprise) >However, when I am using a window manager, I get strange results for the >position of the window. Presumably this is due to the window manager creating a >slightly larger window to accomodate the border etc and then reparenting >my window. > >How do I find the position of the window I created relative to the root rather >than its decoration window? I too would like to know this. I wrote a routine to recusively descend through the windows to the root in order to pinpoint the location of a particular window relative to the root (one that was *originally* a child of the root before the wm got ahold of it), but the trouble is, one can never tell just how many windows come between the one you want info about and the root. So post the answer to the newsgroup, if you would, someone. Thanks. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Douglas Scott Columbia University Computer Music Studio Internet: <doug@woof.columbia.edu> <das15@cunixa.cc.columbia.edu> UUCP: ...!columbia!woof!zardoz!doug Phone: (703)765-4771
doug@genmri.UUCP (Doug Becker) (05/21/91)
How do I find the position of the window I created relative to the root rather than its decoration window? Take a look at XTranslateCoordinates (section 3.10 in Xlib). -- Doug Becker doug@nmri.ge.com crdgw1!sane!doug
spencer@eecs.umich.edu (Spencer W. Thomas) (05/23/91)
> In article <1991May14.152349.8968@doc.ic.ac.uk> ms2@doc.ic.ac.uk (M Shelley) writes: >How do I find the position of the window I created relative to the root rather >than its decoration window? My solution was the following: XGetWindowAttributes(display, the_win, &wattr); XQueryTree(display, the_w, &root_w, &par_w, &children_w, &n_child); XFree( children_w ); /* Don't need this */ /* * If parent is not root, we have been reparented by a window * manager, so translate coordinates to root window. */ if ( par_w != root_w ) XTranslateCoordinates(display, par_w, root_w, wattr.x, wattr.y, &shellx, &shelly, &child_w); else { shellx = wattr.x; shelly = wattr.y; } -- =Spencer W. Thomas EECS Dept, U of Michigan, Ann Arbor, MI 48109 spencer@eecs.umich.edu 313-936-2616 (8-6 E[SD]T M-F)