mirror of
https://github.com/glfw/glfw.git
synced 2026-09-23 00:59:48 +00:00
Added support for _NET_WM_FULLSCREEN_MONITORS.
This allows EWMH full screen windows to correctly cover monitors that overlap other monitors, such as an Oculus Rift mapped onto a section of a larger monitor. Fixes #175.
This commit is contained in:
+21
-1
@@ -200,18 +200,23 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||
|
||||
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
{
|
||||
int i, j, size = 0, found = 0;
|
||||
int i, j, k, size = 0, found = 0;
|
||||
_GLFWmonitor** monitors = NULL;
|
||||
|
||||
*count = 0;
|
||||
|
||||
if (_glfw.x11.randr.available)
|
||||
{
|
||||
int screenCount = 0;
|
||||
XineramaScreenInfo* screens = NULL;
|
||||
XRRScreenResources* sr = XRRGetScreenResources(_glfw.x11.display,
|
||||
_glfw.x11.root);
|
||||
RROutput primary = XRRGetOutputPrimary(_glfw.x11.display,
|
||||
_glfw.x11.root);
|
||||
|
||||
if (_glfw.x11.xinerama.available)
|
||||
screens = XineramaQueryScreens(_glfw.x11.display, &screenCount);
|
||||
|
||||
for (i = 0; i < sr->ncrtc; i++)
|
||||
{
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display,
|
||||
@@ -240,6 +245,18 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
monitors[found]->x11.output = ci->outputs[j];
|
||||
monitors[found]->x11.crtc = oi->crtc;
|
||||
|
||||
for (k = 0; k < screenCount; k++)
|
||||
{
|
||||
if (screens[k].x_org == ci->x &&
|
||||
screens[k].y_org == ci->y &&
|
||||
screens[k].width == ci->width &&
|
||||
screens[k].height == ci->height)
|
||||
{
|
||||
monitors[found]->x11.index = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XRRFreeOutputInfo(oi);
|
||||
|
||||
if (ci->outputs[j] == primary)
|
||||
@@ -253,6 +270,9 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
|
||||
XRRFreeScreenResources(sr);
|
||||
|
||||
if (screens)
|
||||
XFree(screens);
|
||||
|
||||
if (found == 0)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
|
||||
Reference in New Issue
Block a user