summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-05-10 14:56:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-05-11 12:09:11 +0100
commitfac124afd23b23c648900d14c41881dc246f5e0e (patch)
tree8f4d59368e30751fadbb063510b0eb9cf04f8aa5
parentab30f3367686f37c18a5c11e3621e29e37b11409 (diff)
make this cunning more explicit
Change-Id: Ie461646e076da4aa4b144c68e0e08c0424474ad8
-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;
}