| layers.cpp | layers.cpp | |||
|---|---|---|---|---|
| skipping to change at line 87 | skipping to change at line 87 | |||
| #include "unmanaged.h" | #include "unmanaged.h" | |||
| #include "utils/common.h" | #include "utils/common.h" | |||
| #include "virtualdesktops.h" | #include "virtualdesktops.h" | |||
| #include "wayland_server.h" | #include "wayland_server.h" | |||
| #include "workspace.h" | #include "workspace.h" | |||
| #include "x11window.h" | #include "x11window.h" | |||
| #include <array> | #include <array> | |||
| #include <QDebug> | #include <QDebug> | |||
| #include <QQueue> | ||||
| namespace KWin | namespace KWin | |||
| { | { | |||
| //******************************* | //******************************* | |||
| // Workspace | // Workspace | |||
| //******************************* | //******************************* | |||
| void Workspace::updateStackingOrder(bool propagate_new_windows) | void Workspace::updateStackingOrder(bool propagate_new_windows) | |||
| { | { | |||
| skipping to change at line 555 | skipping to change at line 554 | |||
| } | } | |||
| QList<Window *> stacking; | QList<Window *> stacking; | |||
| stacking.reserve(unconstrained_stacking_order.count()); | stacking.reserve(unconstrained_stacking_order.count()); | |||
| for (uint layer = FirstLayer; layer < NumLayers; ++layer) { | for (uint layer = FirstLayer; layer < NumLayers; ++layer) { | |||
| stacking += windows[layer]; | stacking += windows[layer]; | |||
| } | } | |||
| // Apply the stacking order constraints. First, we enqueue the root con straints, i.e. | // Apply the stacking order constraints. First, we enqueue the root con straints, i.e. | |||
| // the ones that are not affected by other constraints. | // the ones that are not affected by other constraints. | |||
| QQueue<Constraint *> constraints; | QList<Constraint *> constraints; | |||
| constraints.reserve(m_constraints.count()); | constraints.reserve(m_constraints.count()); | |||
| for (Constraint *constraint : std::as_const(m_constraints)) { | for (Constraint *constraint : std::as_const(m_constraints)) { | |||
| if (constraint->parents.isEmpty()) { | if (constraint->parents.isEmpty()) { | |||
| constraint->enqueued = true; | constraint->enqueued = true; | |||
| constraints.enqueue(constraint); | constraints.append(constraint); | |||
| } else { | } else { | |||
| constraint->enqueued = false; | constraint->enqueued = false; | |||
| } | } | |||
| } | } | |||
| // Preserve the relative order of transient siblings in the unconstrain | ||||
| ed stacking order. | ||||
| auto constraintComparator = [&stacking](Constraint *a, Constraint *b) { | ||||
| return stacking.indexOf(a->above) > stacking.indexOf(b->above); | ||||
| }; | ||||
| std::sort(constraints.begin(), constraints.end(), constraintComparator) | ||||
| ; | ||||
| // Once we've enqueued all the root constraints, we traverse the constr aints tree in | // Once we've enqueued all the root constraints, we traverse the constr aints tree in | |||
| // the breadth-first search fashion. A constraint is applied only if it s condition is | // the reverse breadth-first search fashion. A constraint is applied on ly if its condition is | |||
| // not met. | // not met. | |||
| while (!constraints.isEmpty()) { | while (!constraints.isEmpty()) { | |||
| Constraint *constraint = constraints.dequeue(); | Constraint *constraint = constraints.takeFirst(); | |||
| const int belowIndex = stacking.indexOf(constraint->below); | const int belowIndex = stacking.indexOf(constraint->below); | |||
| const int aboveIndex = stacking.indexOf(constraint->above); | const int aboveIndex = stacking.indexOf(constraint->above); | |||
| if (belowIndex == -1 || aboveIndex == -1) { | if (belowIndex == -1 || aboveIndex == -1) { | |||
| continue; | continue; | |||
| } else if (aboveIndex < belowIndex) { | } else if (aboveIndex < belowIndex) { | |||
| stacking.removeAt(aboveIndex); | stacking.removeAt(aboveIndex); | |||
| stacking.insert(belowIndex, constraint->above); | stacking.insert(belowIndex, constraint->above); | |||
| } | } | |||
| for (Constraint *child : std::as_const(constraint->children)) { | // Preserve the relative order of transient siblings in the unconst | |||
| rained stacking order. | ||||
| QList<Constraint *> children = constraint->children; | ||||
| std::sort(children.begin(), children.end(), constraintComparator); | ||||
| for (Constraint *child : std::as_const(children)) { | ||||
| if (!child->enqueued) { | if (!child->enqueued) { | |||
| child->enqueued = true; | child->enqueued = true; | |||
| constraints.enqueue(child); | constraints.append(child); | |||
| } | } | |||
| } | } | |||
| } | } | |||
| return stacking; | return stacking; | |||
| } | } | |||
| void Workspace::blockStackingUpdates(bool block) | void Workspace::blockStackingUpdates(bool block) | |||
| { | { | |||
| if (block) { | if (block) { | |||
| End of changes. 8 change blocks. | ||||
| 7 lines changed or deleted | 19 lines changed or added | |||
| This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||