Re: Position of a GUI window on the screen

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Mar 15 2000 - 16:14:24 MET


Hi Rainer,

  the window position reported by GetWindowSize() is relative to the
parent of the window. The parent of a top level window is the window
put around it by the window manager. Some window managers put even
more than one window around a user's top level window. So one has to
take the offset, not of the direct parent, but of the X11 root window:

Window_t wdum;
int x,y;
gVirtualX->TranslateCoordinates(g->GetId(),gClient->GetRoot()->GetId(),0,0,x,y,wdum);

where g is your TGMainFrame. Check this with the xwininfo system command.


Cheers, Fons.



ROHLFS Reiner wrote:
> 
> Hi ROOT team,
> 
> How can I get the position of a GUI window (TGMainFrame) on the screen?
> 
> The function TVirtualX::GetWindowSize() returns always 0 for the x an y
> parameter, independent of the position of the window on the screen.
> 
> The TGMainFrame class has a SetWMPosition() - method but no GetWMPosition().
> 
> Thanks Reiner.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET