vcl/osx/salframeview.mm | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
New commits: commit 0e0f3ed6352cb91ccd2f5d74c97f59fe42838f41 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Sun Apr 20 11:31:36 2025 -0400 Commit: Patrick Luby <guibomac...@gmail.com> CommitDate: Sun Apr 20 20:21:22 2025 +0200 Explicitly pass native NSWindow to updateWindowCollectionBehavior() updateWindowCollectionBehavior() needs to be called during creation of a SalFrameWindow. However, the NSWindow has not yet been assigned to the AquaSalFrame's mpNSWindow instance variable yet. Change-Id: I7be538cba11c4eb3e4ae0f47e6842ead1a98cf4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184389 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomac...@gmail.com> diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 969a09771db3..c4afc0eced21 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -310,29 +310,24 @@ static void updateMenuBarVisibility( const AquaSalFrame *pFrame ) } } -static void updateWindowCollectionBehavior( const AquaSalFrame *pFrame ) +static void updateWindowCollectionBehavior( const SalFrameStyleFlags nStyle, const AquaSalFrame *pParent, NSWindow *pNSWindow ) { - if( !pFrame ) + if( !pNSWindow ) return; // Enable fullscreen options if available and useful - NSWindowCollectionBehavior bOldCollectionBehavor = [pFrame->mpNSWindow collectionBehavior]; - NSWindowCollectionBehavior bCollectionBehavor = NSWindowCollectionBehaviorFullScreenNone; + NSWindowCollectionBehavior eOldCollectionBehavior = [pNSWindow collectionBehavior]; + NSWindowCollectionBehavior eCollectionBehavior = NSWindowCollectionBehaviorFullScreenNone; if ( officecfg::Office::Common::VCL::macOS::EnableNativeFullScreenWindows::get() ) { - bool bAllowFullScreen = (SalFrameStyleFlags::NONE == (pFrame->mnStyle & (SalFrameStyleFlags::DIALOG | SalFrameStyleFlags::TOOLTIP | SalFrameStyleFlags::SYSTEMCHILD | SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLWINDOW | SalFrameStyleFlags::INTRO))); - bAllowFullScreen &= (SalFrameStyleFlags::NONE == (~pFrame->mnStyle & SalFrameStyleFlags::SIZEABLE)); - bAllowFullScreen &= (pFrame->mpParent == nullptr); + bool bAllowFullScreen = (SalFrameStyleFlags::NONE == (nStyle & (SalFrameStyleFlags::DIALOG | SalFrameStyleFlags::TOOLTIP | SalFrameStyleFlags::SYSTEMCHILD | SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLWINDOW | SalFrameStyleFlags::INTRO))); + bAllowFullScreen &= (SalFrameStyleFlags::NONE == (~nStyle & SalFrameStyleFlags::SIZEABLE)); + bAllowFullScreen &= (pParent == nullptr); - bCollectionBehavor = bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary; + eCollectionBehavior = bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary; } - else - { - bCollectionBehavor = NSWindowCollectionBehaviorFullScreenNone; - } - - if ( bCollectionBehavor != bOldCollectionBehavor ) - [pFrame->mpNSWindow setCollectionBehavior: bCollectionBehavor]; + if ( eCollectionBehavior != eOldCollectionBehavior ) + [pNSWindow setCollectionBehavior: eCollectionBehavior]; } @interface NSResponder (SalFrameWindow) @@ -357,7 +352,7 @@ static void updateWindowCollectionBehavior( const AquaSalFrame *pFrame ) backing: NSBackingStoreBuffered defer: Application::IsHeadlessModeEnabled()]; - updateWindowCollectionBehavior( mpFrame ); + updateWindowCollectionBehavior( mpFrame->mnStyle, mpFrame->mpParent, pNSWindow ); [pNSWindow setReleasedWhenClosed: NO]; @@ -444,7 +439,7 @@ static void updateWindowCollectionBehavior( const AquaSalFrame *pFrame ) if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { - updateWindowCollectionBehavior( mpFrame ); + updateWindowCollectionBehavior( mpFrame->mnStyle, mpFrame->mpParent, mpFrame->mpNSWindow); static const SalFrameStyleFlags nGuessDocument = SalFrameStyleFlags::MOVEABLE| SalFrameStyleFlags::SIZEABLE|