Xlib: DisplayWidth / DisplayHeight

Zbigniew zbigniew2011 at gmail.com
Tue Sep 5 07:38:54 UTC 2023

> 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

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:

       int DisplayHeight(Display *display, int screen_number);
       int DisplayWidth(Display *display, int screen_number);

It's clearly defined there.

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);

        printf("Height: %d\n", height);
        printf("Width: %d\n",  width);

        return 0;

What more you need to find out „which display”?

More information about the xorg mailing list