Use for range based loop in X11Window::restackWindow() when traversing through stack
It's more readable and it also makes code more refactorable. For example, if somebody makes Workspace::stackingOrder() return a normal QList, KWin won't crash at this code.
This commit is contained in:
parent
0622526e8f
commit
d56dbb04e6
1 changed files with 4 additions and 6 deletions
|
@ -5443,17 +5443,15 @@ void X11Window::restackWindow(xcb_window_t above, int detail, NET::RequestSource
|
||||||
workspace()->raiseOrLowerWindow(this);
|
workspace()->raiseOrLowerWindow(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto it = workspace()->stackingOrder().constBegin(),
|
const auto stack = workspace()->stackingOrder();
|
||||||
end = workspace()->stackingOrder().constEnd();
|
for (Window *window : stack) {
|
||||||
while (it != end) {
|
if (window == this) {
|
||||||
if (*it == this) {
|
|
||||||
detail = XCB_STACK_MODE_ABOVE;
|
detail = XCB_STACK_MODE_ABOVE;
|
||||||
break;
|
break;
|
||||||
} else if (*it == other) {
|
} else if (window == other) {
|
||||||
detail = XCB_STACK_MODE_BELOW;
|
detail = XCB_STACK_MODE_BELOW;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
} else if (detail == XCB_STACK_MODE_TOP_IF) {
|
} else if (detail == XCB_STACK_MODE_TOP_IF) {
|
||||||
if (other && other->frameGeometry().intersects(frameGeometry())) {
|
if (other && other->frameGeometry().intersects(frameGeometry())) {
|
||||||
|
|
Loading…
Reference in a new issue