From 9040c64e5b6645b636406dc840f9d51fcb9d2cad Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 6 May 2015 23:52:39 +0200 Subject: [PATCH] Implemented GLFW_AUTO_ICONIFY on OS X. Fixes #506. --- README.md | 1 + src/cocoa_window.m | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 62f1bd30..1095e35b 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ GLFW bundles a number of dependencies in the `deps/` directory. - Bugfix: Initialization failed on headless systems - Bugfix: The cached current context could get out of sync - [Cocoa] Bugfix: The cached `NSScreen` for a monitor could get out of sync + - [Cocoa] Bugfix: The `GLFW_AUTO_ICONIFY` window hint was ignored ## Contact diff --git a/src/cocoa_window.m b/src/cocoa_window.m index d005ced2..42ba6811 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -212,7 +212,7 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) - (void)windowDidBecomeKey:(NSNotification *)notification { - if (window->monitor) + if (window->monitor && window->autoIconify) enterFullscreenMode(window); if (_glfw.focusedWindow == window && @@ -227,7 +227,7 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) - (void)windowDidResignKey:(NSNotification *)notification { - if (window->monitor) + if (window->monitor && window->autoIconify) leaveFullscreenMode(window); _glfwInputWindowFocus(window, GL_FALSE); @@ -882,7 +882,9 @@ static GLboolean createWindow(_GLFWwindow* window, if (wndconfig->monitor) { [window->ns.object setLevel:NSMainMenuWindowLevel + 1]; - [window->ns.object setHidesOnDeactivate:YES]; + + if (window->autoIconify) + [window->ns.object setHidesOnDeactivate:YES]; } else {