Xlib: DisplayWidth / DisplayHeight

Julian Bradfield jcb+fdt at julianbradfield.org
Wed Aug 30 17:01:02 UTC 2023


On 2023-08-30, Zbigniew <zbigniew2011 at gmail.com> wrote:
>        „The  DisplayHeight  macro returns the height of the specified screen in
>        pixels.
>
>        The DisplayWidth macro returns the width of the screen in pixels.”
>
> This is what I want, and this is what — as „man” page states — I
> should get, regardless of presence of any „subsystems”. I want nothing
> more than is described there.

Your fundamental problem is that you don't know what a screen is. As
has been explained several times, a "screen" in X is not a physical
display device. Decades ago, there was almost always a 1-1
correspondence between screens and display devices, but you're not
writing programs for the 1990s.

What you want is the dimensions of a monitor. Until XRANDR, X had no
way of providing that. Now it does.

> Are you serious when stating, that during creation of a program I
> should play guessing game „what kind of 'subsystem' the user may
> employ”?

No, you don't play a guessing game, you query the server to find out
which extensions are in use.
This may be a bit tedious, but other programmers have been doing it
for twenty years so you can too. If you're not capable of writing and
encapsulating a function to achieve what you want, you probably
shouldn't be trying to write raw X applications, but should use a suitable
toolkit.


More information about the xorg mailing list