summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-06-07 14:03:44 +0300
committerLászló Németh <laszlo.nemeth@collabora.com>2016-06-10 16:30:05 +0200
commit30104ff4c76b7f31450f525b4a6d7ebad9823aad (patch)
tree2acb9d7ff08a286c88841943b4cc1bdec2ca2aad /toolkit
parente9fadde3c56a1e8bbb1ffe3ded861fbcd3252407 (diff)
Add a pause() method to XToolkitExperimental
Pauses the main thread of LibreOffice for the requested amount of time. Change-Id: I5978a3a9b9561623c698526d8c29695d71df3d03
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 2dfa25cf13cb..7916de775756 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -143,6 +143,32 @@ extern "C" typedef vcl::Window* (SAL_CALL *FN_SvtCreateWindow)(
vcl::Window* pParent,
WinBits nWinBits );
+class Pause : public Idle
+{
+public:
+ Pause(sal_Int32 nPauseMilliseconds) :
+ Idle("pause"),
+ m_nPauseMilliseconds(nPauseMilliseconds)
+ {
+ SetPriority(SchedulerPriority::HIGHEST);
+ Start();
+ }
+
+ virtual ~Pause()
+ {
+ }
+
+ virtual void Invoke() override
+ {
+ SolarMutexGuard aSolarGuard;
+ osl::Thread::wait(std::chrono::milliseconds(m_nPauseMilliseconds));
+ Stop();
+ delete this;
+ }
+
+ sal_Int32 m_nPauseMilliseconds;
+};
+
class VCLXToolkitMutexHelper
{
protected:
@@ -205,6 +231,9 @@ public:
virtual void SAL_CALL setDeterministicScheduling(sal_Bool bDeterministicMode)
throw (css::uno::RuntimeException, std::exception) override;
+ virtual void SAL_CALL pause(sal_Int32 nMilliseconds)
+ throw (css::uno::RuntimeException, std::exception) override;
+
// css::awt::XToolkit
css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(css::uno::RuntimeException, std::exception) override;
css::awt::Rectangle SAL_CALL getWorkArea( ) throw(css::uno::RuntimeException, std::exception) override;
@@ -1942,6 +1971,12 @@ void SAL_CALL VCLXToolkit::setDeterministicScheduling(sal_Bool bDeterministicMod
Scheduler::SetDeterministicMode(bDeterministicMode);
}
+void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds)
+ throw (css::uno::RuntimeException, std::exception)
+{
+ new Pause(nMilliseconds);
+}
+
// css:awt:XToolkitRobot
void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )