سؤال

I get this following code.

typedef struct _display {
int fd;         /* Network socket. */
Window root;        /* Root window id. */
int vnumber;        /* X protocol version number. */
int dtype;      /* X server display device type. */
int dplanes;        /* Number of display bit planes. */
int dcells;     /* Number of display color map cells. */
_QEvent *head, *tail;   /* Input event queue. */
int qlen;       /* Length of input event queue */
int request;        /* Id of last request. */
char * lastdraw;    /* Last draw request. */
char *buffer;       /* Output buffer starting address. */
char *bufptr;       /* Output buffer index pointer. */
char *bufmax;       /* Output buffer maximum+1 address. */
int squish;     /* Squish MouseMoved events? */
Pixmap black, white;    /* Constant tile pixmaps */
char *displayname;  /* "host:display" string used on this connect*/
int width, height;  /* width and height of display */
} Display;

But what I don't get, is where X gets the width and height of the monitor. Would anyone happen to know the answer, or be able to point me in the right direction?

Thanks, Arch

هل كانت مفيدة؟

المحلول 2

Getting screen size

نصائح أخرى

Why not get root window's attributes?

XWindowAttributes ra;
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &ra);
w = ra.width;
h = ra.height;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top