From f1233a641de98452c2d961190097f651fed7de3a Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 23 Sep 2020 02:00:18 +0200 Subject: [PATCH] Clean Workspace::updateXStackingOrder() No need to create x_stacing by iterating over stacking_order, it can be copied. We are not performing any operations over it. Also no need to instanciate the tree until we want to use it. --- layers.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/layers.cpp b/layers.cpp index ed12b52232..b8c3aca127 100644 --- a/layers.cpp +++ b/layers.cpp @@ -723,13 +723,11 @@ QList Workspace::xStackingOrder() const void Workspace::updateXStackingOrder() { - x_stacking.clear(); - std::unique_ptr tree{std::move(m_xStackingQueryTree)}; // use our own stacking order, not the X one, as they may differ - foreach (Toplevel * c, stacking_order) - x_stacking.append(c); + x_stacking = stacking_order; - if (tree && !tree->isNull()) { + if (m_xStackingQueryTree && !m_xStackingQueryTree->isNull()) { + std::unique_ptr tree{std::move(m_xStackingQueryTree)}; xcb_window_t *windows = tree->children(); const auto count = tree->data()->children_len; int foundUnmanagedCount = unmanaged.count();