diff options
-rw-r--r-- | vcl/source/window/menufloatingwindow.cxx | 12 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.hxx | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index ac79b1f0c510..2db8caab9aba 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -417,6 +417,16 @@ void MenuFloatingWindow::Start() GetParent()->IncModalCount(); } +bool MenuFloatingWindow::MenuInHierarchyHasFocus() const +{ + if (HasChildPathFocus()) + return true; + PopupMenu* pSub = GetActivePopup(); + if (!pSub) + return false; + return pSub->ImplGetFloatingWindow()->HasChildPathFocus(); +} + void MenuFloatingWindow::End() { if (!bInExecute) @@ -428,7 +438,7 @@ void MenuFloatingWindow::End() // restore focus to previous window if we still have the focus VclPtr<vcl::Window> xFocusId(xSaveFocusId); xSaveFocusId = nullptr; - if (HasChildPathFocus() && xFocusId != nullptr) + if (xFocusId != nullptr && MenuInHierarchyHasFocus()) { ImplGetSVData()->maWinData.mbNoDeactivate = false; Window::EndSaveFocus(xFocusId); diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx index 9888cd220687..c091b46add4f 100644 --- a/vcl/source/window/menufloatingwindow.hxx +++ b/vcl/source/window/menufloatingwindow.hxx @@ -121,6 +121,8 @@ public: void SetPosInParent( sal_uInt16 nPos ) { nPosInParent = nPos; } + bool MenuInHierarchyHasFocus() const; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; }; |