[Libreoffice-commits] core.git: include/vcl toolkit/source vcl/source

Michael Meeks michael.meeks at collabora.com
Thu Nov 26 04:04:00 PST 2015


 include/vcl/scheduler.hxx          |    6 ++++--
 toolkit/source/awt/vclxtoolkit.cxx |    2 +-
 vcl/source/app/scheduler.cxx       |   19 ++++++++++++++++++-
 3 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit fbdeef6b7f74a3602792d178b1e750020b2cac89
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Nov 26 10:42:10 2015 +0000

    vcl: fix event processing to idle - for JUnit tests.
    
    Change-Id: Ibeb1f6627815fc34c6e166357c88e076b75f6abb
    Reviewed-on: https://gerrit.libreoffice.org/20197
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 6dd8030..13d1687 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -92,8 +92,10 @@ public:
     static void CallbackTaskScheduling( bool ignore );
     /// Calculate minimum timeout - and return its value.
     static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles );
-    /// Process one pending task ahead of time with highhest priority.
-    static void       ProcessTaskScheduling( bool bTimer );
+    /// Process one pending task ahead of time with highest priority.
+    static bool       ProcessTaskScheduling( bool bTimerOnly );
+    /// Process all events until we are idle
+    static void       ProcessEventsToIdle();
 };
 
 #endif // INCLUDED_VCL_SCHEDULER_HXX
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 00c0a14..bf1a3ad 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1912,7 +1912,7 @@ void SAL_CALL VCLXToolkit::processEventsToIdle()
     throw (css::uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aSolarGuard;
-    Scheduler::ProcessTaskScheduling(false);
+    Scheduler::ProcessEventsToIdle();
 }
 
 OUString SAL_CALL VCLXToolkit::getHWOSConfInfo()
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index e3c6abf..9450393 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -157,7 +157,7 @@ void Scheduler::CallbackTaskScheduling(bool ignore)
     Scheduler::ProcessTaskScheduling( false );
 }
 
-void Scheduler::ProcessTaskScheduling( bool bTimerOnly )
+bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
 {
     ImplSchedulerData* pSchedulerData;
 
@@ -168,6 +168,23 @@ void Scheduler::ProcessTaskScheduling( bool bTimerOnly )
 
         pSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks();
         pSchedulerData->Invoke();
+        return true;
+    }
+    else
+        return false;
+}
+
+void Scheduler::ProcessEventsToIdle()
+{
+    // FIXME: really we should process incoming OS events too ...
+    int nSanity = 1000;
+    while (Scheduler::ProcessTaskScheduling(false))
+    {
+        if (nSanity-- < 0)
+        {
+            SAL_WARN("vcl.schedule", "Unexpected volume of events to process");
+            break;
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list