Xlib: DisplayWidth / DisplayHeight

Carsten Haitzler raster at rasterman.com
Tue Sep 5 18:03:58 UTC 2023


On Tue, 5 Sep 2023 09:38:54 +0200 Zbigniew <zbigniew2011 at gmail.com> said:

> > You keep avoiding the question. WHICH SCREEN?
> > [..]
> >
> > so will you answer the question - what screen do you mean? as i mentioned
> > before. i think you have a far too basic view of screen and i'm trying to
> > paint just a few of the possible scenarios to have you think about this.
> > this discussion is going nowhere otherwise.
> 
> I've got a feeling you are trying to dilute this exchange by
> artificially introducing conceptual confusion. Just as Pilate asked:
> „but what exactly is truth?” — you keep asking: „which actually
> screen?”.

I'm not trying to dilute anything with confusion. I have been writing xlib code
for decades. Almost 30 years of it. I've written 100,000's of lines of it. I've
written window managers, compositors, GUI toolkits, image rendering libraries
for X, terminal emulators, video players, music players, various x toys like
xflame, xripple and more. I've been doing this a VERY long time and know my way
around X pretty well as result. I'm asking you because I know what I'm doing. I
know what I'm asking. I'm asking because the question and answer to it is *KEY*
to knowing what to do. I know EXACTLY what I am asking for and why I'm asking
for it. You keep avoiding the question and now trying to deflect it as a
ad-hominem attack on me thinking I'm trying to create confusion. Just accept
the fact I know what I'm on about and to help you I need an answer, otherwise I
may as well give up.

> As I already answered: the one described by the parameters. ('display'
> is a pointer to a 'Display' structure returned by a previous call to
> XOpenDisplay() ). The parameters to functions we're talking about are
> described as follows:

You did NOT answer. I listed some options and you snipped them out and ignored
them.
 
>        int DisplayHeight(Display *display, int screen_number);
>        int DisplayWidth(Display *display, int screen_number);
> 
> It's clearly defined there.

I have zero interest in the API definitions. I want to know what behaviour you
are trying to get. what is the problem you are solving?

> Say, we've got a simple program:
> 
> #include <X11/Xlib.h>
> #include <stdio.h>
> int main(int argc,char **argv) {
>         Display *display = XOpenDisplay(NULL);
>         int screen_number = DefaultScreen(display);
>         int height = DisplayHeight(display, screen_number);
>         int width = DisplayWidth(display, screen_number);
>         XCloseDisplay(display);
> 
>         printf("Height: %d\n", height);
>         printf("Width: %d\n",  width);
> 
>         return 0;
> }
> 
> What more you need to find out „which display”?

Read what I wrote for once please and answer the question if you ever want to
move along and solve your problem. I' and others have asked many times
without an answer. The API won't change so stop barking up that tree. What you
need is to be pointed to the right APIs or set of actions/behaviours you
should do to get a specific result. I shall for a last time copy and paste it
here. From my previous mail you replied to:

----8<----

"You keep avoiding the question. WHICH SCREEN?

the screen where your window WILL appear on in future? the one it's currently
on? if it is spanning multiple screens (half way between 2 or perhaps 3 or 4
etc.) then which one(s) do you mean? what happens if your window moves from
screen to screen? the user moves it (via the window manager) or the wm just
decides to move it e.g. if a new screen is plugged in (or if a screen is
unplugged)."

----8<----

Which screen? What is your use case? What are you trying to achieve? Creating a
window that is fullscreen in size? Is it a regular client window or an
override-redirect one? Do you even know the difference between these? Are you
implementing a window manager, compositor or something that doesn't even create
"regular WM managed windows" (regular WM managed windows normally get
titlebars and can be moved around etc. by users)? What do you need to know the
screen size for? What are you trying to achieve? I do not want to hear you
repeat anything to do with DisplayHeight DisplayWidth. I want to hear what kind
of behaviour, effect, result you are trying to come up with. Why do you NEED to
know the screen width and height? What are you going to do with such
information if you had it?


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - raster at rasterman.com



More information about the xorg mailing list