diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md index 38650e80d..587863045 100644 --- a/src/changelog/unreleased.md +++ b/src/changelog/unreleased.md @@ -47,3 +47,4 @@ changelog entry. ### Fixed - On Windows, fixed ~500 ms pause when clicking the title bar during continuous redraw. +- On macos, `WindowExtMacOS::set_simple_fullscreen` now honors `WindowExtMacOS::set_borderless_game` diff --git a/src/platform/macos.rs b/src/platform/macos.rs index 424c9d621..7d4b8ca34 100644 --- a/src/platform/macos.rs +++ b/src/platform/macos.rs @@ -95,7 +95,9 @@ pub trait WindowExtMacOS { /// Getter for the [`WindowExtMacOS::set_option_as_alt`]. fn option_as_alt(&self) -> OptionAsAlt; - /// Disable the Menu Bar and Dock in Borderless Fullscreen mode. Useful for games. + /// Disable the Menu Bar and Dock in Simple or Borderless Fullscreen mode. Useful for games. + /// The effect is applied when [`WindowExtMacOS::set_simple_fullscreen`] or + /// [`Window::set_fullscreen`] is called. fn set_borderless_game(&self, borderless_game: bool); /// Getter for the [`WindowExtMacOS::set_borderless_game`]. diff --git a/src/platform_impl/macos/window_delegate.rs b/src/platform_impl/macos/window_delegate.rs index 19dc605e0..8982d4088 100644 --- a/src/platform_impl/macos/window_delegate.rs +++ b/src/platform_impl/macos/window_delegate.rs @@ -1746,9 +1746,13 @@ impl WindowExtMacOS for WindowDelegate { self.ivars().is_simple_fullscreen.set(true); // Simulate pre-Lion fullscreen by hiding the dock and menu bar - let presentation_options = + let presentation_options = if self.is_borderless_game() { + NSApplicationPresentationOptions::NSApplicationPresentationHideDock + | NSApplicationPresentationOptions::NSApplicationPresentationHideMenuBar + } else { NSApplicationPresentationOptions::NSApplicationPresentationAutoHideDock - | NSApplicationPresentationOptions::NSApplicationPresentationAutoHideMenuBar; + | NSApplicationPresentationOptions::NSApplicationPresentationAutoHideMenuBar + }; app.setPresentationOptions(presentation_options); // Hide the titlebar @@ -1762,11 +1766,8 @@ impl WindowExtMacOS for WindowDelegate { self.toggle_style_mask(NSWindowStyleMask::Miniaturizable, false); self.toggle_style_mask(NSWindowStyleMask::Resizable, false); self.window().setMovable(false); - - true } else { let new_mask = self.saved_style(); - self.set_style_mask(new_mask); self.ivars().is_simple_fullscreen.set(false); let save_presentation_opts = self.ivars().save_presentation_opts.get(); @@ -1778,9 +1779,10 @@ impl WindowExtMacOS for WindowDelegate { self.window().setFrame_display(frame, true); self.window().setMovable(true); - - true + self.set_style_mask(new_mask); } + + true } #[inline]