Commit 0e63b4e8 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

wayland: Simplify plasmashell surface installation code

parent 7475385c
......@@ -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<XdgPopupClient *>(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);
......
......@@ -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<AbstractClient *> m_clients;
InitializationFlags m_initFlags;
QVector<KWaylandServer::PlasmaShellSurfaceInterface*> m_plasmaShellSurfaces;
QHash<AbstractWaylandOutput *, WaylandOutput *> m_waylandOutputs;
QHash<AbstractWaylandOutput *, WaylandOutputDevice *> m_waylandOutputDevices;
KWIN_SINGLETON(WaylandServer)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment