From 1736132bb2a4bdae9b64f8ff9d19bef61543723e Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 3 Aug 2012 15:21:49 +0200 Subject: [PATCH] Fixed window parameter refresh. --- src/cocoa_window.m | 2 +- src/internal.h | 2 +- src/win32_window.c | 3 +-- src/window.c | 11 ++++++----- src/x11_window.c | 4 +--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 74f187b0..2f6b851c 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1041,7 +1041,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) // Write back window parameters into GLFW window structure //======================================================================== -void _glfwPlatformRefreshWindowParams(void) +void _glfwPlatformRefreshWindowParams(_GLFWwindow* window) { } diff --git a/src/internal.h b/src/internal.h index 99d74b86..81eb26c6 100644 --- a/src/internal.h +++ b/src/internal.h @@ -326,7 +326,7 @@ void _glfwPlatformWaitEvents(void); void _glfwPlatformMakeContextCurrent(_GLFWwindow* window); void _glfwPlatformSwapBuffers(void); void _glfwPlatformSwapInterval(int interval); -void _glfwPlatformRefreshWindowParams(void); +void _glfwPlatformRefreshWindowParams(_GLFWwindow* window); int _glfwPlatformExtensionSupported(const char* extension); GLFWglproc _glfwPlatformGetProcAddress(const char* procname); void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask); diff --git a/src/win32_window.c b/src/win32_window.c index fff50ea2..aced1511 100755 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1198,10 +1198,9 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) // Write back window parameters into GLFW window structure //======================================================================== -void _glfwPlatformRefreshWindowParams(void) +void _glfwPlatformRefreshWindowParams(_GLFWwindow* window) { DEVMODE dm; - _GLFWwindow* window = _glfwLibrary.currentWindow; ZeroMemory(&dm, sizeof(DEVMODE)); dm.dmSize = sizeof(DEVMODE); diff --git a/src/window.c b/src/window.c index 2e77fa15..27237329 100644 --- a/src/window.c +++ b/src/window.c @@ -318,17 +318,18 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, return GL_FALSE; } - // Cache the actual (as opposed to desired) window parameters - _glfwPlatformRefreshWindowParams(); + // Cache the actual (as opposed to requested) window parameters + _glfwPlatformRefreshWindowParams(window); + // Cache the actual (as opposed to requested) context parameters glfwMakeContextCurrent(window); - if (!_glfwRefreshContextParams()) { glfwCloseWindow(window); return GL_FALSE; } + // Verify the context against the requested parameters if (!_glfwIsValidContext(&wndconfig)) { glfwCloseWindow(window); @@ -573,7 +574,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height) { // Refresh window parameters (may have changed due to changed video // modes) - _glfwPlatformRefreshWindowParams(); + _glfwPlatformRefreshWindowParams(window); } } @@ -665,7 +666,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle) _glfwPlatformRestoreWindow(window); if (window->mode == GLFW_FULLSCREEN) - _glfwPlatformRefreshWindowParams(); + _glfwPlatformRefreshWindowParams(window); } diff --git a/src/x11_window.c b/src/x11_window.c index e5c548de..656c3735 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1137,10 +1137,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) // Read back framebuffer parameters from the context //======================================================================== -void _glfwPlatformRefreshWindowParams(void) +void _glfwPlatformRefreshWindowParams(_GLFWwindow* window) { - _GLFWwindow* window = _glfwLibrary.currentWindow; - // Retrieve refresh rate if possible if (_glfwLibrary.X11.RandR.available) {