[Libreoffice-commits] core.git: vcl/unx

Michael Meeks michael.meeks at collabora.com
Wed Nov 20 05:31:29 PST 2013


 vcl/unx/kde4/KDEXLib.cxx |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit a23231cbff9b18e7d2e02e91e9b674d71b8f39a9
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Nov 20 13:30:07 2013 +0000

    Revert "Simplify KDE4 yielding."
    
    This reverts commit 20f029c653abbd7578ceee968065f4c5d66f375f.
    
    The native X11 and gtk+ backends both have this functionality,
    and both with a hard-coded 100, and the gtk+ one has had active
    maintenance and testing. I'd like to leave that there, I suspect
    it is used in some obscure multi-threaded corner-case where we
    want to process events but only a few of them.

diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 28dbd5d..67d7a4d 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -329,16 +329,20 @@ void KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
     }
 }
 
-// Qts processEvent always processes all pending events,
-// so we can ignore the second parameter 'bHandleAllCurrentEvents'.
-void KDEXLib::processYield( bool bWait, bool )
+void KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents )
 {
-    QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread() );
-
-    if ( bWait )
+    QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
+    bool wasEvent = false;
+    for( int cnt = bHandleAllCurrentEvents ? 100 : 1;
+         cnt > 0;
+         --cnt )
+    {
+        if( !dispatcher->processEvents( QEventLoop::AllEvents ))
+            break;
+        wasEvent = true;
+    }
+    if( bWait && !wasEvent )
         dispatcher->processEvents( QEventLoop::WaitForMoreEvents );
-    else
-        dispatcher->processEvents( QEventLoop::AllEvents );
 }
 
 void KDEXLib::StartTimer( sal_uLong nMS )


More information about the Libreoffice-commits mailing list