From 9b6545773605c421a9266fcffca95d21131f5ada Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 9 Apr 2021 15:29:24 +0100 Subject: remove vcl/waitobj.hxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit create vcl/locktoplevels.hxx for the utility to set all toplevel windows modally locked Change-Id: I964484d238852e830e1e5c0b86b3bebb3b41a6b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113889 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/window/dialog.cxx | 29 +++++++++++++++++++++++++---- vcl/source/window/window3.cxx | 14 -------------- 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'vcl/source/window') diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index e18b9f18cd4b..d5fcad21571e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include @@ -64,7 +64,9 @@ #include #include +#include #include +#include static OString ImplGetDialogText( Dialog* pDialog ) { @@ -1607,6 +1609,16 @@ void Dialog::Command(const CommandEvent& rCEvt) SystemWindow::Command(rCEvt); } +struct TopLevelWindowLockerImpl +{ + std::stack>> m_aBusyStack; +}; + +TopLevelWindowLocker::TopLevelWindowLocker() + : m_xImpl(std::make_unique()) +{ +} + void TopLevelWindowLocker::incBusy(const weld::Widget* pIgnore) { // lock any toplevel windows from being closed until busy is over @@ -1632,20 +1644,29 @@ void TopLevelWindowLocker::incBusy(const weld::Widget* pIgnore) a->IncModalCount(); a->ImplGetFrame()->NotifyModalHierarchy(true); } - m_aBusyStack.push(aTopLevels); + m_xImpl->m_aBusyStack.push(aTopLevels); } void TopLevelWindowLocker::decBusy() { // unlock locked toplevel windows from being closed now busy is over - for (auto& a : m_aBusyStack.top()) + for (auto& a : m_xImpl->m_aBusyStack.top()) { if (a->IsDisposed()) continue; a->DecModalCount(); a->ImplGetFrame()->NotifyModalHierarchy(false); } - m_aBusyStack.pop(); + m_xImpl->m_aBusyStack.pop(); +} + +bool TopLevelWindowLocker::isBusy() const +{ + return !m_xImpl->m_aBusyStack.empty(); +} + +TopLevelWindowLocker::~TopLevelWindowLocker() +{ } void Dialog::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index a4ebb21e1ae6..c06e8d0eb54b 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -18,23 +18,9 @@ */ #include -#include #include #include -WaitObject::WaitObject(vcl::Window* pWindow) - : mpWindow(pWindow) -{ - if (mpWindow) - mpWindow->EnterWait(); -} - -WaitObject::~WaitObject() -{ - if (mpWindow) - mpWindow->LeaveWait(); -} - namespace vcl { Size Window::GetOptimalSize() const { return Size(); } -- cgit