diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.pro | 6 | ||||
-rw-r--r-- | src/client/global/qwaylandclientextension.cpp | 38 | ||||
-rw-r--r-- | src/client/global/qwaylandclientextension.h | 3 | ||||
-rw-r--r-- | src/client/global/qwaylandclientextension_p.h | 8 | ||||
-rw-r--r-- | src/client/qwaylandnativeinterface.cpp | 2 | ||||
-rw-r--r-- | src/client/qwaylandshm.cpp | 6 | ||||
-rw-r--r-- | src/client/qwaylandwindowmanagerintegration_p.h | 2 |
7 files changed, 35 insertions, 30 deletions
diff --git a/src/client/client.pro b/src/client/client.pro index 8be00c7ac..fa2036745 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -10,7 +10,7 @@ QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual CONFIG -= precompile_header CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner -!equals(QT_WAYLAND_GL_CONFIG, nogl) { +contains(QT_CONFIG, opengl) { DEFINES += QT_WAYLAND_GL_SUPPORT } @@ -38,7 +38,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/surface-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ - ../extensions/windowmanager.xml \ + ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell.xml \ @@ -116,7 +116,7 @@ HEADERS += qwaylandintegration_p.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ - ../shared/qwaylandshmformathelper_p.h + ../shared/qwaylandsharedmemoryformathelper_p.h include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp index 04aca8c2e..4202b333b 100644 --- a/src/client/global/qwaylandclientextension.cpp +++ b/src/client/global/qwaylandclientextension.cpp @@ -39,7 +39,7 @@ #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtWaylandClient/private/qwaylandintegration_p.h> #include <QtGui/QGuiApplication> -#include <QtGui/qpa/qplatformnativeinterface.h> +#include <QtGui/private/qguiapplication_p.h> QT_BEGIN_NAMESPACE @@ -51,35 +51,37 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() { // Keep the possibility to use a custom waylandIntegration as a plugin, // but also add the possibility to run it as a QML component. - struct ::wl_display *waylandDisplay = NULL; - if (QGuiApplication::platformNativeInterface()) { - waylandDisplay = static_cast<struct ::wl_display*>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display")); - } else { + waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration()); + if (!waylandIntegration) waylandIntegration = new QtWaylandClient::QWaylandIntegration(); - waylandDisplay = waylandIntegration->display()->wl_display(); - } - - Q_ASSERT(waylandDisplay); - struct ::wl_registry *registry = wl_display_get_registry(waylandDisplay); - QtWayland::wl_registry::init(registry); } -void QWaylandClientExtensionPrivate::registry_global(uint32_t id, const QString &interfaceName, uint32_t ver) +void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version) { - Q_Q(QWaylandClientExtension); - if (interfaceName == QLatin1String(q->extensionInterface()->name)) { - struct ::wl_registry *registry = static_cast<struct ::wl_registry *>(QtWayland::wl_registry::object()); - q->bind(registry, id, ver); - active = true; - emit q->activeChanged(); + QWaylandClientExtension *extension = static_cast<QWaylandClientExtension *>(data); + if (interface == QLatin1String(extension->extensionInterface()->name)) { + extension->bind(registry, id, version); + extension->d_func()->active = true; + emit extension->activeChanged(); } } +void QWaylandClientExtension::addRegistryListener() +{ + Q_D(QWaylandClientExtension); + d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); +} + QWaylandClientExtension::QWaylandClientExtension(const int ver) : QObject(*new QWaylandClientExtensionPrivate()) { Q_D(QWaylandClientExtension); d->version = ver; + + // The registry listener uses virtual functions and we don't want it to be called from + // the constructor. + QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection); } QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const diff --git a/src/client/global/qwaylandclientextension.h b/src/client/global/qwaylandclientextension.h index afb3f868f..d1610c271 100644 --- a/src/client/global/qwaylandclientextension.h +++ b/src/client/global/qwaylandclientextension.h @@ -71,6 +71,9 @@ protected: Q_SIGNALS: void versionChanged(); void activeChanged(); + +private Q_SLOTS: + void addRegistryListener(); }; template <typename T> diff --git a/src/client/global/qwaylandclientextension_p.h b/src/client/global/qwaylandclientextension_p.h index 70cf36c3d..88cc7a887 100644 --- a/src/client/global/qwaylandclientextension_p.h +++ b/src/client/global/qwaylandclientextension_p.h @@ -51,22 +51,20 @@ #include "qwaylandclientextension.h" #include <QtCore/private/qobject_p.h> #include <QtWaylandClient/private/qwaylandintegration_p.h> -#include <QtWaylandClient/private/qwayland-wayland.h> QT_BEGIN_NAMESPACE -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate, public QtWayland::wl_registry +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWaylandClientExtension) public: QWaylandClientExtensionPrivate(); + static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); QtWaylandClient::QWaylandIntegration *waylandIntegration; int version; bool active; - -protected: - void registry_global(uint32_t id, const QString &interfaceName, uint32_t version) Q_DECL_OVERRIDE; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index bad64204b..be639ce15 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -117,6 +117,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { +#ifdef QT_WAYLAND_GL_SUPPORT QByteArray lowerCaseResource = resource.toLower(); if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration()) @@ -127,6 +128,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglDisplay, context->handle()); +#endif return 0; } diff --git a/src/client/qwaylandshm.cpp b/src/client/qwaylandshm.cpp index 790a0e1b9..e94357bb5 100644 --- a/src/client/qwaylandshm.cpp +++ b/src/client/qwaylandshm.cpp @@ -39,7 +39,7 @@ #include <QtWaylandClient/private/qwaylandshm_p.h> #include <QtWaylandClient/private/qwaylanddisplay_p.h> -#include "qwaylandshmformathelper_p.h" +#include "qwaylandsharedmemoryformathelper_p.h" QT_BEGIN_NAMESPACE @@ -73,12 +73,12 @@ bool QWaylandShm::formatSupported(QImage::Format format) const wl_shm_format QWaylandShm::formatFrom(QImage::Format format) { - return QWaylandShmFormatHelper::fromQImageFormat(format); + return QWaylandSharedMemoryFormatHelper::fromQImageFormat(format); } QImage::Format QWaylandShm::formatFrom(wl_shm_format format) { - return QWaylandShmFormatHelper::fromWaylandShmFormat(format); + return QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(format); } } diff --git a/src/client/qwaylandwindowmanagerintegration_p.h b/src/client/qwaylandwindowmanagerintegration_p.h index f0c7ced6d..0e5f67ac1 100644 --- a/src/client/qwaylandwindowmanagerintegration_p.h +++ b/src/client/qwaylandwindowmanagerintegration_p.h @@ -57,7 +57,7 @@ #include <wayland-client.h> #include <QtPlatformSupport/private/qgenericunixservices_p.h> -#include <QtWaylandClient/private/qwayland-windowmanager.h> +#include <QtWaylandClient/private/qwayland-qt-windowmanager.h> #include <QtWaylandClient/qwaylandclientexport.h> QT_BEGIN_NAMESPACE |