diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index 8f4b592a43..04558c5f1c 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -260,14 +260,8 @@ void WaylandServer::registerXdgToplevelClient(XdgToplevelClient *client) registerShellClient(client); - auto it = std::find_if(m_plasmaShellSurfaces.begin(), m_plasmaShellSurfaces.end(), - [surface] (PlasmaShellSurfaceInterface *plasmaSurface) { - return plasmaSurface->surface() == surface; - } - ); - if (it != m_plasmaShellSurfaces.end()) { - client->installPlasmaShellSurface(*it); - m_plasmaShellSurfaces.erase(it); + if (auto shellSurface = PlasmaShellSurfaceInterface::get(surface)) { + client->installPlasmaShellSurface(shellSurface); } if (auto decoration = ServerSideDecorationInterface::get(surface)) { client->installServerDecoration(decoration); @@ -297,19 +291,9 @@ void WaylandServer::registerXdgGenericClient(AbstractClient *client) XdgPopupClient *popupClient = qobject_cast(client); if (popupClient) { registerShellClient(popupClient); - - SurfaceInterface *surface = client->surface(); - auto it = std::find_if(m_plasmaShellSurfaces.begin(), m_plasmaShellSurfaces.end(), - [surface] (PlasmaShellSurfaceInterface *plasmaSurface) { - return plasmaSurface->surface() == surface; - } - ); - - if (it != m_plasmaShellSurfaces.end()) { - popupClient->installPlasmaShellSurface(*it); - m_plasmaShellSurfaces.erase(it); + if (auto shellSurface = PlasmaShellSurfaceInterface::get(client->surface())) { + popupClient->installPlasmaShellSurface(shellSurface); } - return; } qCDebug(KWIN_CORE) << "Received invalid xdg client:" << client->surface(); @@ -457,13 +441,7 @@ bool WaylandServer::init(InitializationFlags flags) [this] (PlasmaShellSurfaceInterface *surface) { if (XdgSurfaceClient *client = findXdgSurfaceClient(surface->surface())) { client->installPlasmaShellSurface(surface); - return; } - - m_plasmaShellSurfaces.append(surface); - connect(surface, &QObject::destroyed, this, [this, surface] { - m_plasmaShellSurfaces.removeOne(surface); - }); } ); m_appMenuManager = new AppMenuManagerInterface(m_display, m_display); diff --git a/src/wayland_server.h b/src/wayland_server.h index a928efbcc2..ce8cb571c7 100644 --- a/src/wayland_server.h +++ b/src/wayland_server.h @@ -46,7 +46,6 @@ class ServerSideDecorationPaletteManagerInterface; class SurfaceInterface; class OutputInterface; class PlasmaShellInterface; -class PlasmaShellSurfaceInterface; class PlasmaVirtualDesktopManagementInterface; class PlasmaWindowManagementInterface; class OutputManagementInterface; @@ -310,7 +309,6 @@ private: KWaylandServer::KeyStateInterface *m_keyState = nullptr; QList m_clients; InitializationFlags m_initFlags; - QVector m_plasmaShellSurfaces; QHash m_waylandOutputs; QHash m_waylandOutputDevices; KWIN_SINGLETON(WaylandServer)