How do I obtain the dimensions of the display on which my application is
running? |
27-May-02 10:00 GMT |
Question: How do I obtain the dimensions of the display on which my application is
running?
You can easily obtain this information by making use of the following
Xlib macros (defined in X11/Xlib.h):
DisplayWidth(dpy, scr)
DisplayHeight(dpy, scr)
where "dpy" is your display (obtained using XtDisplay) and "scr" is the
screen number (obtained by using a combination of XtScreen and
XScreenNumberOfScreen).
A simple code example is as follows:
#include <X11/Xlib.h>
show_scr_size()
{
int disp_width, disp_height;
disp_width = DisplayWidth(XtDisplay(shell1),
XScreenNumberOfScreen(XtScreen(shell1)));
disp_height = DisplayHeight(XtDisplay(shell1),
XScreenNumberOfScreen(XtScreen(shell1)));
printf ("width=%d, height=%d\n", disp_width, disp_height);
}
Sponsored
by X-Designer - The Leading X/Motif GUI Builder
- Click to download a FREE evaluation
Goto top of page
|