Make Scene::createStackingOrder() more efficient

Currently, there's a separate pass to filter out windows not ready for
compositing or windows that must be invisible. That has two issues: we
could merge that pass with the pass that populates stacking_order and
"windows" can detach.
This commit is contained in:
Vlad Zahorodnii 2022-04-29 11:08:44 +03:00
parent 066ac3200a
commit 106fb66cd0

View file

@ -571,19 +571,15 @@ void Scene::createStackingOrder()
// TODO? This cannot be used so carelessly - needs protections against broken clients, the
// window should not get focus before it's displayed, handle unredirected windows properly and
// so on.
for (Window *win : windows) {
if (!win->readyForPainting()) {
windows.removeAll(win);
for (Window *window : std::as_const(windows)) {
if (!window->readyForPainting()) {
continue;
}
if (!m_filter.filterAcceptsWindow(win)) {
windows.removeAll(win);
if (!m_filter.filterAcceptsWindow(window)) {
continue;
}
}
// TODO: cache the stacking_order in case it has not changed
for (Window *c : std::as_const(windows)) {
Q_ASSERT(c->sceneWindow());
stacking_order.append(c->sceneWindow());
Q_ASSERT(window->sceneWindow());
stacking_order.append(window->sceneWindow());
}
}