diff --git a/screenedge.cpp b/screenedge.cpp index 2a61458ea9..bcd6b93e19 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -640,7 +640,11 @@ ScreenEdges::ScreenEdges(QObject *parent) QWidget w; m_cornerOffset = (w.physicalDpiX() + w.physicalDpiY() + 5) / 6; - connect(workspace(), &Workspace::clientRemoved, [this](KWin::Client *client) { + connect(workspace(), &Workspace::clientRemoved, [this](KWin::AbstractClient *c) { + Client *client = qobject_cast(c); + if (!client) { + return; + } deleteEdgeForClient(client); QObject::disconnect(client, &Client::geometryChanged, ScreenEdges::self(), &ScreenEdges::handleClientGeometryChanged); diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index b4aeb89b8f..bf1b2b9445 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -38,7 +38,7 @@ ClientLevel::ClientLevel(ClientModel *model, AbstractLevel *parent) : AbstractLevel(model, parent) { connect(Workspace::self(), SIGNAL(clientAdded(KWin::Client*)), SLOT(clientAdded(KWin::Client*))); - connect(Workspace::self(), SIGNAL(clientRemoved(KWin::Client*)), SLOT(clientRemoved(KWin::Client*))); + connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLevel::clientRemoved); connect(model, SIGNAL(exclusionsChanged()), SLOT(reInit())); } @@ -52,9 +52,11 @@ void ClientLevel::clientAdded(Client *client) checkClient(client); } -void ClientLevel::clientRemoved(Client *client) +void ClientLevel::clientRemoved(AbstractClient *client) { - removeClient(client); + if (Client *c = qobject_cast(client)) { + removeClient(c); + } } void ClientLevel::setupClientConnections(Client *client) diff --git a/scripting/scripting_model.h b/scripting/scripting_model.h index 26f5630684..57d25a5683 100644 --- a/scripting/scripting_model.h +++ b/scripting/scripting_model.h @@ -25,6 +25,7 @@ along with this program. If not, see . #include namespace KWin { +class AbstractClient; class Client; namespace ScriptingClientModel { @@ -228,7 +229,7 @@ public: virtual AbstractLevel *parentForId(quint32 child) const; public Q_SLOTS: void clientAdded(KWin::Client *client); - void clientRemoved(KWin::Client *client); + void clientRemoved(KWin::AbstractClient *client); private Q_SLOTS: // uses sender() void checkClient(); diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index 065fa5e21e..c718a95242 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -42,7 +42,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) connect(ws, &Workspace::currentDesktopChanged, this, &WorkspaceWrapper::currentDesktopChanged); connect(ws, SIGNAL(clientAdded(KWin::Client*)), SIGNAL(clientAdded(KWin::Client*))); connect(ws, SIGNAL(clientAdded(KWin::Client*)), SLOT(setupClientConnections(KWin::Client*))); - connect(ws, SIGNAL(clientRemoved(KWin::Client*)), SIGNAL(clientRemoved(KWin::Client*))); + connect(ws, &Workspace::clientRemoved, this, &WorkspaceWrapper::clientRemoved); connect(ws, &Workspace::clientActivated, this, &WorkspaceWrapper::clientActivated); connect(vds, SIGNAL(countChanged(uint,uint)), SIGNAL(numberDesktopsChanged(uint))); connect(vds, SIGNAL(layoutChanged(int,int)), SIGNAL(desktopLayoutChanged())); diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h index 592fb928b0..bd48aa0187 100644 --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -91,7 +91,7 @@ Q_SIGNALS: void desktopPresenceChanged(KWin::AbstractClient *client, int desktop); void currentDesktopChanged(int desktop, KWin::AbstractClient *client); void clientAdded(KWin::Client *client); - void clientRemoved(KWin::Client *client); + void clientRemoved(KWin::AbstractClient *client); void clientManaging(KWin::Client *client); void clientMinimized(KWin::AbstractClient *client); void clientUnminimized(KWin::AbstractClient *client); diff --git a/workspace.cpp b/workspace.cpp index d589bd075e..b76015bd80 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -387,7 +387,8 @@ void Workspace::init() } ); connect(w, &WaylandServer::shellClientRemoved, this, - [this] { + [this] (ShellClient *c) { + emit clientRemoved(c); x_stacking_dirty = true; updateStackingOrder(true); } diff --git a/workspace.h b/workspace.h index 067b5e4c68..fb753e3df4 100644 --- a/workspace.h +++ b/workspace.h @@ -444,7 +444,7 @@ Q_SIGNALS: void desktopPresenceChanged(KWin::AbstractClient*, int); void currentDesktopChanged(int, KWin::AbstractClient*); void clientAdded(KWin::Client*); - void clientRemoved(KWin::Client*); + void clientRemoved(KWin::AbstractClient*); void clientActivated(KWin::AbstractClient*); void clientDemandsAttentionChanged(KWin::AbstractClient*, bool); void groupAdded(KWin::Group*);