vcl/osx/salframeview.mm |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit f20681176eb6abab6438f6722439a139fe07a963
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Sat Mar 29 19:50:22 2025 -0400
Commit:     Patrick Luby <guibomac...@gmail.com>
CommitDate: Sun Mar 30 03:05:07 2025 +0200

    Related: tdf#161623 disable menubar visibility if no key window
    
    If a window is in LibreOffice's internal full screen mode
    and not in native full screen mode and then the user switches
    to a different application and back using the Command-Tab keys.
    the menubar and Dock would unexpectedly appear.
    
    It appears that the key window will still be nil in this
    case, so only enable menubar visibility if the key window
    is not nil.
    
    Change-Id: I1ad9aefe8183908044042efc2ec67df3bae252dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183498
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index e43ff781f310..6411714f182a 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -289,10 +289,19 @@ static void updateMenuBarVisibility( const AquaSalFrame 
*pFrame )
             const NSWindow *pParentWindow = [NSApp keyWindow];
             while( pParentWindow && pParentWindow != pFrame->getNSWindow() )
                 pParentWindow = [pParentWindow parentWindow];
-            if( pParentWindow == pFrame->getNSWindow() )
-                [NSMenu setMenuBarVisible: NO];
-            else
+
+            // Related: tdf#161623 disable menubar visibility if no key window
+            // If a window is in LibreOffice's internal full screen mode
+            // and not in native full screen mode and then the user switches
+            // to a different application and back using the Command-Tab keys.
+            // the menubar and Dock would unexpectedly appear.
+            // It appears that the key window will still be nil in this
+            // case, so only enable menubar visibility if the key window
+            // is not nil.
+            if( pParentWindow && pParentWindow != pFrame->getNSWindow() )
                 [NSMenu setMenuBarVisible: YES];
+            else
+                [NSMenu setMenuBarVisible: NO];
         }
         else
         {

Reply via email to