Xlib: DisplayWidth / DisplayHeight

Zbigniew zbigniew2011 at gmail.com
Wed Aug 30 14:55:01 UTC 2023


>>> 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.

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?

>  Furthermore, any change to their existing
> semantics would cause countless programs reliant on its present behavior
> to malfunction.

„Existing semantics” is flawed. You may want to read my initial post again.

„Existing semantics” makes these functions unusable for reading width
and height of the screen, when virtual screen (AKA „panning”, if you
prefer) is in use, therefore NO PROGRAM can „malfunction”, because no
program had any chance to read the width and height of the screen
using these (still flawed) functions, when panning is used. These
functions are unusable in such situation. Period.

> 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.

„To ascertain the dimensions” there are two functions provided, that
should return proper width and height of the screen: DisplayWidth and
DisplayHeight. They should return proper values whether there is
panning in use — or it isn't — and even if virtual screen is used,
they still should return proper values regardless of method used for
panning. The programmer shouldn't be bothered with this („maybe the
user of my program will use Randr?”, „maybe he'll use X extension?”,
„maybe Y extension?” etc.).

Is the above clear enough for you?
-- 
regards,
Zbigniew


More information about the xorg mailing list