Xorg启动并创建一个虚拟屏幕。
虚拟屏幕大小确定为3120 x 1050。
该虚拟屏幕跨越了我的两个物理屏幕,分辨率分别为1680x1050和1440x900,我猜测是使用了xinerama。
没有配置文件,我也不想更改系统设置。
我的应用程序使用DisplayWidth和DisplayHeight来获取屏幕尺寸,在单屏设置下很好用。
maxwidth = DisplayWidth (dpy, scrnum);
maxheight = DisplayHeight (dpy, scrnum);
但是在双屏幕设置中,会自动创建一个虚拟屏幕,这些函数将返回虚拟屏幕的大小。我尝试了不同的方法来获取物理屏幕大小,但结果都一样。
maxwidth = XWidthOfScreen (XScreenOfDisplay(dpy, scrnum));
maxheight = XHeightOfScreen (XScreenOfDisplay(dpy, scrnum));
或者
XWindowAttributes attr;
XGetWindowAttributes(dpy, RootWindow(dpy, scrnum), &attr);
maxwidth = attr.width;
maxheight = attr.height;
只使用Xlib,能否检索到物理屏幕的尺寸?我想避免添加更多的库依赖项来设置窗口的大小,但也许可以使用Xrand扩展来实现这一点?