summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-09 15:29:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-09 21:17:03 +0200
commit9b6545773605c421a9266fcffca95d21131f5ada (patch)
treeeb4a184c87ec58738054f58c0fb6f9208d53278f /vcl/source/window
parent6c6046a83e0285f4c4303ee8a049759113dac16d (diff)
remove vcl/waitobj.hxx
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 <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/dialog.cxx29
-rw-r--r--vcl/source/window/window3.cxx14
2 files changed, 25 insertions, 18 deletions
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 <vcl/layout.hxx>
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
-#include <vcl/waitobj.hxx>
+#include <vcl/locktoplevels.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/toolkit/button.hxx>
#include <vcl/mnemonic.hxx>
@@ -64,7 +64,9 @@
#include <tools/json_writer.hxx>
#include <iostream>
+#include <stack>
#include <utility>
+#include <vector>
static OString ImplGetDialogText( Dialog* pDialog )
{
@@ -1607,6 +1609,16 @@ void Dialog::Command(const CommandEvent& rCEvt)
SystemWindow::Command(rCEvt);
}
+struct TopLevelWindowLockerImpl
+{
+ std::stack<std::vector<VclPtr<vcl::Window>>> m_aBusyStack;
+};
+
+TopLevelWindowLocker::TopLevelWindowLocker()
+ : m_xImpl(std::make_unique<TopLevelWindowLockerImpl>())
+{
+}
+
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 <vcl/window.hxx>
-#include <vcl/waitobj.hxx>
#include <window.h>
#include <vcl/cursor.hxx>
-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(); }