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

New commits:
commit 5c576ea89f91944b6587d54cea41d13519be99fc
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Sat Mar 29 19:50:22 2025 -0400
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Mar 31 20:05:26 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/+/183501
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index a34a57c7dc53..15508866e93d 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -272,10 +272,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