From 96433cdf19641121a40b567c00fb94df8974a1c0 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 13 Feb 2014 14:23:16 +0100 Subject: [PATCH] Fixed meaningless Win32 video mode restore. --- src/win32_monitor.c | 9 +++++++-- src/win32_platform.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/win32_monitor.c b/src/win32_monitor.c index ae452460..71ec12d4 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -81,6 +81,7 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) return GL_FALSE; } + monitor->win32.modeChanged = GL_TRUE; return GL_TRUE; } @@ -88,8 +89,12 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) // void _glfwRestoreVideoMode(_GLFWmonitor* monitor) { - ChangeDisplaySettingsEx(monitor->win32.name, - NULL, NULL, CDS_FULLSCREEN, NULL); + if (monitor->win32.modeChanged) + { + ChangeDisplaySettingsEx(monitor->win32.name, + NULL, NULL, CDS_FULLSCREEN, NULL); + monitor->win32.modeChanged = GL_FALSE; + } } diff --git a/src/win32_platform.h b/src/win32_platform.h index ce80e4d8..a265f050 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -234,6 +234,7 @@ typedef struct _GLFWmonitorWin32 { // This size matches the static size of DISPLAY_DEVICE.DeviceName WCHAR name[32]; + GLboolean modeChanged; } _GLFWmonitorWin32;