Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!vtserf!creatures!bloss.cs.vt.edu!ramakris From: ramakris@bloss.cs.vt.edu (S.Ramakrishnan) Newsgroups: comp.windows.x Subject: Re: Getting window position Keywords: XTranslateCoordinates , root window, window position. Message-ID: <532@creatures.cs.vt.edu> Date: 31 Jul 90 22:11:44 GMT Sender: usenet@creatures.cs.vt.edu Reply-To: ramakris@bloss.cs.vt.edu (S.Ramakrishnan) Distribution: na Organization: Virginia Tech Computer Science, Blacksburg, VA Lines: 40 In reply to the query of joe@etac632 (Joe Fulson-Woytek) of NSESCC, ------------------------------------------------------------------------ Goddard Space Flight Center, Greenbelt MD ------------------------------------------------------------------------ > My next step was to find the position and size of the X window after an > expose event. The likely candidates seemed to be XGetGeometry or >Joe FUlson-Woytek Getting the window position --------------------------- I assume that you need the position of the top left of thw window with respect to the root window coordinates. Why not try this simple method : int pos_x, pos_y ; XTranslateCoordinates(display , window , root_w , 0 , 0 , &pos_x , pos_y ); where display = the current display of the window. window = the window in question. ( 0 , 0 ) == coordinates of the top left of the window. If someone thinks there could be problems with this, please do inform me. I have used this method in some packages and am so far not having any problems. -- -- S.Ramakrishnan, CS Dept, McBryde Hall, VaTech, Blacksburg, Virg. 24061-0106 (email : ramakris@bloss.cs.vt.edu, ramakris@vtcc1.cc.vt.edu)