summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2018-11-26 16:34:10 +0100
committerMiklos Vajna <vmiklos@collabora.com>2018-11-27 10:38:32 +0100
commit53009e5da362ec1860afb2a4c563fe9ed0a90693 (patch)
treea8ad34ff1d4b5f1b6e768d7eb8065d772fb50382
parent2462b9831b87696fb40bfcaa56e96f4fefbf0d99 (diff)
tdf#121723 vcl: leave popup mode on focus loss of toplevel windows
This way it can't happen that we open a menu or context menu, the user switches away (loosing focus) and a leftover floating window is still there. Handle this at the same place where we stop blinking the cursor on focus loss. Reviewed-on: https://gerrit.libreoffice.org/64053 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit f21d2b48bd68424a96aa6cd5572e368208378291) Change-Id: I4321e8e3fa1d3f8976c0a1fa29c6a182972023bf
-rw-r--r--vcl/source/window/winproc.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index e49896d3d446..aedf6fae05c4 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1863,6 +1863,11 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow )
vcl::Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor )
pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide();
+
+ // Make sure that no menu is visible when a toplevel window loses focus.
+ VclPtr<FloatingWindow> pFirstFloat = pSVData->maWinData.mpFirstFloat;
+ if (pFirstFloat && !pWindow->GetParent())
+ pFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
}
struct DelayedCloseEvent