Get Display width and height

Dear Rooters,

is there a way the get the height and the width of the display you just work on? I already tried this:

Int_t dx,dy,dw,dh; gVirtualX->GetGeometry(-1,dx,dy,dw,dh); cout<< "x:"<<dx<<" y:"<<dy<<" width:"<<dw<<" height:"<<wh<<endl;
Unfortunatly all the values are 0 all the time.

I am working with Windows xp.

Thank you,
Lutz

see functions from TCanvas

Int_t GetWindowTopX(); Int_t GetWindowTopY(); UInt_t GetWindowWidth();const UInt_t GetWindowHeight() const

Rene

Hello Rene,

thanks for the quick reply. Those functions give me the size and the position of my Canvas. But browsing further into the TCanvas tree I found thatgClient->GetDisplayHeight(); gClient->GetDisplayWidth(); will give me the information that I wanted.

Thanks a lot for the good hint.
Lutz

   Int_t qq;
   UInt_t ww;
   UInt_t hh;
   gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);

works both win32 and x11

[quote=“Valeriy Onuchin”] Int_t qq; UInt_t ww; UInt_t hh; gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);

works both win32 and x11[/quote]

Very interesting. But what will be in ‘qq’ ??? :slight_smile:

guess?
Correct answer - qqshka (aka cuckoo) :smiley:
or check root.cern.ch/root/htmldoc/TVirtu … WindowSize for details

[quote=“Valeriy Onuchin”]guess?
Correct answer - qqshka (aka cuckoo) :smiley:
or check root.cern.ch/root/htmldoc/TVirtu … WindowSize for details[/quote]

Correct answer “fignja kakaja-to”- UNDEFINED BEHAVIOR for GDK_DRAWABLE_PIXMAP, have you ever heard such words for C++ ?

x = y = 0; if x and y are the same l-value?

how to reproduce it?

something like

std::cout<<++i<<’ ‘<<i++<<’ '<<++i<<std::endl;

or

vec[i++] = ++i;

:slight_smile:

I didn’t see such message under win32. OK. I’ll check it later.
I’m using exactly the same code in GuiBuilder … :confused:

[quote=“Valeriy Onuchin”]I didn’t see such message under win32. OK. I’ll check it later.
I’m using exactly the same code in GuiBuilder … :confused:[/quote]

Valeri, forget about :slight_smile: Partially, it was a joke :slight_smile:

Yes, this is UB due to C++ standard (this part of C++ standard text is real hard-core, even C++ experts can read it in different ways :slight_smile: ), but we can live with it - I guess it’s difficult/impossible to find a compiler which will generate something strange for expression x = x = 0; (or x = y = 0;). Of course, std::cout<<i++<<’ '<<++i; is more serious example of UB. No compiler required to issue diagnostic message in these cases.