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.
This commit is contained in:
Aleix Pol 2020-09-23 02:00:18 +02:00 committed by Aleix Pol Gonzalez
parent 0e05f4e4c2
commit f1233a641d

View file

@ -723,13 +723,11 @@ QList<Toplevel *> Workspace::xStackingOrder() const
void Workspace::updateXStackingOrder()
{
x_stacking.clear();
std::unique_ptr<Xcb::Tree> 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<Xcb::Tree> tree{std::move(m_xStackingQueryTree)};
xcb_window_t *windows = tree->children();
const auto count = tree->data()->children_len;
int foundUnmanagedCount = unmanaged.count();