看起来好像有一个libXinerama
API可以检索该信息。我还没有找到任何详细的信息。
可以在此处找到X.org常规编程信息(PDF文件)。
libXinerama可以在此处找到有关提供的功能的信息(联机帮助页的联机帮助,其中没有很多信息)。
这是一个小型的C ++程序,我从这些参考中提取了出来,以检索连接到Xinerama的每个显示器的尺寸和偏移。它也适用于nVidia
TwinView。我目前没有ATI卡在其BigDesktop系统上进行测试,但我怀疑它也可以在其上运行。
#include <cstdlib>#include <iostream>#include <X11/extensions/Xinerama.h>using std::cout;using std::endl;int main(int argc, char *argv[]) { bool success=false; Display *d=XOpenDisplay(NULL); if (d) { int dummy1, dummy2; if (XineramaQueryExtension(d, &dummy1, &dummy2)) { if (XineramaIsActive(d)) { int heads=0; XineramaScreenInfo *p=XineramaQueryScreens(d, &heads); if (heads>0) { for (int x=0; x<heads; ++x) cout << "Head " << x+1 << " of " << heads << ": " << p[x].width << "x" << p[x].height << " at " << p[x].x_org << "," << p[x].y_org << endl; success=true; } else cout << "XineramaQueryScreens says there aren't any" << endl; XFree(p); } else cout << "Xinerama not active" << endl; } else cout << "No Xinerama extension" << endl; XCloseDisplay(d); } else cout << "Can't open display" << endl; return (success ? EXIT_SUCCESS : EXIT_FAILURE);}


