Xlib: DisplayWidth / DisplayHeight

Vladimir Dergachev volodya at mindspring.com
Wed Aug 30 15:55:31 UTC 2023



On Wed, 30 Aug 2023, Zbigniew wrote:

>>>
>>> So I would expect (in my particular case) to get 1920 and 1200 values,
>>> and NOT dimensions of virtual screen, I mean 2520 and 1575
>>
>> The behavior prescribed for these macros is to return the width and
>> height of the screen, and doesn't provide for the existence of concepts
>> such as panning or Xinerama.
>
> You may want to read again my initial post: yes, the functions
> described should „return the width and height of the screen”, as you
> wrote — regardless if panning was, or it wasn't used.
>
> You don't seem to understand this, I'm afraid?

The notion of "Screen" for Xserver is just a rectangular matrix of pixels 
where drawing is occurring.

It may or may not be displayed on a physical display, and the displayed 
portion might not be the full screen and may even be duplicated, in part 
or in full.

In particular, it is common to use Xvnc to create completely virtual 
screens that are only accessible through VNC viewer. Most people expect 
all their applications to work there too.

What you want is to find out the width and height of physical screen you 
have. To do that you need to use the subsystem that manages them - which 
is xrandr. And don't forget to specify which of 5 screen you have running 
you actually mean.

best

Vladimir Dergachev


More information about the xorg mailing list