Fixed window parameter refresh.

This commit is contained in:
Camilla Berglund 2012-08-03 15:21:49 +02:00
parent 3c912cbc3c
commit 1736132bb2
5 changed files with 10 additions and 12 deletions

View File

@ -1041,7 +1041,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
// Write back window parameters into GLFW window structure // Write back window parameters into GLFW window structure
//======================================================================== //========================================================================
void _glfwPlatformRefreshWindowParams(void) void _glfwPlatformRefreshWindowParams(_GLFWwindow* window)
{ {
} }

View File

@ -326,7 +326,7 @@ void _glfwPlatformWaitEvents(void);
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window); void _glfwPlatformMakeContextCurrent(_GLFWwindow* window);
void _glfwPlatformSwapBuffers(void); void _glfwPlatformSwapBuffers(void);
void _glfwPlatformSwapInterval(int interval); void _glfwPlatformSwapInterval(int interval);
void _glfwPlatformRefreshWindowParams(void); void _glfwPlatformRefreshWindowParams(_GLFWwindow* window);
int _glfwPlatformExtensionSupported(const char* extension); int _glfwPlatformExtensionSupported(const char* extension);
GLFWglproc _glfwPlatformGetProcAddress(const char* procname); GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask); void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask);

View File

@ -1198,10 +1198,9 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
// Write back window parameters into GLFW window structure // Write back window parameters into GLFW window structure
//======================================================================== //========================================================================
void _glfwPlatformRefreshWindowParams(void) void _glfwPlatformRefreshWindowParams(_GLFWwindow* window)
{ {
DEVMODE dm; DEVMODE dm;
_GLFWwindow* window = _glfwLibrary.currentWindow;
ZeroMemory(&dm, sizeof(DEVMODE)); ZeroMemory(&dm, sizeof(DEVMODE));
dm.dmSize = sizeof(DEVMODE); dm.dmSize = sizeof(DEVMODE);

View File

@ -318,17 +318,18 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
return GL_FALSE; return GL_FALSE;
} }
// Cache the actual (as opposed to desired) window parameters // Cache the actual (as opposed to requested) window parameters
_glfwPlatformRefreshWindowParams(); _glfwPlatformRefreshWindowParams(window);
// Cache the actual (as opposed to requested) context parameters
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
if (!_glfwRefreshContextParams()) if (!_glfwRefreshContextParams())
{ {
glfwCloseWindow(window); glfwCloseWindow(window);
return GL_FALSE; return GL_FALSE;
} }
// Verify the context against the requested parameters
if (!_glfwIsValidContext(&wndconfig)) if (!_glfwIsValidContext(&wndconfig))
{ {
glfwCloseWindow(window); 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 // Refresh window parameters (may have changed due to changed video
// modes) // modes)
_glfwPlatformRefreshWindowParams(); _glfwPlatformRefreshWindowParams(window);
} }
} }
@ -665,7 +666,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
_glfwPlatformRestoreWindow(window); _glfwPlatformRestoreWindow(window);
if (window->mode == GLFW_FULLSCREEN) if (window->mode == GLFW_FULLSCREEN)
_glfwPlatformRefreshWindowParams(); _glfwPlatformRefreshWindowParams(window);
} }

View File

@ -1137,10 +1137,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
// Read back framebuffer parameters from the context // Read back framebuffer parameters from the context
//======================================================================== //========================================================================
void _glfwPlatformRefreshWindowParams(void) void _glfwPlatformRefreshWindowParams(_GLFWwindow* window)
{ {
_GLFWwindow* window = _glfwLibrary.currentWindow;
// Retrieve refresh rate if possible // Retrieve refresh rate if possible
if (_glfwLibrary.X11.RandR.available) if (_glfwLibrary.X11.RandR.available)
{ {