summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/wayland/qwaylanddisplay.cpp27
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp1
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow_p.h2
3 files changed, 21 insertions, 9 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
index dfdf88c0b4a..d585c194bd6 100644
--- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp
+++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
@@ -455,18 +455,21 @@ void QWaylandDisplay::reconnect()
mActiveWindows.clear();
const auto windows = QGuiApplication::allWindows();
+ QList<QWaylandWindow *> allPlatformWindows;
for (auto window : windows) {
- if (auto waylandWindow = static_cast<QWaylandWindow *>(window->handle()))
+ if (auto waylandWindow = static_cast<QWaylandWindow *>(window->handle())) {
waylandWindow->closeChildPopups();
+ allPlatformWindows.push_back(waylandWindow);
+ }
}
+
// Remove windows that do not need to be recreated and now closed popups
QList<QWaylandWindow *> recreateWindows;
- for (auto window : std::as_const(windows)) {
- auto waylandWindow = static_cast<QWaylandWindow*>(window->handle());
- if (waylandWindow && waylandWindow->wlSurface()) {
- waylandWindow->reset();
- recreateWindows.push_back(waylandWindow);
+ for (auto window : std::as_const(allPlatformWindows)) {
+ if (window->subSurfaceWindow() || window->shellSurface()) {
+ recreateWindows.push_back(window);
}
+ window->reset();
}
if (mSyncCallback) {
@@ -480,6 +483,15 @@ void QWaylandDisplay::reconnect()
if (!mDisplay)
_exit(1);
+ connect(
+ this, &QWaylandDisplay::connected, this,
+ [&allPlatformWindows] {
+ for (auto &window : std::as_const(allPlatformWindows)) {
+ window->initializeWlSurface();
+ }
+ },
+ Qt::SingleShotConnection);
+
setupConnection();
initialize();
@@ -488,7 +500,8 @@ void QWaylandDisplay::reconnect()
initEventThread();
auto needsRecreate = [](QPlatformWindow *window) {
- return window && !static_cast<QWaylandWindow *>(window)->wlSurface();
+ auto waylandWindow = static_cast<QWaylandWindow *>(window);
+ return waylandWindow && !waylandWindow->subSurfaceWindow() && !waylandWindow->shellSurface();
};
auto window = recreateWindows.begin();
while (!recreateWindows.isEmpty()) {
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index cb6c07f9799..6d4f11e8d83 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -1803,7 +1803,6 @@ void QWaylandWindow::closeChildPopups() {
void QWaylandWindow::reinit()
{
- initializeWlSurface();
if (window()->isVisible()) {
initWindow();
if (hasPendingUpdateRequest())
diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h
index e4ce2af700f..592125c6839 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow_p.h
+++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h
@@ -239,6 +239,7 @@ public:
virtual void reinit();
void reset();
+ void initializeWlSurface();
bool windowEvent(QEvent *event) override;
@@ -340,7 +341,6 @@ protected:
private:
void setGeometry_helper(const QRect &rect);
void initWindow();
- void initializeWlSurface();
bool shouldCreateShellSurface() const;
bool shouldCreateSubSurface() const;
void resetSurfaceRole();