diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-03-29 21:22:46 +0400 |
---|---|---|
committer | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-04-03 18:33:26 +0400 |
commit | b66d93c6b827ef2d194916c68f1f64fe874d5163 (patch) | |
tree | 5772b324473851e6f3285fa53b1f0b137831479e | |
parent | f39be90d321e2fa3845e98959f3977b234cd372e (diff) | |
download | qtwayland-b66d93c6b827ef2d194916c68f1f64fe874d5163.tar.gz |
Client: let QWaylandClientExtension work before platform integration is assigned
Task-number: QTBUG-102457
Pick-to: 6.5
Change-Id: Ia47478a4fbf45ba96fd73c6a1a53c2b844aa41b4
Reviewed-by: David Edmundson <davidedmundson@kde.org>
-rw-r--r-- | src/client/global/qwaylandclientextension.cpp | 9 | ||||
-rw-r--r-- | src/client/qwaylandintegration.cpp | 5 | ||||
-rw-r--r-- | src/client/qwaylandintegration_p.h | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp index ca0954f7..b2783088 100644 --- a/src/client/global/qwaylandclientextension.cpp +++ b/src/client/global/qwaylandclientextension.cpp @@ -6,10 +6,6 @@ #include "qwaylandclientextension_p.h" #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> -#include <QtCore/QDebug> QT_BEGIN_NAMESPACE @@ -19,12 +15,9 @@ 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. - waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration()); + waylandIntegration = QtWaylandClient::QWaylandIntegration::instance(); if (!waylandIntegration) waylandIntegration = new QtWaylandClient::QWaylandIntegration(); - - if (!waylandIntegration->nativeInterface()->nativeResourceForIntegration("wl_display")) - qWarning() << "This application requires a Wayland platform plugin"; } void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global) diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 45a247f9..d4724545 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandIntegration *QWaylandIntegration::sInstance = nullptr; + QWaylandIntegration::QWaylandIntegration() #if defined(Q_OS_MACOS) : mFontDb(new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>) @@ -88,10 +90,13 @@ QWaylandIntegration::QWaylandIntegration() QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); + + sInstance = this; } QWaylandIntegration::~QWaylandIntegration() { + sInstance = nullptr; } QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h index 1ba7a633..2ddd9389 100644 --- a/src/client/qwaylandintegration_p.h +++ b/src/client/qwaylandintegration_p.h @@ -41,6 +41,8 @@ public: QWaylandIntegration(); ~QWaylandIntegration() override; + static QWaylandIntegration *instance() { return sInstance; } + bool hasFailed() { return mFailed; } bool hasCapability(QPlatformIntegration::Capability cap) const override; @@ -138,6 +140,8 @@ private: bool mServerBufferIntegrationInitialized = false; bool mShellIntegrationInitialized = false; + static QWaylandIntegration *sInstance; + friend class QWaylandDisplay; }; |