diff options
-rw-r--r-- | vcl/unx/kde4/KDESalDisplay.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalDisplay.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/kde4/KDEXLib.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/kde4/KDEXLib.hxx | 4 |
4 files changed, 18 insertions, 12 deletions
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx index 105393fd9b54..33a36e45d5b0 100644 --- a/vcl/unx/kde4/KDESalDisplay.cxx +++ b/vcl/unx/kde4/KDESalDisplay.cxx @@ -46,14 +46,14 @@ SalKDEDisplay::~SalKDEDisplay() pDisp_ = nullptr; } -void SalKDEDisplay::Yield() +bool SalKDEDisplay::Yield() { if( DispatchInternalEvent() ) - return; + return true; // Prevent blocking from Drag'n'Drop events, which may have already have processed the event if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0) - return; + return false; DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() == osl::Thread::getCurrentIdentifier(), @@ -62,8 +62,9 @@ void SalKDEDisplay::Yield() XEvent event; XNextEvent( pDisp_, &event ); if( checkDirectInputEvent( &event )) - return; + return true; qApp->x11ProcessEvent( &event ); + return true; } // HACK: When using Qt event loop, input methods (japanese, etc.) will get broken because diff --git a/vcl/unx/kde4/KDESalDisplay.hxx b/vcl/unx/kde4/KDESalDisplay.hxx index a262a6a57ef1..59734c7d806e 100644 --- a/vcl/unx/kde4/KDESalDisplay.hxx +++ b/vcl/unx/kde4/KDESalDisplay.hxx @@ -27,7 +27,7 @@ class SalKDEDisplay : public SalX11Display explicit SalKDEDisplay( Display* pDisp ); virtual ~SalKDEDisplay(); static SalKDEDisplay* self(); - virtual void Yield() override; + virtual bool Yield() override; bool checkDirectInputEvent( XEvent* ev ); private: Atom xim_protocol; diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 6c3023b9ab77..653ce40c9abe 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -278,22 +278,25 @@ void KDEXLib::socketNotifierActivated( int fd ) sdata.handle( fd, sdata.data ); } -void KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) +bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) { if( !m_isGlibEventLoopType ) { + bool wasEvent = false; if( qApp->thread() == QThread::currentThread()) { // even if we use the LO event loop, still process Qt's events, // otherwise they can remain unhandled for quite a long while - processYield( false, bHandleAllCurrentEvents ); + wasEvent = processYield( false, bHandleAllCurrentEvents ); } - return SalXLib::Yield( bWait, bHandleAllCurrentEvents ); + return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || wasEvent; } // if we are the main thread (which is where the event processing is done), // good, just do it if( qApp->thread() == QThread::currentThread()) - processYield( bWait, bHandleAllCurrentEvents ); + { + return processYield( bWait, bHandleAllCurrentEvents ); + } else { // we were called from another thread; @@ -302,10 +305,11 @@ void KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) // temporarily do it while checking for new events) SalYieldMutexReleaser aReleaser; Q_EMIT processYieldSignal( bWait, bHandleAllCurrentEvents ); + return false; } } -void KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) +bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) { blockIdleTimeout = !bWait; QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread()); @@ -321,6 +325,7 @@ void KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) if( bWait && !wasEvent ) dispatcher->processEvents( QEventLoop::WaitForMoreEvents ); blockIdleTimeout = false; + return wasEvent; } void KDEXLib::StartTimer( sal_uLong nMS ) diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx index 951acb9a917f..4593298c34c6 100644 --- a/vcl/unx/kde4/KDEXLib.hxx +++ b/vcl/unx/kde4/KDEXLib.hxx @@ -67,7 +67,7 @@ class KDEXLib : public QObject, public SalXLib void userEventActivated(); void startTimeoutTimer(); void startUserEventTimer(); - void processYield( bool bWait, bool bHandleAllCurrentEvents ); + bool processYield( bool bWait, bool bHandleAllCurrentEvents ); Q_SIGNALS: void startTimeoutTimerSignal(); void startUserEventTimerSignal(); @@ -82,7 +82,7 @@ class KDEXLib : public QObject, public SalXLib virtual ~KDEXLib(); virtual void Init() override; - virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) override; + virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents ) override; virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) override; virtual void Remove( int fd ) override; virtual void StartTimer( sal_uLong nMS ) override; |