include/vcl/floatwin.hxx | 1 + vcl/source/window/floatwin.cxx | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
New commits: commit d1182223dcd3aca6b0922f1b27bc1537bceca7ae Author: Caolán McNamara <[email protected]> Date: Mon May 23 20:48:57 2016 +0100 like menus do, restore focus to prev control when floatingwindow popdowns in the FloatWinPopupFlags::GrabFocus case Change-Id: Ibebf23c83133f74f00e5dbb2540f108a383462cc diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index 92ca793..d22602d 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 024d726..82283c9 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 )
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
