Xlib: DisplayWidth / DisplayHeight
Vladimir Dergachev
volodya at mindspring.com
Thu Aug 31 17:01:25 UTC 2023
> have a look, please, at the man page:
>
> int DisplayHeight(Display *display, int screen_number);
> int DisplayWidth(Display *display, int screen_number);
>
> „What screen is that”? The one described by the parameters.
> ('display' is a pointer to a 'Display' structure returned by a
> previous call to XOpenDisplay() )
So the man page for XOpenDisplay explains that you get the Display
structure by passing a description of which Xserver you are connecting to.
So using modern (2023) terminology:
Display *display - a structure describing Xserver instance (there
could be more than one running on the same computer)
int screen_number - an index of one of "root drawables"
I don't know exactly why they named things as they did. One possibility is
that the idea was that a display could consist of several physical
devices, like an airport display for arrivals and deparatures.
>
>> 5. In fact the whole use of these macros is pretty much broken.
>
> At least one person here notices and understands this. Yes, that's why
> I suggested a fix.
One could discuss whether you like the name, but the macros give a
bounding box of what could be drawn (0, 0, screen_width, screen_height),
so this is actually useful.
>
>> I can go on... I understand on the surface what you say - but you can't
>> always
>> get what you want and to me it seems your understanding of X is very
>> superficial and thus you don't know the right way to do things
>
>
> Then could you, please, suggest a „replacement functions” for these
> two, that I could use to get the dimensions of physical screen —
> whether is panning used, or not, is Xrandr used for that panning, or
> anything else, is it Linux, or any of xBSD's etc.? In all these cases
> t'll be still Xorg server, anyway.
Take a look at libxrandr, there are more details in an earlier e-mail.
best
Vladimir Dergachev
More information about the xorg
mailing list