From 51888e8abdac9cff5744cd5e487ab73aa46a851c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 18 Sep 2015 13:44:54 +0200 Subject: [PATCH] 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(). --- workspace.cpp | 5 +++++ workspace.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/workspace.cpp b/workspace.cpp index fc9f80f0c4..8438c5d548 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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); diff --git a/workspace.h b/workspace.h index b9c9390eda..b055fb8b17 100644 --- a/workspace.h +++ b/workspace.h @@ -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 allClientList() const { + return m_allClients; + } void stackScreenEdgesUnderOverrideRedirect(); @@ -531,6 +537,7 @@ private: QPoint focusMousePos; ClientList clients; + QList m_allClients; ClientList desktops; UnmanagedList unmanaged; DeletedList deleted;