From 4193b2406f635b79227c49058f43d44ac7d6fe0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 2 Aug 2013 08:42:33 +0200 Subject: [PATCH] Use XCB to query the window tree in xStackingOrder --- layers.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/layers.cpp b/layers.cpp index 18d35a7056..619b1e1efc 100644 --- a/layers.cpp +++ b/layers.cpp @@ -675,21 +675,18 @@ ToplevelList Workspace::xStackingOrder() const return x_stacking; x_stacking_dirty = false; x_stacking.clear(); - Window dummy; - Window* windows = NULL; - unsigned int count = 0; - XQueryTree(display(), rootWindow(), &dummy, &dummy, &windows, &count); + Xcb::Tree tree(rootWindow()); // use our own stacking order, not the X one, as they may differ foreach (Toplevel * c, stacking_order) x_stacking.append(c); + + xcb_window_t *windows = tree.children(); for (unsigned int i = 0; - i < count; + i < tree->children_len; ++i) { if (Unmanaged* c = findUnmanaged(WindowMatchPredicate(windows[ i ]))) x_stacking.append(c); } - if (windows != NULL) - XFree(windows); if (m_compositor) { const_cast< Workspace* >(this)->m_compositor->checkUnredirect(); }