From bb338a2b9cea40d5685605e63baf112ae62ed8e3 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 8 Jan 2015 03:56:12 +0100 Subject: [PATCH] Fixed monitor size not corrected for rotation. Fixes #413. --- README.md | 3 ++- src/x11_monitor.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c7904c19..8066c6cf 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,8 @@ GLFW bundles a number of dependencies in the `deps/` directory. - [X11] Bugfix: Window frame interactions were reported as focus events - [X11] Bugfix: Workaround for legacy Compiz caused flickering during resize - [X11] Bugfix: The name pointer of joysticks were not cleared on disconnection - - [X11] Bugfix: Video mode dimensions were not rotated to match the CRTC + - [X11] Bugfix: Video mode resolutions and monitor physical sizes were not + corrected for rotated CRTCs - [X11] Bugfix: Unicode character input ignored dead keys - [X11] Bugfix: X-axis scroll offsets were inverted - [X11] Bugfix: Full screen override redirect windows were not always diff --git a/src/x11_monitor.c b/src/x11_monitor.c index fb6b0ef6..6265070f 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -224,6 +224,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) for (j = 0; j < ci->noutput; j++) { + int widthMM, heightMM; XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, ci->outputs[j]); if (oi->connection != RR_Connected) @@ -238,10 +239,18 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) monitors = realloc(monitors, sizeof(_GLFWmonitor*) * size); } - monitors[found] = _glfwAllocMonitor(oi->name, - oi->mm_width, - oi->mm_height); + if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270) + { + widthMM = oi->mm_height; + heightMM = oi->mm_width; + } + else + { + widthMM = oi->mm_width; + heightMM = oi->mm_height; + } + monitors[found] = _glfwAllocMonitor(oi->name, widthMM, heightMM); monitors[found]->x11.output = ci->outputs[j]; monitors[found]->x11.crtc = oi->crtc;