Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Check all exclusive fullscreen windows before setting presentation mode. #82423

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platform/macos/display_server_macos.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class DisplayServerMacOS : public DisplayServer {
WindowID _get_focused_window_or_popup() const;
void mouse_enter_window(WindowID p_window);
void mouse_exit_window(WindowID p_window);
void update_presentation_mode();

void window_destroy(WindowID p_window);
void window_resize(WindowID p_window, int p_width, int p_height);
Expand Down
12 changes: 11 additions & 1 deletion platform/macos/display_server_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@
}
#endif
windows.erase(p_window);
update_presentation_mode();
}

void DisplayServerMacOS::window_resize(WindowID p_window, int p_width, int p_height) {
Expand Down Expand Up @@ -2868,6 +2869,15 @@
return wd.max_size;
}

void DisplayServerMacOS::update_presentation_mode() {
for (const KeyValue<WindowID, WindowData> &wd : windows) {
if (wd.value.fullscreen && wd.value.exclusive_fullscreen) {
return;
}
}
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
}

void DisplayServerMacOS::window_set_min_size(const Size2i p_size, WindowID p_window) {
_THREAD_SAFE_METHOD_

Expand Down Expand Up @@ -2978,7 +2988,7 @@
[wd.window_object toggleFullScreen:nil];

if (old_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN) {
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
update_presentation_mode();
}

wd.fullscreen = false;
Expand Down
2 changes: 1 addition & 1 deletion platform/macos/godot_window_delegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification {

DisplayServerMacOS::WindowData &wd = ds->get_window(window_id);
if (wd.exclusive_fullscreen) {
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
ds->update_presentation_mode();
}

wd.fullscreen = false;
Expand Down
Loading