From 0d8f11405e1aba37ae144ae8a5e7e24cba85cb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Wed, 21 Jun 2017 06:56:53 +0200 Subject: [PATCH] Introduce a method Workspace::markXStackingOrderAsDirty This method replaces the calls x_stacking_dirty = true in the code base allowing for further refactoring of that functionality. --- events.cpp | 2 +- layers.cpp | 2 +- workspace.cpp | 25 +++++++++++++++---------- workspace.h | 2 ++ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/events.cpp b/events.cpp index d100747a1f..931c95c5a7 100644 --- a/events.cpp +++ b/events.cpp @@ -330,7 +330,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) break; case XCB_CONFIGURE_NOTIFY: if (reinterpret_cast(e)->event == rootWindow()) - x_stacking_dirty = true; + markXStackingOrderAsDirty(); break; }; diff --git a/layers.cpp b/layers.cpp index b1c02ccb1b..8290bf3730 100644 --- a/layers.cpp +++ b/layers.cpp @@ -226,7 +226,7 @@ void Workspace::propagateClients(bool propagate_new_clients) // Make the cached stacking order invalid here, in case we need the new stacking order before we get // the matching event, due to X being asynchronous. - x_stacking_dirty = true; + markXStackingOrderAsDirty(); } /*! diff --git a/workspace.cpp b/workspace.cpp index a2fbb6ab3e..c7c9d1dff7 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -392,7 +392,7 @@ void Workspace::init() if (!stacking_order.contains(c)) // It'll be updated later, and updateToolWindows() requires stacking_order.append(c); // c to be in stacking_order } - x_stacking_dirty = true; + markXStackingOrderAsDirty(); updateStackingOrder(true); updateClientArea(); if (c->wantsInput()) { @@ -406,7 +406,7 @@ void Workspace::init() QRect area = clientArea(PlacementArea, Screens::self()->current(), c->desktop()); c->placeIn(area); } - x_stacking_dirty = true; + markXStackingOrderAsDirty(); updateStackingOrder(true); updateClientArea(); if (c->wantsInput()) { @@ -416,7 +416,7 @@ void Workspace::init() ); connect(c, &ShellClient::windowHidden, this, [this] { - x_stacking_dirty = true; + markXStackingOrderAsDirty(); updateStackingOrder(true); updateClientArea(); } @@ -431,7 +431,7 @@ void Workspace::init() } clientHidden(c); emit clientRemoved(c); - x_stacking_dirty = true; + markXStackingOrderAsDirty(); updateStackingOrder(true); updateClientArea(); } @@ -562,7 +562,7 @@ void Workspace::addClient(Client* 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 stacking_order.append(c); // c to be in stacking_order - x_stacking_dirty = true; + markXStackingOrderAsDirty(); updateClientArea(); // This cannot be in manage(), because the client got added only now updateClientLayer(c); if (c->isDesktop()) { @@ -586,7 +586,7 @@ void Workspace::addClient(Client* c) void Workspace::addUnmanaged(Unmanaged* c) { unmanaged.append(c); - x_stacking_dirty = true; + markXStackingOrderAsDirty(); } /** @@ -622,7 +622,7 @@ void Workspace::removeClient(Client* c) clients.removeAll(c); m_allClients.removeAll(c); desktops.removeAll(c); - x_stacking_dirty = true; + markXStackingOrderAsDirty(); attention_chain.removeAll(c); Group* group = findGroup(c->window()); if (group != NULL) @@ -652,7 +652,7 @@ void Workspace::removeUnmanaged(Unmanaged* c) assert(unmanaged.contains(c)); unmanaged.removeAll(c); emit unmanagedRemoved(c); - x_stacking_dirty = true; + markXStackingOrderAsDirty(); } void Workspace::addDeleted(Deleted* c, Toplevel *orig) @@ -671,7 +671,7 @@ void Workspace::addDeleted(Deleted* c, Toplevel *orig) } else { stacking_order.append(c); } - x_stacking_dirty = true; + markXStackingOrderAsDirty(); connect(c, SIGNAL(needsRepaint()), m_compositor, SLOT(scheduleRepaint())); } @@ -682,7 +682,7 @@ void Workspace::removeDeleted(Deleted* c) deleted.removeAll(c); unconstrained_stacking_order.removeAll(c); stacking_order.removeAll(c); - x_stacking_dirty = true; + markXStackingOrderAsDirty(); if (c->wasClient() && m_compositor) { m_compositor->updateCompositeBlocking(); } @@ -1766,5 +1766,10 @@ Toplevel *Workspace::findInternal(QWindow *w) const } } +void Workspace::markXStackingOrderAsDirty() +{ + x_stacking_dirty = true; +} + } // namespace diff --git a/workspace.h b/workspace.h index b390f9614c..b4487dc51e 100644 --- a/workspace.h +++ b/workspace.h @@ -546,6 +546,8 @@ private: static NET::WindowType txtToWindowType(const char* txt); static bool sessionInfoWindowTypeMatch(Client* c, SessionInfo* info); + void markXStackingOrderAsDirty(); + AbstractClient* active_client; AbstractClient* last_active_client; AbstractClient* most_recently_raised; // Used ONLY by raiseOrLowerClient()