diff options
author | Liang Qi <liang.qi@qt.io> | 2019-01-26 08:35:40 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-01-26 08:35:40 +0100 |
commit | 980567b3a32b2e2f00c86f2d627cd82b5230dd0f (patch) | |
tree | bc8cc4005b2e07cbc5cad8ba30f8c9fa4f236c3d /src/plugins/platforms/xcb | |
parent | e81acde7d0cf5fb44a3fb2cf0bf7aaa2c65f807e (diff) | |
parent | 730cbad8824bcfcb7ab60371a6563cfb6dd5658d (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
src/android/templates/AndroidManifest.xml
tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
Change-Id: I4c9679e3a8ebba118fbf4772301ff8fde60455b9
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbclipboard.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_basic.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbeventqueue.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbeventqueue.h | 7 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/xcb_qpa_lib.pro | 4 |
5 files changed, 27 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index bc92f82d5f..ac8b029916 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -810,8 +810,9 @@ xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t window, i connection()->flush(); - // sleep 50 ms, so we don't use up CPU cycles all the time. - QThread::msleep(50); + const auto elapsed = timer.elapsed(); + if (elapsed < clipboard_timeout) + queue->waitForNewEvents(clipboard_timeout - elapsed); } while (timer.elapsed() < clipboard_timeout); return nullptr; diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp index c69912c361..af72285135 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp @@ -287,7 +287,7 @@ void QXcbBasicConnection::initializeShm() logging->setEnabled(QtMsgType::QtWarningMsg, true); } -void QXcbBasicConnection::initializeXRandr() +void QXcbBasicConnection::initializeXRender() { const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_render_id); if (!reply || !reply->present) { @@ -303,7 +303,7 @@ void QXcbBasicConnection::initializeXRandr() return; } - m_hasXRandr = true; + m_hasXRender = true; m_xrenderVersion.first = xrenderQuery->major_version; m_xrenderVersion.second = xrenderQuery->minor_version; } @@ -337,7 +337,7 @@ void QXcbBasicConnection::initializeXFixes() m_xfixesFirstEvent = reply->first_event; } -void QXcbBasicConnection::initializeXRender() +void QXcbBasicConnection::initializeXRandr() { const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_randr_id); if (!reply || !reply->present) @@ -352,7 +352,7 @@ void QXcbBasicConnection::initializeXRender() return; } - m_hasXRender = true; + m_hasXRandr = true; m_xrandrFirstEvent = reply->first_event; } diff --git a/src/plugins/platforms/xcb/qxcbeventqueue.cpp b/src/plugins/platforms/xcb/qxcbeventqueue.cpp index 527bca26a8..82a36c0727 100644 --- a/src/plugins/platforms/xcb/qxcbeventqueue.cpp +++ b/src/plugins/platforms/xcb/qxcbeventqueue.cpp @@ -229,6 +229,8 @@ void QXcbEventQueue::run() enqueueEvent(event); while (!m_closeConnectionDetected && (event = xcb_poll_for_queued_event(connection))) enqueueEvent(event); + + m_newEventsCondition.wakeOne(); wakeUpDispatcher(); } @@ -346,6 +348,13 @@ bool QXcbEventQueue::peekEventQueue(PeekerCallback peeker, void *peekerData, return result; } +void QXcbEventQueue::waitForNewEvents(unsigned long time) +{ + m_newEventsMutex.lock(); + m_newEventsCondition.wait(&m_newEventsMutex, time); + m_newEventsMutex.unlock(); +} + void QXcbEventQueue::sendCloseConnectionEvent() const { // A hack to close XCB connection. Apparently XCB does not have any APIs for this? 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 <QtCore/QHash> #include <QtCore/QEventLoop> #include <QtCore/QVector> +#include <QtCore/QMutex> +#include <QtCore/QWaitCondition> #include <xcb/xcb.h> @@ -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<typename Peeker> diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 647058167b..db3d6629b3 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -112,4 +112,8 @@ qtConfig(xkb) { qtConfig(dlopen): QMAKE_USE += libdl +# qxcbkeyboard.cpp's KeyTbl has more than 256 levels of expansion and older +# Clang uses that as a limit (it's 1024 in current versions). +clang:!intel_icc: QMAKE_CXXFLAGS += -ftemplate-depth=1024 + load(qt_module) |