summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2018-08-26 23:54:13 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2018-08-31 00:09:20 +0200
commit4b8ef8bd6acfa9c062146bff2168fb0450e9542e (patch)
treecb722bc05431c0273a202b106f461931960f1724 /svtools
parente2ecce7e01038baac502f4b69c7ad47e82cd1ab4 (diff)
tdf#119390 Don't focus the toolbar when closing a floating window
Toolbar popup windows have the toolbar as their direct parent. This causes problems when such window is teared-off and later closed, as Window::dispose will attempt to move the focus to its parent which is the toolbar, instead of what users expect to have the focus back in the document area, or in whatever was the last focused control. As a solution reparent the window before dispose, similar to what happens with floating toolbars. Also return the focus to the main window when popup mode ends, so we can keep track of the last focused control. This is also a good thing by itself, as WB_OWNERDRAWDECORATION windows don't get the focus by default, which results in neither the floating window nor the document have focus after tear-off. Change-Id: I060b8c45a64db9c612da58b7c35478bab41a4558 Reviewed-on: https://gerrit.libreoffice.org/59811 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index 51f2b6e10f42..264afc41ce75 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -79,7 +79,9 @@ void PopupWindowControllerImpl::SetFloatingWindow()
if( mpFloatingWindow )
{
mpFloatingWindow->RemoveEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener ) );
- mpFloatingWindow.disposeAndClear();
+ // tdf#119390 reparent the window, so focus is restored
+ // to the last focused control of the application window.
+ mpFloatingWindow->doLazyDelete();
}
mpFloatingWindow = mpPopupWindow;
mpPopupWindow.clear();