tdf#119390 Don't focus the toolbar when closing a floating window
commit4b8ef8bd6acfa9c062146bff2168fb0450e9542e
authorMaxim Monastirsky <momonasmon@gmail.com>
Sun, 26 Aug 2018 20:54:13 +0000 (26 23:54 +0300)
committerMaxim Monastirsky <momonasmon@gmail.com>
Thu, 30 Aug 2018 22:09:20 +0000 (31 00:09 +0200)
treecb722bc05431c0273a202b106f461931960f1724
parente2ecce7e01038baac502f4b69c7ad47e82cd1ab4
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>
framework/source/uielement/toolbarmanager.cxx
svtools/source/uno/popupwindowcontroller.cxx
vcl/source/window/floatwin.cxx