Xlib: DisplayWidth / DisplayHeight

Po Lu luangruo at yahoo.com
Wed Aug 30 14:39:10 UTC 2023


Zbigniew <zbigniew2011 at gmail.com> writes:

>> Are you making reference to DisplayWidth and DisplayHeight, or
>> DisplayWidthMM and DisplayHeightMM?
>
> Talking about DisplayWidth and DisplayHeight functions.
>
>>  And please explain which X extension supplies your ``virtual
>> screen'' functionality
>
> It's done like this:
> xrandr --output DVI-0 --mode 1920x1200 --panning 2520x1575
>
>> rather monitors or outputs, wherein the server extension that
>> implements them
>> should be exploited to ascertain their dimensions.
>
> No, there are two functions, that should return the proper values
> regardless of how the virtual screen was created, which extension has
> been used etc. The programmer shouldn't be bothered with such kind of
> investigation.
> And I'm not talking about size of virtual screen ˛— you may want to
> read again my initial post — but exactly about „physical screen”
> dimensions. These are the values that should be returned by
> DisplayWidth and DisplayHeight functions.
>
> 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.  Furthermore, any change to their existing
semantics would cause countless programs reliant on its present behavior
to malfunction.

Use the XRandR extension to ascertain the dimensions of individual
outputs: an X "screen" designates a single root window, not a physical
output device, and its dimensions therefore do not reflect that of any
outputs which may be connected.  As one of the cornerstones of the X
protocol, it cannot be subject to change.


More information about the xorg mailing list