summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/floatwin.hxx1
-rw-r--r--vcl/source/window/floatwin.cxx7
2 files changed, 5 insertions, 3 deletions
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 92ca7937d4a0..d22602deac90 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -91,6 +91,7 @@ class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
private:
VclPtr<FloatingWindow> mpNextFloat;
VclPtr<vcl::Window> mpFirstPopupModeWin;
+ VclPtr<vcl::Window> mxPrevFocusWin;
ImplData* mpImplData;
Rectangle maFloatRect;
ImplSVEvent * mnPostId;
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 024d726da3f6..82283c94337e 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -634,7 +634,7 @@ void FloatingWindow::ImplCallPopupModeEnd()
// call Handler asynchronously.
if ( mpImplData && !mnPostId )
- mnPostId = Application::PostUserEvent( LINK( this, FloatingWindow, ImplEndPopupModeHdl ), nullptr, true );
+ mnPostId = Application::PostUserEvent( LINK( this, FloatingWindow, ImplEndPopupModeHdl ), mxPrevFocusWin, true );
}
void FloatingWindow::PopupModeEnd()
@@ -711,10 +711,11 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags
ImplSVData* pSVData = ImplGetSVData();
mpNextFloat = pSVData->maWinData.mpFirstFloat;
pSVData->maWinData.mpFirstFloat = this;
- if( nFlags & FloatWinPopupFlags::GrabFocus )
+ if (nFlags & FloatWinPopupFlags::GrabFocus)
{
// force key input even without focus (useful for menus)
mbGrabFocus = true;
+ mxPrevFocusWin = Window::SaveFocus();
mpWindowImpl->mpFrameData->mbHasFocus = true;
GrabFocus();
}
@@ -840,7 +841,7 @@ void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPt
void FloatingWindow::EndPopupMode( FloatWinPopupEndFlags nFlags )
{
- ImplEndPopupMode( nFlags );
+ ImplEndPopupMode(nFlags, mxPrevFocusWin);
}
void FloatingWindow::AddPopupModeWindow( vcl::Window* pWindow )