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

New commits:
commit 66ae812fdb6bfee86fbeea94fcd1b968e619a3a1
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:15 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/+/183500
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Tested-by: Jenkins

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index cf1b6f4448f8..3e50105f178d 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -286,10 +286,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