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>
This commit is contained in:
parent
25e7d1ed11
commit
d6d416b05e
@ -6,10 +6,6 @@
|
|||||||
#include "qwaylandclientextension_p.h"
|
#include "qwaylandclientextension_p.h"
|
||||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||||
#include <QtWaylandClient/private/qwaylandintegration_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
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -19,12 +15,9 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate()
|
|||||||
{
|
{
|
||||||
// Keep the possibility to use a custom waylandIntegration as a plugin,
|
// Keep the possibility to use a custom waylandIntegration as a plugin,
|
||||||
// but also add the possibility to run it as a QML component.
|
// 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)
|
if (!waylandIntegration)
|
||||||
waylandIntegration = new QtWaylandClient::QWaylandIntegration();
|
waylandIntegration = new QtWaylandClient::QWaylandIntegration();
|
||||||
|
|
||||||
if (!waylandIntegration->nativeInterface()->nativeResourceForIntegration("wl_display"))
|
|
||||||
qWarning() << "This application requires a Wayland platform plugin";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global)
|
void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global)
|
||||||
|
@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
namespace QtWaylandClient {
|
namespace QtWaylandClient {
|
||||||
|
|
||||||
|
QWaylandIntegration *QWaylandIntegration::sInstance = nullptr;
|
||||||
|
|
||||||
QWaylandIntegration::QWaylandIntegration()
|
QWaylandIntegration::QWaylandIntegration()
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
: mFontDb(new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>)
|
: mFontDb(new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>)
|
||||||
@ -88,10 +90,13 @@ QWaylandIntegration::QWaylandIntegration()
|
|||||||
|
|
||||||
QWaylandWindow::fixedToplevelPositions =
|
QWaylandWindow::fixedToplevelPositions =
|
||||||
!qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS");
|
!qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS");
|
||||||
|
|
||||||
|
sInstance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandIntegration::~QWaylandIntegration()
|
QWaylandIntegration::~QWaylandIntegration()
|
||||||
{
|
{
|
||||||
|
sInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const
|
QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const
|
||||||
|
@ -41,6 +41,8 @@ public:
|
|||||||
QWaylandIntegration();
|
QWaylandIntegration();
|
||||||
~QWaylandIntegration() override;
|
~QWaylandIntegration() override;
|
||||||
|
|
||||||
|
static QWaylandIntegration *instance() { return sInstance; }
|
||||||
|
|
||||||
bool hasFailed() { return mFailed; }
|
bool hasFailed() { return mFailed; }
|
||||||
|
|
||||||
bool hasCapability(QPlatformIntegration::Capability cap) const override;
|
bool hasCapability(QPlatformIntegration::Capability cap) const override;
|
||||||
@ -138,6 +140,8 @@ private:
|
|||||||
bool mServerBufferIntegrationInitialized = false;
|
bool mServerBufferIntegrationInitialized = false;
|
||||||
bool mShellIntegrationInitialized = false;
|
bool mShellIntegrationInitialized = false;
|
||||||
|
|
||||||
|
static QWaylandIntegration *sInstance;
|
||||||
|
|
||||||
friend class QWaylandDisplay;
|
friend class QWaylandDisplay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user