summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-10 23:30:02 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-11 01:43:04 +0100
commit7d594687216f183a681ecfe7e1d424d8a55422c2 (patch)
tree7e47ec186ed1a26a179cc4ac9ca7d48bb3b85a9f
parent17fc445938dedb05125a6d6a5b4ce7f34ea95f59 (diff)
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.kaganski@collabora.com>
-rw-r--r--vcl/source/window/menu.cxx7
-rw-r--r--vcl/source/window/menubarwindow.cxx14
2 files changed, 2 insertions, 19 deletions
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;
}