瀏覽代碼

Merge pull request #68260 from bruvzg/macos_ex_fs3

[macOS, 3.x] Disable Dock and Menu in fullscreen mode.
Rémi Verschelde 2 年之前
父節點
當前提交
de16367404
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      platform/osx/os_osx.mm

+ 8 - 0
platform/osx/os_osx.mm

@@ -329,6 +329,8 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) {
 	if (OS_OSX::singleton->on_top)
 	if (OS_OSX::singleton->on_top)
 		[OS_OSX::singleton->window_object setLevel:NSFloatingWindowLevel];
 		[OS_OSX::singleton->window_object setLevel:NSFloatingWindowLevel];
 
 
+	[NSApp setPresentationOptions:NSApplicationPresentationDefault];
+
 	// Force window resize event.
 	// Force window resize event.
 	[self windowDidResize:notification];
 	[self windowDidResize:notification];
 }
 }
@@ -2884,6 +2886,12 @@ void OS_OSX::set_window_fullscreen(bool p_enabled) {
 				[window_object setContentMaxSize:NSMakeSize(size.x, size.y)];
 				[window_object setContentMaxSize:NSMakeSize(size.x, size.y)];
 			}
 			}
 		}
 		}
+		if (p_enabled) {
+			const NSUInteger presentationOptions = NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
+			[NSApp setPresentationOptions:presentationOptions];
+		} else {
+			[NSApp setPresentationOptions:NSApplicationPresentationDefault];
+		}
 		[window_object toggleFullScreen:nil];
 		[window_object toggleFullScreen:nil];
 	}
 	}
 	zoomed = p_enabled;
 	zoomed = p_enabled;