vcl/source/window/menu.cxx          |    7 -------
 vcl/source/window/menubarwindow.cxx |   14 ++------------
 2 files changed, 2 insertions(+), 19 deletions(-)

New commits:
commit 7d594687216f183a681ecfe7e1d424d8a55422c2
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Feb 10 23:30:02 2024 +0600
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Feb 11 01:43:04 2024 +0100

    tdf#54169: do not hide mnemonics in menu, when navigating using mouse
    
    Pressing Alt (or F10) by itself would activate/highlight the menu, and
    show mnemonics. But clicking such activated menu used to disable the
    mnemonics. This change fixes it, making sure that they keep displaying
    until closing the menu.
    
    Change-Id: I60f04e1474a8eb1322e5ac75f74b02d67dce9b73
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163217
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index b72f2f8c8091..eb08c4de9848 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2861,13 +2861,6 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& 
pParentWin, tools::Rectang
     if (!pSFrom && (vcl::IsInPopupMenuExecute() || !nItemCount))
         return false;
 
-    // set the flag to hide or show accelerators in the menu depending on 
whether the menu was launched by mouse or keyboard shortcut
-    if( pSFrom && pSFrom->IsMenuBar())
-    {
-        auto pMenuBarWindow = 
static_cast<MenuBarWindow*>(pSFrom->pWindow.get());
-        pMenuBarWindow->SetMBWHideAccel( !(pMenuBarWindow->GetMBWMenuKey()) );
-    }
-
     mpLayoutData.reset();
 
     ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/window/menubarwindow.cxx 
b/vcl/source/window/menubarwindow.cxx
index 4198c5a824c3..9fb3552ed17a 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -465,7 +465,8 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool 
bSelectEntry, bool b
     if( ! m_pMenu )
         return;
 
-    SetMBWHideAccel(n == ITEMPOS_INVALID);
+    if (n == ITEMPOS_INVALID)
+        SetMBWHideAccel(true);
 
     // #57934# close active popup if applicable, as TH's background storage 
works.
     MenuItemData* pNextData = m_pMenu->pItemList->GetDataFromPos( n );
@@ -850,8 +851,6 @@ bool MenuBarWindow::HandleKeyEvent( const KeyEvent& 
rKEvent, bool bFromMenu )
         }
     }
 
-    bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
-
     if ( !bDone && ( bFromMenu || rKEvent.GetKeyCode().IsMod2() ) )
     {
         sal_Unicode nCharCode = rKEvent.GetCharCode();
@@ -868,15 +867,6 @@ bool MenuBarWindow::HandleKeyEvent( const KeyEvent& 
rKEvent, bool bFromMenu )
         }
     }
 
-    const bool bShowAccels = nCode != KEY_ESCAPE;
-    if (GetMBWMenuKey() != bShowAccels)
-    {
-        SetMBWMenuKey(bShowAccels);
-        SetMBWHideAccel(!bShowAccels);
-        if (autoacc)
-            Invalidate(InvalidateFlags::Update);
-    }
-
     return bDone;
 }
 

Reply via email to