[plugins/qpa] Add a roundtrip platform function

Summary:
Mostly intended for plugins loaded into KWin and wanting to use
KWayland::Client::ConnectionThread::roundtrip(). By providing this
function we can ensure that KWin does not block and nevertheless
perform the required roundtrip.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1153
This commit is contained in:
Martin Gräßlin 2016-03-16 11:06:53 +01:00
parent 863c586b19
commit fe745177e0
2 changed files with 22 additions and 0 deletions

View file

@ -79,5 +79,26 @@ void *NativeInterface::nativeResourceForWindow(const QByteArray &resource, QWind
return nullptr;
}
static void roundtrip()
{
if (!waylandServer()) {
return;
}
auto c = waylandServer()->internalClientConection();
if (!c) {
return;
}
c->flush();
waylandServer()->dispatch();
}
QFunctionPointer NativeInterface::platformFunction(const QByteArray &function) const
{
if (qstrcmp(function.toLower(), "roundtrip") == 0) {
return &roundtrip;
}
return nullptr;
}
}
}

View file

@ -35,6 +35,7 @@ public:
explicit NativeInterface(Integration *integration);
void *nativeResourceForIntegration(const QByteArray &resource) override;
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) override;
QFunctionPointer platformFunction(const QByteArray &function) const override;
private:
Integration *m_integration;