From 261f290abff79181ecc8c1e19e3562fbb521270e Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 6 Aug 2013 19:51:29 +0200 Subject: [PATCH] Fixed original video mode being overwritten. --- README.md | 2 ++ src/x11_monitor.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2dc5e72..71bab41b 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/). race condition - [X11] Bugfix: The reported window position did not account for the size of the window frame on some WMs + - [X11] Bugfix: The original video mode of a monitor was overwritten by calls + to glfwSetWindowSize ## Contact diff --git a/src/x11_monitor.c b/src/x11_monitor.c index f6564479..de3287cd 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -111,7 +111,8 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) } } - monitor->x11.oldMode = ci->mode; + if (monitor->x11.oldMode == None) + monitor->x11.oldMode = ci->mode; XRRSetCrtcConfig(_glfw.x11.display, sr, monitor->x11.crtc, @@ -137,6 +138,9 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor) XRRScreenResources* sr; XRRCrtcInfo* ci; + if (monitor->x11.oldMode == None) + return; + sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); @@ -151,6 +155,8 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor) XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); + + monitor->x11.oldMode = None; } }