From: Jason Daly (jdaly++at++ist.ucf.edu)
Date: 09/08/2005 08:00:17
wdai wrote:
>I am running Linux with two monitors. Using DisplayWidth only returns
>the screen size which is the combined screen size. I would like to know
>the size of each Monitor so part of my drawing could be confined to left
>or right monitors (not splitted over two). Thanks.
>
>
The code below will query Xinerama for your current screen configuration
(the NVIDIA driver adds
this extension to X whenever you set up TwinView). For your Performer
program you can replace the XOpenDisplay() with pfGetCurWSConnection()
and remove the call to XCloseDisplay().
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
Display *dpy;
int i, numScreens;
int a, b;
XineramaScreenInfo *screenInfo;
dpy = XOpenDisplay(NULL);
if (!dpy)
{
printf("Unable to open display\n");
exit(1);
}
if (XineramaQueryExtension(dpy, &a, &b))
{
screenInfo = XineramaQueryScreens(dpy, &numScreens);
for (i = 0; i < numScreens; i++)
printf("Screen %d: Origin: %d, %d Size: %d, %d\n",
screenInfo[i].screen_number,
screenInfo[i].x_org,
screenInfo[i].y_org,
screenInfo[i].width,
screenInfo[i].height);
XFree(screenInfo);
}
else
printf("Xinerama extension not present\n");
XCloseDisplay(dpy);
}
--"J"
This archive was generated by hypermail 2b29 : Thu Sep 08 2005 - 08:00:29 PDT