From 730cbad8824bcfcb7ab60371a6563cfb6dd5658d Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 24 Jan 2019 15:53:28 +0300 Subject: xcb: Avoid repaint lags with DnD The lags can be seen when dragged data is requested for a MIME type. This leads to calling QXcbClipboard::waitForClipboardEvent() which runs a loop in the GUI thread and processes events from QXcbEventQueue. The loop ends when a corresponding event is received, otherwise it makes a delay of 50 ms before the next iteration. Sync with QXcbEventQueue thread by QWaitCondition instead of using the delay. This way the loop will end as soon as possible and Expose events will be processed with minimal delay. Task-number: QTBUG-44849 Fixes: QTBUG-55442 Fixes: QTBUG-62344 Fixes: QTBUG-73253 Change-Id: Ie18d63b51a7260c83d53ffe1169b25e5135dd73b Reviewed-by: Mikhail Svetkin Reviewed-by: Gatis Paeglis Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbeventqueue.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/plugins/platforms/xcb/qxcbeventqueue.h') diff --git a/src/plugins/platforms/xcb/qxcbeventqueue.h b/src/plugins/platforms/xcb/qxcbeventqueue.h index 235f2824be..11d0b8e963 100644 --- a/src/plugins/platforms/xcb/qxcbeventqueue.h +++ b/src/plugins/platforms/xcb/qxcbeventqueue.h @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include @@ -104,6 +106,8 @@ public: bool peekEventQueue(PeekerCallback peeker, void *peekerData = nullptr, PeekOptions option = PeekDefault, qint32 peekerId = -1); + void waitForNewEvents(unsigned long time = ULONG_MAX); + private: QXcbEventNode *qXcbEventNodeFactory(xcb_generic_event_t *event); void dequeueNode(); @@ -131,6 +135,9 @@ private: // debug stats quint64 m_nodesOnHeap = 0; + + QMutex m_newEventsMutex; + QWaitCondition m_newEventsCondition; }; template -- cgit v1.2.3