Introduce an allClientList in Workspace

Holds AbstractClients that is both X11 and Wayland clients. Allows
to easily change code which needs to operate on all clients to get
to them without needing special handling for Wayland clients. At the
same time we are still able to get to the windowing system specific
clients through the old clientList() and waylandServer()->clients().
icc-effect-5.14.5
Martin Gräßlin 2015-09-18 13:44:54 +02:00
parent 6326d96c02
commit 51888e8abd
2 changed files with 12 additions and 0 deletions

View File

@ -378,6 +378,7 @@ void Workspace::init()
if (!c->isInitialPositionSet()) {
Placement::self()->place(c, area);
}
m_allClients.append(c);
if (!unconstrained_stacking_order.contains(c))
unconstrained_stacking_order.append(c); // Raise if it hasn't got any stacking position yet
if (!stacking_order.contains(c)) // It'll be updated later, and updateToolWindows() requires
@ -393,6 +394,7 @@ void Workspace::init()
);
connect(w, &WaylandServer::shellClientRemoved, this,
[this] (ShellClient *c) {
m_allClients.removeAll(c);
clientHidden(c);
emit clientRemoved(c);
x_stacking_dirty = true;
@ -438,6 +440,7 @@ Workspace::~Workspace()
// However, remove from some lists to e.g. prevent performTransiencyCheck()
// from crashing.
clients.removeAll(c);
m_allClients.removeAll(c);
desktops.removeAll(c);
}
for (UnmanagedList::iterator it = unmanaged.begin(), end = unmanaged.end(); it != end; ++it)
@ -511,6 +514,7 @@ void Workspace::addClient(Client* c)
} else {
FocusChain::self()->update(c, FocusChain::Update);
clients.append(c);
m_allClients.append(c);
}
if (!unconstrained_stacking_order.contains(c))
unconstrained_stacking_order.append(c); // Raise if it hasn't got any stacking position yet
@ -574,6 +578,7 @@ void Workspace::removeClient(Client* c)
Q_ASSERT(clients.contains(c) || desktops.contains(c));
// TODO: if marked client is removed, notify the marked list
clients.removeAll(c);
m_allClients.removeAll(c);
desktops.removeAll(c);
x_stacking_dirty = true;
attention_chain.removeAll(c);

View File

@ -215,6 +215,12 @@ public:
const DeletedList &deletedList() const {
return deleted;
}
/**
* @returns List of all clients (either X11 or Wayland) currently managed by Workspace
**/
const QList<AbstractClient*> allClientList() const {
return m_allClients;
}
void stackScreenEdgesUnderOverrideRedirect();
@ -531,6 +537,7 @@ private:
QPoint focusMousePos;
ClientList clients;
QList<AbstractClient*> m_allClients;
ClientList desktops;
UnmanagedList unmanaged;
DeletedList deleted;