diff options
author | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-04-22 15:30:26 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-05-15 08:05:29 +0000 |
commit | 28fab275033a6b4f8d6e78da0f729837144b0420 (patch) | |
tree | f85e7c891df3b5518c2f58d4573e8a55215c5e50 /src | |
parent | dc40abe925db4a6d4f4236f61bb0c55b585c75da (diff) |
add AA_CompressHighFrequencyEvents to control compression on xcb
7edd10e6c added this compression feature, but some applications may
need to disable it.
[ChangeLog][X11] It's now possible to unset AA_CompressHighFrequencyEvents
to disable the new X event compression feature that was added in 5.6.0.
This is a replacement for the WA_NoX11EventCompression flag in Qt 4.
Task-number: QTBUG-44964
Change-Id: I37a9c8a4831f1c02eda0f03b54125f3255d25500
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qnamespace.h | 1 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 11 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 1 |
4 files changed, 15 insertions, 1 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index c73ceb9503..2a0b8461cd 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -508,6 +508,7 @@ public: AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me AA_DontUseNativeDialogs = 23, AA_SynthesizeMouseForUnhandledTabletEvents = 24, + AA_CompressHighFrequencyEvents = 25, // Add new attributes before this line AA_AttributeCount diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 60ce1fc916..3c53a23896 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -239,6 +239,17 @@ to mouse events instead. This attribute is enabled by default. This value has been added in Qt 5.7. + \value AA_CompressHighFrequencyEvents Enables compression of certain frequent events. + On the X11 windowing system, the default value is true, which means that + QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and + position will be combined whenever they occur more frequently than the + application handles them, so that they don't accumulate and overwhelm the + application later. On other platforms, the default is false. + (In the future, the compression feature may be implemented across platforms.) + You can test the attribute to see whether compression is enabled. + If your application needs to handle all events with no compression, + you can unset this attribute. This value has been added in Qt 5.7. + The following values are obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 87b4c7b91f..4b0e94eda0 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1713,7 +1713,8 @@ void QXcbConnection::processXcbEvents() continue; } - if (compressEvent(event, i, eventqueue)) + if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_CompressHighFrequencyEvents)) && + compressEvent(event, i, eventqueue)) continue; bool accepted = false; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 703167c0cd..cdbf9b295e 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -125,6 +125,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char , m_defaultVisualId(UINT_MAX) { m_instance = this; + qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true); qRegisterMetaType<QXcbWindow*>(); #ifdef XCB_USE_XLIB |