From 648655aa5ba5875bc27f4ea1ed5127d5d8a502f6 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sat, 22 Dec 2012 23:35:45 +0100 Subject: [PATCH] Fixed RandR primary monitor detection. --- src/x11_monitor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/x11_monitor.c b/src/x11_monitor.c index e9e0a88f..73e9d80c 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -331,11 +331,15 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) { #if defined (_GLFW_HAS_XRANDR) int i; + RROutput primary; XRRScreenResources* sr; sr = XRRGetScreenResources(_glfwLibrary.X11.display, _glfwLibrary.X11.root); + primary = XRRGetOutputPrimary(_glfwLibrary.X11.display, + _glfwLibrary.X11.root); + monitors = (_GLFWmonitor**) calloc(sr->noutput, sizeof(_GLFWmonitor*)); if (!monitors) { @@ -374,7 +378,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) ci = XRRGetCrtcInfo(_glfwLibrary.X11.display, sr, oi->crtc); monitors[found] = _glfwCreateMonitor(oi->name, - i == 0, + sr->outputs[i] == primary, physicalWidth, physicalHeight, ci->x, ci->y);