Fixed resize mode setting on Windows.

This commit is contained in:
Camilla Berglund 2013-03-12 17:25:33 +01:00
parent 71d2b574f8
commit 0356aa620d

View File

@ -929,37 +929,23 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{ {
GLboolean sizeChanged = GL_FALSE;
if (window->monitor) if (window->monitor)
{ {
GLFWvidmode mode; GLFWvidmode mode;
_glfwSetVideoMode(window->monitor, &window->videoMode);
_glfwPlatformGetVideoMode(window->monitor, &mode); _glfwPlatformGetVideoMode(window->monitor, &mode);
if (width > mode.width || height > mode.height) SetWindowPos(window->win32.handle, HWND_TOP,
{ 0, 0, mode.width, mode.height,
// The new video mode is larger than the current one, so we resize SWP_NOMOVE);
// the window before switch modes to avoid exposing whatever is
// underneath
SetWindowPos(window->win32.handle, HWND_TOP, 0, 0, width, height,
SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
sizeChanged = GL_TRUE;
}
// TODO: Change video mode
} }
else else
{ {
// If we are in windowed mode, adjust the window size to int fullWidth, fullHeight;
// compensate for window decorations getFullWindowSize(window, width, height, &fullWidth, &fullHeight);
getFullWindowSize(window, width, height, &width, &height);
}
// Set window size (if we haven't already) SetWindowPos(window->win32.handle, HWND_TOP,
if (!sizeChanged) 0, 0, fullWidth, fullHeight,
{
SetWindowPos(window->win32.handle, HWND_TOP, 0, 0, width, height,
SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER); SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
} }
} }