diff options
-rw-r--r-- | offapi/com/sun/star/awt/XToolkitExperimental.idl | 5 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 35 |
2 files changed, 39 insertions, 1 deletions
diff --git a/offapi/com/sun/star/awt/XToolkitExperimental.idl b/offapi/com/sun/star/awt/XToolkitExperimental.idl index 89828b2864e1..5764ef5fc44f 100644 --- a/offapi/com/sun/star/awt/XToolkitExperimental.idl +++ b/offapi/com/sun/star/awt/XToolkitExperimental.idl @@ -23,7 +23,6 @@ interface XToolkitExperimental : XToolkit2 */ void processEventsToIdle(); - /** Get the number of OpenGL buffer swaps. */ hyper getOpenGLBufferSwapCounter(); @@ -31,6 +30,10 @@ interface XToolkitExperimental : XToolkit2 /** Turn on or off deterministic scheduling (off is the default). */ void setDeterministicScheduling([in] boolean bDeterministicMode); + + /** Pause the main thread of LibreOffice for the requested amount of time. + */ + void pause([in] long nMilliseconds); }; }; }; }; }; 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 ) |