Fix MacOS menu bar & dock stop appearing after closing sub-window

When the progress dialog task for saving a scene ends, or when closing the "Open project" dialog, the DisplayServerMacOS::update_presentation_mode() method now restores those fullscreen functionalities with the flags NSApplicationPresentationAutoHideMenuBar and NSApplicationPresentationAutoHideDock, whereas before it would reset to NSApplicationPresentationDefault, which didn't allow that.

Fixes #86495
This commit is contained in:
Rodrigo Dias 2024-04-01 21:57:58 +01:00
parent 29b3d9e9e5
commit a4f2e5210f

View file

@ -2084,12 +2084,21 @@ Size2i DisplayServerMacOS::window_get_max_size(WindowID p_window) const {
} }
void DisplayServerMacOS::update_presentation_mode() { void DisplayServerMacOS::update_presentation_mode() {
bool has_fs_windows = false;
for (const KeyValue<WindowID, WindowData> &wd : windows) { for (const KeyValue<WindowID, WindowData> &wd : windows) {
if (wd.value.fullscreen && wd.value.exclusive_fullscreen) { if (wd.value.fullscreen) {
return; if (wd.value.exclusive_fullscreen) {
return;
} else {
has_fs_windows = true;
}
} }
} }
[NSApp setPresentationOptions:NSApplicationPresentationDefault]; if (has_fs_windows) {
[NSApp setPresentationOptions:NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock | NSApplicationPresentationFullScreen];
} else {
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
}
} }
void DisplayServerMacOS::window_set_min_size(const Size2i p_size, WindowID p_window) { void DisplayServerMacOS::window_set_min_size(const Size2i p_size, WindowID p_window) {