|
|
165ad0 |
From 771705eee02b4d752beee22ef5408ccbd72078cc Mon Sep 17 00:00:00 2001
|
|
|
165ad0 |
From: Elvis Lee <kwangwoong.lee@lge.com>
|
|
|
165ad0 |
Date: Thu, 18 Feb 2021 15:45:49 +0900
|
|
|
165ad0 |
Subject: [PATCH 28/40] Handle registry_global out of constructor
|
|
|
165ad0 |
|
|
|
165ad0 |
Factory functions in QWaylandDisplay::registry_global() can be overridden.
|
|
|
165ad0 |
Later, other classes instantiated in the registry_global can support
|
|
|
165ad0 |
platform specific implementation with inheritance and some factory function.
|
|
|
165ad0 |
|
|
|
165ad0 |
Change-Id: I92ce574e049b8c91587687cc7c30611f3dfdbe56
|
|
|
165ad0 |
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
|
|
|
165ad0 |
(cherry picked from commit 3793a82038682db77966ea5daf8e75964e4250fe)
|
|
|
165ad0 |
---
|
|
|
165ad0 |
src/client/qwaylanddisplay.cpp | 19 ++++++++++++-------
|
|
|
165ad0 |
src/client/qwaylanddisplay_p.h | 2 ++
|
|
|
165ad0 |
src/client/qwaylandintegration.cpp | 3 +++
|
|
|
165ad0 |
3 files changed, 17 insertions(+), 7 deletions(-)
|
|
|
165ad0 |
|
|
|
165ad0 |
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
|
|
|
165ad0 |
index ea344c61..0f75cb7e 100644
|
|
|
165ad0 |
--- a/src/client/qwaylanddisplay.cpp
|
|
|
165ad0 |
+++ b/src/client/qwaylanddisplay.cpp
|
|
|
165ad0 |
@@ -158,13 +158,6 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
|
|
165ad0 |
if (!mXkbContext)
|
|
|
165ad0 |
qCWarning(lcQpaWayland, "failed to create xkb context");
|
|
|
165ad0 |
#endif
|
|
|
165ad0 |
-
|
|
|
165ad0 |
- forceRoundTrip();
|
|
|
165ad0 |
-
|
|
|
165ad0 |
- if (!mWaitingScreens.isEmpty()) {
|
|
|
165ad0 |
- // Give wl_output.done and zxdg_output_v1.done events a chance to arrive
|
|
|
165ad0 |
- forceRoundTrip();
|
|
|
165ad0 |
- }
|
|
|
165ad0 |
}
|
|
|
165ad0 |
|
|
|
165ad0 |
QWaylandDisplay::~QWaylandDisplay(void)
|
|
|
165ad0 |
@@ -189,6 +182,18 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
|
|
165ad0 |
wl_display_disconnect(mDisplay);
|
|
|
165ad0 |
}
|
|
|
165ad0 |
|
|
|
165ad0 |
+// Steps which is called just after constructor. This separates registry_global() out of the constructor
|
|
|
165ad0 |
+// so that factory functions in integration can be overridden.
|
|
|
165ad0 |
+void QWaylandDisplay::initialize()
|
|
|
165ad0 |
+{
|
|
|
165ad0 |
+ forceRoundTrip();
|
|
|
165ad0 |
+
|
|
|
165ad0 |
+ if (!mWaitingScreens.isEmpty()) {
|
|
|
165ad0 |
+ // Give wl_output.done and zxdg_output_v1.done events a chance to arrive
|
|
|
165ad0 |
+ forceRoundTrip();
|
|
|
165ad0 |
+ }
|
|
|
165ad0 |
+}
|
|
|
165ad0 |
+
|
|
|
165ad0 |
void QWaylandDisplay::ensureScreen()
|
|
|
165ad0 |
{
|
|
|
165ad0 |
if (!mScreens.empty() || mPlaceholderScreen)
|
|
|
165ad0 |
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
|
|
|
165ad0 |
index 09a1736a..d9c8849f 100644
|
|
|
165ad0 |
--- a/src/client/qwaylanddisplay_p.h
|
|
|
165ad0 |
+++ b/src/client/qwaylanddisplay_p.h
|
|
|
165ad0 |
@@ -129,6 +129,8 @@ public:
|
|
|
165ad0 |
QWaylandDisplay(QWaylandIntegration *waylandIntegration);
|
|
|
165ad0 |
~QWaylandDisplay(void) override;
|
|
|
165ad0 |
|
|
|
165ad0 |
+ void initialize();
|
|
|
165ad0 |
+
|
|
|
165ad0 |
#if QT_CONFIG(xkbcommon)
|
|
|
165ad0 |
struct xkb_context *xkbContext() const { return mXkbContext.get(); }
|
|
|
165ad0 |
#endif
|
|
|
165ad0 |
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
|
|
|
165ad0 |
index e5e7dd42..f5632982 100644
|
|
|
165ad0 |
--- a/src/client/qwaylandintegration.cpp
|
|
|
165ad0 |
+++ b/src/client/qwaylandintegration.cpp
|
|
|
165ad0 |
@@ -200,6 +200,9 @@ void QWaylandIntegration::initialize()
|
|
|
165ad0 |
QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data());
|
|
|
165ad0 |
QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests()));
|
|
|
165ad0 |
|
|
|
165ad0 |
+ // Call after eventDispatcher is fully connected, for QWaylandDisplay::forceRoundTrip()
|
|
|
165ad0 |
+ mDisplay->initialize();
|
|
|
165ad0 |
+
|
|
|
165ad0 |
// Qt does not support running with no screens
|
|
|
165ad0 |
mDisplay->ensureScreen();
|
|
|
165ad0 |
}
|
|
|
165ad0 |
--
|
|
|
165ad0 |
2.35.1
|
|
|
165ad0 |
|