diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-03-28 01:16:56 +0400 |
---|---|---|
committer | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-04-03 19:45:49 +0400 |
commit | 2eb17abf4262b467140ed4262320bf60cbda3ba2 (patch) | |
tree | 4f6b4fcf76ef43560e967ac034e65167da23fc11 /src/client | |
parent | b66d93c6b827ef2d194916c68f1f64fe874d5163 (diff) | |
download | qtwayland-2eb17abf4262b467140ed4262320bf60cbda3ba2.tar.gz |
Client: Check for shell integration when initializing platform plugin
This makes QWaylandDisplay::initialize return a boolean and moves the
QWaylandIntegration's failure check out of constructor as
QWaylandIntegration::shellIntegration is a virtual method, this also
removes the out-of-date comments about processEvents as it's no more
used in QWaylandDisplay::forceRoundTrip.
Fixes: QTBUG-102457
Pick-to: 6.5
Change-Id: I3c8f1d9fd195326b587b45318443c2beee1ebfc2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 7 | ||||
-rw-r--r-- | src/client/qwaylanddisplay_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandintegration.cpp | 18 | ||||
-rw-r--r-- | src/client/qwaylandintegration_p.h | 3 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 5c3431a0..3fe4cb50 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -379,8 +379,11 @@ QWaylandDisplay::~QWaylandDisplay(void) // Steps which is called just after constructor. This separates registry_global() out of the constructor // so that factory functions in integration can be overridden. -void QWaylandDisplay::initialize() +bool QWaylandDisplay::initialize() { + if (!isInitialized()) + return false; + forceRoundTrip(); if (!mWaitingScreens.isEmpty()) { @@ -389,6 +392,8 @@ void QWaylandDisplay::initialize() } if (!mClientSideInputContextRequested) mTextInputManagerIndex = INT_MAX; + + return qEnvironmentVariableIntValue("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION") || shellIntegration(); } void QWaylandDisplay::ensureScreen() diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index f5c1bcbb..93d4b1d9 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -97,7 +97,7 @@ public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void) override; - void initialize(); + bool initialize(); #if QT_CONFIG(xkbcommon) struct xkb_context *xkbContext() const { return mXkbContext.get(); } diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index d4724545..5d21e1c7 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -83,10 +83,6 @@ QWaylandIntegration::QWaylandIntegration() #endif { mDisplay.reset(new QWaylandDisplay(this)); - if (!mDisplay->isInitialized()) { - mFailed = true; - return; - } QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); @@ -99,6 +95,11 @@ QWaylandIntegration::~QWaylandIntegration() sInstance = nullptr; } +bool QWaylandIntegration::init() +{ + return mDisplay->initialize(); +} + QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const { return mNativeInterface.data(); @@ -168,7 +169,7 @@ QPlatformNativeInterface *QWaylandIntegration::createPlatformNativeInterface() // Support platform specific initialization void QWaylandIntegration::initializePlatform() { - mDisplay->initialize(); + mDisplay->initEventThread(); mNativeInterface.reset(createPlatformNativeInterface()); initializeInputDeviceIntegration(); @@ -184,14 +185,9 @@ void QWaylandIntegration::initializePlatform() void QWaylandIntegration::initialize() { - mDisplay->initEventThread(); - - // Call this after initializing event thread for QWaylandDisplay::forceRoundTrip() initializePlatform(); - // But the aboutToBlock() and awake() should be connected after initializePlatform(). - // Otherwise the connected flushRequests() may consumes up all events before processEvents starts to wait, - // so that processEvents(QEventLoop::WaitForMoreEvents) may be blocked in the forceRoundTrip(). + // Call this after initializing event thread for QWaylandDisplay::flushRequests() QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h index 2ddd9389..23403c22 100644 --- a/src/client/qwaylandintegration_p.h +++ b/src/client/qwaylandintegration_p.h @@ -43,7 +43,7 @@ public: static QWaylandIntegration *instance() { return sInstance; } - bool hasFailed() { return mFailed; } + bool init(); bool hasCapability(QPlatformIntegration::Capability cap) const override; QPlatformWindow *createPlatformWindow(QWindow *window) const override; @@ -134,7 +134,6 @@ private: #if QT_CONFIG(accessibility) mutable QScopedPointer<QPlatformAccessibility> mAccessibility; #endif - bool mFailed = false; QMutex mClientBufferInitLock; bool mClientBufferIntegrationInitialized = false; bool mServerBufferIntegrationInitialized = false; |