Xlib: DisplayWidth / DisplayHeight

Carsten Haitzler raster at rasterman.com
Tue Sep 5 17:42:47 UTC 2023


On Tue, 5 Sep 2023 13:25:03 +0200 Lucien Gentis
<lucien.gentis at univ-lorraine.fr> said:

> 
> Le 05/09/2023 à 06:18, Carsten Haitzler a écrit :
> > On Thu, 31 Aug 2023 08:02:38 -0400 (EDT) Vladimir Dergachev
> > <volodya at mindspring.com>  said:
> >
> >> The cool thing however, is that I can launch xeyes and it works just the
> >> same as when it was created decades ago. This is because people back then
> >> thought through the mathematical model of what they are doing, and did not
> >> just "softwared" their way to a kludge that needed compatibility breaking
> >> changes every year the way python does.
> > hear hear. api stability has been one of x's shining bits. it's got ugly
> > parts
> > - but not breaking is one of its positive points. evolving instead.
> >
> >> best
> >>
> >> Vladimir Dergachev
> >>
> >>> -- 
> >>> regards,
> >>> Zbigniew
> >>>
> >
> Hello,
> 
> I'm writing things at xlib level, so:
> 
> ************************************
> 
> unsigned int displaywidth, displayheight;
> 
> Display * serveur = XOpenDisplay (NULL);
> 
> int ecran = DefaultScreen (serveur);
> 
> displaywidth = DisplayWidth(serveur,ecran);
> displayheight = DisplayHeight(serveur,ecran);
> 
> **************************************
> 
> and if you have more than one screen, you can get their number via macro 
> ScreenCount)(display)

that is only useful/valid for ye olde multi-head (multiple root window)
screens. that is essentially dead and unused in modern x's and we all use
xrandr now in which case "what is the screen" is actually an unknown question
unless you know explicitly which xrandr output it is OR you've mapped a window
AND it's been managed by the wm - but then screen can change on the fly as
these can move around from output to output, span multiple etc.


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - raster at rasterman.com



More information about the xorg mailing list