vcl/source/window/floatwin.cxx | 11 ++++++++--- vcl/source/window/menufloatingwindow.cxx | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-)
New commits: commit 5210e1ba38bfe996a888f21673640de13b49508b Author: Caolán McNamara <caol...@redhat.com> Date: Mon Nov 14 11:33:24 2016 +0000 Resolves: tdf#103914 if menu no longer has focus, leave focus where it is In the normal course of events, the menu, or its children, has focus when its popped down, in this case continue to restored the focus to the previous focus window which had it when the menu appeared. If some other non-child window of the menu has focus as popdown time, leave the focus where it is. Change-Id: Ia860f90350653ad4d8056738dacbc434fb364989 (cherry picked from commit 616bc7b854e237aea1962a6750abd7f139e38ac2) Reviewed-on: https://gerrit.libreoffice.org/30862 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index c24706b..e1fb623 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -793,12 +793,17 @@ void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPt { Show( false, ShowFlags::NoFocusChange ); - // maybe pass focus on to a suitable FloatingWindow - if ( xFocusId != nullptr ) - Window::EndSaveFocus( xFocusId ); + if (HasChildPathFocus() && xFocusId != nullptr) + { + // restore focus to previous focus window if we still have the focus + Window::EndSaveFocus(xFocusId); + } else if ( pSVData->maWinData.mpFocusWin && pSVData->maWinData.mpFirstFloat && ImplIsWindowOrChild( pSVData->maWinData.mpFocusWin ) ) + { + // maybe pass focus on to a suitable FloatingWindow pSVData->maWinData.mpFirstFloat->GrabFocus(); + } mbPopupModeTearOff = false; } else diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 52ccac0..0602461 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -403,11 +403,11 @@ void MenuFloatingWindow::End() if (GetParent() && !GetParent()->IsDisposed()) GetParent()->ImplDecModalCount(); - // restore focus + // restore focus to previous window if we still have the focus VclPtr<vcl::Window> xFocusId(xSaveFocusId); - if (xFocusId != nullptr) + xSaveFocusId = nullptr; + if (HasChildPathFocus() && xFocusId != nullptr) { - xSaveFocusId = nullptr; ImplGetSVData()->maWinData.mbNoDeactivate = false; Window::EndSaveFocus(xFocusId); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits