summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2023-03-29 21:22:46 +0400
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-03 15:45:11 +0000
commit23a026cd33582f2ca65dabfd45a3ed33f1a7da71 (patch)
tree8ed2255b8433db84dae0890b7df927adeaf104c5
parent27ac0969ba34fcc2580c943ce404b1c1e71af936 (diff)
downloadqtwayland-23a026cd33582f2ca65dabfd45a3ed33f1a7da71.tar.gz
Client: let QWaylandClientExtension work before platform integration is assigned
Task-number: QTBUG-102457 Change-Id: Ia47478a4fbf45ba96fd73c6a1a53c2b844aa41b4 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit b66d93c6b827ef2d194916c68f1f64fe874d5163) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/client/global/qwaylandclientextension.cpp9
-rw-r--r--src/client/qwaylandintegration.cpp5
-rw-r--r--src/client/qwaylandintegration_p.h4
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 13bacc9b..399cc2fd 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 6221e689..28406298 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;
@@ -137,6 +139,8 @@ private:
bool mServerBufferIntegrationInitialized = false;
bool mShellIntegrationInitialized = false;
+ static QWaylandIntegration *sInstance;
+
friend class QWaylandDisplay;
};