Change Workspace::clientRemoved to carry an AbstractClient

At the same time emit it when a ShellClient get's removed. This ensures
it gets removed from e.g. the FocusChain.
icc-effect-5.14.5
Martin Gräßlin 2015-04-30 10:51:58 +02:00
parent 8d3ee65269
commit f55c086007
7 changed files with 17 additions and 9 deletions

View File

@ -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<Client*>(c);
if (!client) {
return;
}
deleteEdgeForClient(client);
QObject::disconnect(client, &Client::geometryChanged,
ScreenEdges::self(), &ScreenEdges::handleClientGeometryChanged);

View File

@ -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*>(client)) {
removeClient(c);
}
}
void ClientLevel::setupClientConnections(Client *client)

View File

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QList>
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();

View File

@ -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()));

View File

@ -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);

View File

@ -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);
}

View File

@ -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*);