Xlib: DisplayWidth / DisplayHeight

Zbigniew zbigniew2011 at gmail.com
Thu Aug 31 11:09:14 UTC 2023


> Perhaps you should share your use case on why you need to know the screen
> size when there are far better mechanisms to handle this?

Because the use of the mentioned functions/macros is simple and
straightforward. But they are flawed, unfortunately.

So what mechanism do you propose to use for that?

> 3. Xserver handled panning is actually incredibly rare (that is what you
> have
> been describing). The panning you probably see 99.9% of the time is
> actually
> implemented by window managers as virtual desktops. This is not even
> implemented by Xlib or the Xserver but by a different process and here you
> have
> a whole different world to deal with and it's much more vague than thing
> than in
> X's "core". So I think your while understanding of virtual screens is flawed
> to begin with.

Is it rare, or it isn't — I believe you'll agree that I should've got
the proper dimensions of physical screen using these macros.

> 4. As has been mentioned - your understanding of screens is also flawed.
> You
> say these above macros should return the real screen width and height...
> what screen is that?

Dear Carsten,
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() )

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

> 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

That's what APIs are for — to allow to make use out of *something* not
spending next two years to become acquainted with every possible
internals' aspect.

OK, you know what I'm about to. You stated, that the fix is impossible.

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.

That's all I need for today — and that's what DisplayWidth /
DisplayHeight promised to return
-- 
regards,
Zbigniew


More information about the xorg mailing list