Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!wuarchive!uunet!stanford.edu!msi.umn.edu!umeecs!zip!spencer From: spencer@eecs.umich.edu (Spencer W. Thomas) Newsgroups: comp.windows.x Subject: Re: XGetGeometry Message-ID: Date: 22 May 91 18:01:08 GMT References: <1991May14.152349.8968@doc.ic.ac.uk> <1991May18.140847.346@cunixf.cc.columbia.edu> Sender: usenet@zip.eecs.umich.edu (Mr. News) Organization: University of Michigan EECS Dept Lines: 22 In-Reply-To: das15@cunixa.cc.columbia.edu's message of 18 May 91 14: 08:47 GMT > 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)