From 8b85fdcedfc6d73083f6ecd53403b4ef7a08d595 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 29 Aug 2021 12:26:06 +0300 Subject: [PATCH] wayland: Setup window management integration on initial commit Originally, there was ShellClient class that was the predecessor to WaylandClient subclasses. If the main surface is unmapped, the corresponding instance of ShellClient would be kept around. That had been changed with the introduction of XdgToplevelClient and XdgPopupClient. Since ShellClient had been kept alive even if the corresponding surface were unmapped, it did make sense to setup window management integration when the surface is mapped. However, this also means that plasma will not know about initially minimized windows. Since unmapped windows are handled differently now, we can setup window management after the client performs the initial commit. If the main surface is unmapped, the XdgToplevelClient object will be destroyed and with it, the window management integration. --- src/xdgshellclient.cpp | 15 +++++---------- src/xdgshellclient.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp index 40f3eddbf9..a17755922b 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellclient.cpp @@ -356,7 +356,6 @@ XdgToplevelClient::XdgToplevelClient(XdgToplevelInterface *shellSurface) : XdgSurfaceClient(shellSurface->xdgSurface()) , m_shellSurface(shellSurface) { - setupWindowManagementIntegration(); setupPlasmaShellIntegration(); setDesktops({VirtualDesktopManager::self()->currentDesktop()}); #if KWIN_BUILD_ACTIVITIES @@ -1237,6 +1236,11 @@ void XdgToplevelClient::initialize() scheduleConfigure(); updateColorScheme(); + + if (!isLockScreen()) { + setupWindowManagementInterface(); + } + m_isInitialized = true; } @@ -1514,15 +1518,6 @@ void XdgToplevelClient::updateClientArea() } } -void XdgToplevelClient::setupWindowManagementIntegration() -{ - if (isLockScreen()) { - return; - } - connect(surface(), &SurfaceInterface::mapped, - this, &XdgToplevelClient::setupWindowManagementInterface); -} - void XdgToplevelClient::setupPlasmaShellIntegration() { connect(surface(), &SurfaceInterface::mapped, diff --git a/src/xdgshellclient.h b/src/xdgshellclient.h index c619506df7..f8eab6bef2 100644 --- a/src/xdgshellclient.h +++ b/src/xdgshellclient.h @@ -192,7 +192,6 @@ private: void updateFullScreenMode(bool set); void updateShowOnScreenEdge(); void updateClientArea(); - void setupWindowManagementIntegration(); void setupPlasmaShellIntegration(); void sendPing(PingReason reason); MaximizeMode initialMaximizeMode() const;