Fix glfwIconifyWindow not restoring video mode

Fixes #590.
This commit is contained in:
Camilla Berglund 2015-08-28 12:00:06 +02:00
parent 6123937bde
commit 67eadf1e97
4 changed files with 25 additions and 19 deletions

View File

@ -71,6 +71,8 @@ GLFW bundles a number of dependencies in the `deps/` directory.
- Removed all mention of GLU in examples, build files and package dependencies - Removed all mention of GLU in examples, build files and package dependencies
- Bugfix: Initialization failed on headless systems - Bugfix: Initialization failed on headless systems
- Bugfix: The cached current context could get out of sync - Bugfix: The cached current context could get out of sync
- Bugfix: `glfwIconifyWindow` did not restore the original video mode for full
screen windows created with `GLFW_AUTO_ICONIFY`
- [Win32] Renamed hybrid GPU override compile-time option to - [Win32] Renamed hybrid GPU override compile-time option to
`_GLFW_USE_HYBRID_HPG` and added support for AMD PowerXpress systems `_GLFW_USE_HYBRID_HPG` and added support for AMD PowerXpress systems
- [Win32] Bugfix: `glfwGetVideoModes` included unusable modes on some systems - [Win32] Bugfix: `glfwGetVideoModes` included unusable modes on some systems

View File

@ -234,19 +234,22 @@ static int translateKey(unsigned int key)
- (void)windowDidMiniaturize:(NSNotification *)notification - (void)windowDidMiniaturize:(NSNotification *)notification
{ {
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GL_TRUE); _glfwInputWindowIconify(window, GL_TRUE);
} }
- (void)windowDidDeminiaturize:(NSNotification *)notification - (void)windowDidDeminiaturize:(NSNotification *)notification
{ {
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GL_FALSE); _glfwInputWindowIconify(window, GL_FALSE);
} }
- (void)windowDidBecomeKey:(NSNotification *)notification - (void)windowDidBecomeKey:(NSNotification *)notification
{ {
if (window->monitor && window->autoIconify)
enterFullscreenMode(window);
if (_glfw.cursorWindow == window && if (_glfw.cursorWindow == window &&
window->cursorMode == GLFW_CURSOR_DISABLED) window->cursorMode == GLFW_CURSOR_DISABLED)
{ {
@ -260,7 +263,7 @@ static int translateKey(unsigned int key)
- (void)windowDidResignKey:(NSNotification *)notification - (void)windowDidResignKey:(NSNotification *)notification
{ {
if (window->monitor && window->autoIconify) if (window->monitor && window->autoIconify)
leaveFullscreenMode(window); _glfwPlatformIconifyWindow(window);
_glfwInputWindowFocus(window, GL_FALSE); _glfwInputWindowFocus(window, GL_FALSE);
} }
@ -885,9 +888,6 @@ static GLboolean createWindow(_GLFWwindow* window,
if (wndconfig->monitor) if (wndconfig->monitor)
{ {
[window->ns.object setLevel:NSMainMenuWindowLevel + 1]; [window->ns.object setLevel:NSMainMenuWindowLevel + 1];
if (window->autoIconify)
[window->ns.object setHidesOnDeactivate:YES];
} }
else else
{ {

View File

@ -280,9 +280,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->cursorMode != GLFW_CURSOR_NORMAL) if (window->cursorMode != GLFW_CURSOR_NORMAL)
_glfwPlatformApplyCursorMode(window); _glfwPlatformApplyCursorMode(window);
if (window->monitor && window->autoIconify)
enterFullscreenMode(window);
_glfwInputWindowFocus(window, GL_TRUE); _glfwInputWindowFocus(window, GL_TRUE);
return 0; return 0;
} }
@ -293,10 +290,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
restoreCursor(window); restoreCursor(window);
if (window->monitor && window->autoIconify) if (window->monitor && window->autoIconify)
{
_glfwPlatformIconifyWindow(window); _glfwPlatformIconifyWindow(window);
leaveFullscreenMode(window);
}
_glfwInputWindowFocus(window, GL_FALSE); _glfwInputWindowFocus(window, GL_FALSE);
return 0; return 0;
@ -523,12 +517,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (!window->win32.iconified && wParam == SIZE_MINIMIZED) if (!window->win32.iconified && wParam == SIZE_MINIMIZED)
{ {
window->win32.iconified = GL_TRUE; window->win32.iconified = GL_TRUE;
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GL_TRUE); _glfwInputWindowIconify(window, GL_TRUE);
} }
else if (window->win32.iconified && else if (window->win32.iconified &&
(wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)) (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED))
{ {
window->win32.iconified = GL_FALSE; window->win32.iconified = GL_FALSE;
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GL_FALSE); _glfwInputWindowIconify(window, GL_FALSE);
} }

View File

@ -1256,9 +1256,6 @@ static void processEvent(XEvent *event)
if (window->cursorMode == GLFW_CURSOR_DISABLED) if (window->cursorMode == GLFW_CURSOR_DISABLED)
disableCursor(window); disableCursor(window);
if (window->monitor && window->autoIconify)
enterFullscreenMode(window);
_glfwInputWindowFocus(window, GL_TRUE); _glfwInputWindowFocus(window, GL_TRUE);
return; return;
} }
@ -1280,10 +1277,7 @@ static void processEvent(XEvent *event)
restoreCursor(window); restoreCursor(window);
if (window->monitor && window->autoIconify) if (window->monitor && window->autoIconify)
{
_glfwPlatformIconifyWindow(window); _glfwPlatformIconifyWindow(window);
leaveFullscreenMode(window);
}
_glfwInputWindowFocus(window, GL_FALSE); _glfwInputWindowFocus(window, GL_FALSE);
return; return;
@ -1302,10 +1296,20 @@ static void processEvent(XEvent *event)
{ {
const int state = getWindowState(window); const int state = getWindowState(window);
if (state == IconicState) if (state == IconicState)
{
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GL_TRUE); _glfwInputWindowIconify(window, GL_TRUE);
}
else if (state == NormalState) else if (state == NormalState)
{
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GL_FALSE); _glfwInputWindowIconify(window, GL_FALSE);
} }
}
return; return;
} }