From 8f80ec6dda4a10a580705dae88793327b29d4f0e Mon Sep 17 00:00:00 2001 From: IntellectualKitty Date: Tue, 27 Dec 2016 21:38:12 -0700 Subject: [PATCH] Command-tabbing fix for issue #848 --- README.md | 1 + src/cocoa_window.m | 52 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ba95d99a..9c3796aef 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: Disabled use of deprecated `CGDisplayModeCopyPixelEncoding` function on macOS 10.12+ - [Cocoa] Bugfix: Running in AppSandbox would emit warnings (#816,#882) +- [Cocoa] Bugfix: Command-tabbing issues with fullscreen windows (#848) - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index a8bccc881..48e8abdcd 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1248,7 +1248,25 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window) void _glfwPlatformShowWindow(_GLFWwindow* window) { - [window->ns.object orderFront:nil]; + if (window->monitor) + { + [window->ns.object makeKeyAndOrderFront:nil]; + + NSApplicationPresentationOptions options = + NSApplicationPresentationHideDock + + NSApplicationPresentationHideMenuBar + + NSApplicationPresentationDisableProcessSwitching + + NSApplicationPresentationDisableHideApplication; + [NSApp setPresentationOptions:options]; + } + else + { + [window->ns.object orderFront:nil]; + + NSApplicationPresentationOptions options = + NSApplicationPresentationDefault; + [NSApp setPresentationOptions:options]; + } } void _glfwPlatformHideWindow(_GLFWwindow* window) @@ -1265,6 +1283,22 @@ void _glfwPlatformFocusWindow(_GLFWwindow* window) [NSApp activateIgnoringOtherApps:YES]; [window->ns.object makeKeyAndOrderFront:nil]; + + if (window->monitor) + { + NSApplicationPresentationOptions options = + NSApplicationPresentationHideDock + + NSApplicationPresentationHideMenuBar + + NSApplicationPresentationDisableProcessSwitching + + NSApplicationPresentationDisableHideApplication; + [NSApp setPresentationOptions:options]; + } + else + { + NSApplicationPresentationOptions options = + NSApplicationPresentationDefault; + [NSApp setPresentationOptions:options]; + } } void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, @@ -1362,6 +1396,22 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, [window->ns.object setHasShadow:YES]; } + + if (window->monitor) + { + NSApplicationPresentationOptions options = + NSApplicationPresentationHideDock + + NSApplicationPresentationHideMenuBar + + NSApplicationPresentationDisableProcessSwitching + + NSApplicationPresentationDisableHideApplication; + [NSApp setPresentationOptions:options]; + } + else + { + NSApplicationPresentationOptions options = + NSApplicationPresentationDefault; + [NSApp setPresentationOptions:options]; + } } int _glfwPlatformWindowFocused(_GLFWwindow* window)