summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/salmenu.hxx2
-rw-r--r--vcl/source/window/menubarwindow.cxx5
2 files changed, 6 insertions, 1 deletions
diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx
index 014554723c18..6457d9a80569 100644
--- a/vcl/inc/salmenu.hxx
+++ b/vcl/inc/salmenu.hxx
@@ -80,6 +80,8 @@ public:
virtual void RemoveMenuBarButton( sal_uInt16 nId );
virtual void Update() {}
+ virtual bool CanGetFocus() const { return false; }
+
// TODO: implement show/hide for the Win/Mac VCL native backends
virtual void ShowItem( unsigned nPos, bool bShow ) { EnableItem( nPos, bShow ); }
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 4b72e0b5bbf9..ac84120c73de 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -1180,10 +1180,13 @@ bool MenuBarWindow::HandleMenuButtonEvent( sal_uInt16 i_nButtonId )
bool MenuBarWindow::CanGetFocus() const
{
- /* #i83908# do not use the menubar if it is native and invisible
+ /* #i83908# do not use the menubar if it is native or invisible
this relies on MenuBar::ImplCreate setting the height of the menubar
to 0 in this case
*/
+ SalMenu *pNativeMenu = pMenu ? pMenu->ImplGetSalMenu() : nullptr;
+ if (pNativeMenu && pNativeMenu->VisibleMenuBar())
+ return pNativeMenu->CanGetFocus();
return GetSizePixel().Height() > 0;
}