summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qguiapplication.cpp21
-rw-r--r--src/gui/kernel/qguiapplication.h1
-rw-r--r--src/gui/kernel/qplatformintegration.cpp15
-rw-r--r--src/gui/kernel/qplatformintegration.h5
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h1
6 files changed, 50 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 2e6000625e..077084b80f 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2801,6 +2801,27 @@ bool QGuiApplication::isSavingSession() const
return d->is_saving_session;
}
+/*!
+ \since 5.2
+
+ Function that can be used to sync Qt state with the Window Systems state.
+
+ This function will first empty Qts events by calling QCoreApplication::processEvents(),
+ then the platform plugin will sync up with the windowsystem, and finally Qts events
+ will be delived by another call to QCoreApplication::processEvents();
+
+ This function is timeconsuming and its use is discouraged.
+*/
+void QGuiApplication::sync()
+{
+ QCoreApplication::processEvents();
+ if (QGuiApplicationPrivate::platform_integration
+ && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) {
+ QGuiApplicationPrivate::platform_integration->sync();
+ QCoreApplication::processEvents();
+ }
+}
+
void QGuiApplicationPrivate::commitData()
{
Q_Q(QGuiApplication);
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index bd42f18418..0089d48fa6 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -155,6 +155,7 @@ public:
bool isSavingSession() const;
#endif
+ static void sync();
Q_SIGNALS:
void fontDatabaseChanged();
void screenAdded(QScreen *screen);
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 49ac7836cb..e583606e41 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -435,4 +435,19 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons
}
#endif
+/*!
+ \since 5.2
+
+ Function to sync the platform integrations state with the window system.
+
+ This is often implemented as a roundtrip from the platformintegration to the window system.
+
+ This function should not call QWindowSystemInterface::flushWindowSystemEvents() or
+ QCoreApplication::processEvents()
+*/
+void QPlatformIntegration::sync()
+{
+
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index d3189f8641..4be675a37a 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -94,7 +94,8 @@ public:
ForeignWindows,
NonFullScreenWindows,
NativeWidgets,
- WindowManagement
+ WindowManagement,
+ SyncState
};
virtual ~QPlatformIntegration() { }
@@ -162,6 +163,8 @@ public:
#ifndef QT_NO_SESSIONMANAGER
virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
#endif
+
+ virtual void sync();
protected:
void screenAdded(QPlatformScreen *screen);
};
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 6b5ea93638..d794065d45 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -282,6 +282,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case WindowMasks: return true;
case MultipleWindows: return true;
case ForeignWindows: return true;
+ case SyncState: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
@@ -458,4 +459,11 @@ QPlatformSessionManager *QXcbIntegration::createPlatformSessionManager(const QSt
}
#endif
+void QXcbIntegration::sync()
+{
+ for (int i = 0; i < m_connections.size(); i++) {
+ m_connections.at(i)->sync();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 79fb1965c4..6ae23125c8 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -106,6 +106,7 @@ public:
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE;
#endif
+ void sync();
private:
QList<QXcbConnection *> m_connections;