diff options
-rw-r--r-- | include/vcl/floatwin.hxx | 3 | ||||
-rw-r--r-- | vcl/source/window/floatwin.cxx | 24 |
2 files changed, 17 insertions, 10 deletions
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index 7cb1e38b9914..127e35c11631 100644 --- a/include/vcl/floatwin.hxx +++ b/include/vcl/floatwin.hxx @@ -57,10 +57,11 @@ enum class FloatWinPopupEndFlags TearOff = 0x02, DontCallHdl = 0x04, CloseAll = 0x08, + NoCloseChildren = 0x10, }; namespace o3tl { - template<> struct typed_flags<FloatWinPopupEndFlags> : is_typed_flags<FloatWinPopupEndFlags, 0x0f> {}; + template<> struct typed_flags<FloatWinPopupEndFlags> : is_typed_flags<FloatWinPopupEndFlags, 0x1f> {}; } enum class FloatWinTitleType diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 55784bdb2aa2..9de1efdaf221 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -818,24 +818,30 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags ) void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId ) { + if ( !mbInPopupMode ) + return; + ImplSVData* pSVData = ImplGetSVData(); mbInCleanUp = true; // prevent killing this window due to focus change while working with it - // stop the PopupMode also for all following PopupMode windows - while (pSVData->mpWinData->mpFirstFloat && pSVData->mpWinData->mpFirstFloat.get() != this) - pSVData->mpWinData->mpFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel); + if (!(nFlags & FloatWinPopupEndFlags::NoCloseChildren)) + { + // stop the PopupMode also for all PopupMode windows created after us + std::vector<VclPtr<FloatingWindow>> aCancelFloats; + // stop the PopupMode also for all following PopupMode windows + for (auto pFloat = pSVData->mpWinData->mpFirstFloat; + pFloat != nullptr && pFloat != this; + pFloat = pFloat->mpNextFloat) + aCancelFloats.push_back(pFloat); + for (auto it : aCancelFloats) + it->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::NoCloseChildren); + } // delete window from the list pSVData->mpWinData->mpFirstFloat = mpNextFloat; mpNextFloat = nullptr; - if ( !mbInPopupMode ) - { - mbInCleanUp = false; - return; - } - FloatWinPopupFlags nPopupModeFlags = mnPopupModeFlags; mbPopupModeTearOff = nFlags & FloatWinPopupEndFlags::TearOff && nPopupModeFlags & FloatWinPopupFlags::AllowTearOff; |