diff options
Diffstat (limited to 'vcl/source/window/floatwin.cxx')
-rw-r--r-- | vcl/source/window/floatwin.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index c24706b11efd..e1fb623d72fb 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 |