Use XCB to query the window tree in xStackingOrder

This commit is contained in:
Martin Gräßlin 2013-08-02 08:42:33 +02:00
parent 635e1243e7
commit 4193b2406f

View file

@ -675,21 +675,18 @@ ToplevelList Workspace::xStackingOrder() const
return x_stacking; return x_stacking;
x_stacking_dirty = false; x_stacking_dirty = false;
x_stacking.clear(); x_stacking.clear();
Window dummy; Xcb::Tree tree(rootWindow());
Window* windows = NULL;
unsigned int count = 0;
XQueryTree(display(), rootWindow(), &dummy, &dummy, &windows, &count);
// use our own stacking order, not the X one, as they may differ // use our own stacking order, not the X one, as they may differ
foreach (Toplevel * c, stacking_order) foreach (Toplevel * c, stacking_order)
x_stacking.append(c); x_stacking.append(c);
xcb_window_t *windows = tree.children();
for (unsigned int i = 0; for (unsigned int i = 0;
i < count; i < tree->children_len;
++i) { ++i) {
if (Unmanaged* c = findUnmanaged(WindowMatchPredicate(windows[ i ]))) if (Unmanaged* c = findUnmanaged(WindowMatchPredicate(windows[ i ])))
x_stacking.append(c); x_stacking.append(c);
} }
if (windows != NULL)
XFree(windows);
if (m_compositor) { if (m_compositor) {
const_cast< Workspace* >(this)->m_compositor->checkUnredirect(); const_cast< Workspace* >(this)->m_compositor->checkUnredirect();
} }