Re-arrange code in X11Window::restackWindow()
Above and Below modes should be handled as follows: if (sibling) { workspace_stack_below/above(window, sibling); } else { workspace_lower/raise(window); } But with the current code, it's difficult to see. This change rearranges the code in the restackWindow() so it's more clear how the Above and the Below modes are implemented. It also moves workspace()->findClient(Predicate::WindowMatch, above); to the top because all branches have it.
This commit is contained in:
parent
e022bd7141
commit
b6c1f7fb51
1 changed files with 30 additions and 31 deletions
|
@ -5437,9 +5437,8 @@ bool X11Window::allowWindowActivation(xcb_timestamp_t time, bool focus_in)
|
||||||
|
|
||||||
void X11Window::restackWindow(xcb_window_t above, int detail, NET::RequestSource src, xcb_timestamp_t timestamp, bool send_event)
|
void X11Window::restackWindow(xcb_window_t above, int detail, NET::RequestSource src, xcb_timestamp_t timestamp, bool send_event)
|
||||||
{
|
{
|
||||||
X11Window *other = nullptr;
|
X11Window *other = workspace()->findClient(Predicate::WindowMatch, above);
|
||||||
if (detail == XCB_STACK_MODE_OPPOSITE) {
|
if (detail == XCB_STACK_MODE_OPPOSITE) {
|
||||||
other = workspace()->findClient(Predicate::WindowMatch, above);
|
|
||||||
if (!other) {
|
if (!other) {
|
||||||
workspace()->raiseOrLowerWindow(this);
|
workspace()->raiseOrLowerWindow(this);
|
||||||
return;
|
return;
|
||||||
|
@ -5457,24 +5456,19 @@ void X11Window::restackWindow(xcb_window_t above, int detail, NET::RequestSource
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
} else if (detail == XCB_STACK_MODE_TOP_IF) {
|
} else if (detail == XCB_STACK_MODE_TOP_IF) {
|
||||||
other = workspace()->findClient(Predicate::WindowMatch, above);
|
|
||||||
if (other && other->frameGeometry().intersects(frameGeometry())) {
|
if (other && other->frameGeometry().intersects(frameGeometry())) {
|
||||||
workspace()->raiseWindowRequest(this, src, timestamp);
|
workspace()->raiseWindowRequest(this, src, timestamp);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (detail == XCB_STACK_MODE_BOTTOM_IF) {
|
} else if (detail == XCB_STACK_MODE_BOTTOM_IF) {
|
||||||
other = workspace()->findClient(Predicate::WindowMatch, above);
|
|
||||||
if (other && other->frameGeometry().intersects(frameGeometry())) {
|
if (other && other->frameGeometry().intersects(frameGeometry())) {
|
||||||
workspace()->lowerWindowRequest(this, src, timestamp);
|
workspace()->lowerWindowRequest(this, src, timestamp);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!other) {
|
if (detail == XCB_STACK_MODE_ABOVE) {
|
||||||
other = workspace()->findClient(Predicate::WindowMatch, above);
|
if (other) {
|
||||||
}
|
|
||||||
|
|
||||||
if (other && detail == XCB_STACK_MODE_ABOVE) {
|
|
||||||
auto it = workspace()->stackingOrder().constEnd(),
|
auto it = workspace()->stackingOrder().constEnd(),
|
||||||
begin = workspace()->stackingOrder().constBegin();
|
begin = workspace()->stackingOrder().constBegin();
|
||||||
while (--it != begin) {
|
while (--it != begin) {
|
||||||
|
@ -5504,11 +5498,16 @@ void X11Window::restackWindow(xcb_window_t above, int detail, NET::RequestSource
|
||||||
|
|
||||||
if (other) {
|
if (other) {
|
||||||
workspace()->stackBelow(this, other);
|
workspace()->stackBelow(this, other);
|
||||||
} else if (detail == XCB_STACK_MODE_BELOW) {
|
} else {
|
||||||
workspace()->lowerWindowRequest(this, src, timestamp);
|
|
||||||
} else if (detail == XCB_STACK_MODE_ABOVE) {
|
|
||||||
workspace()->raiseWindowRequest(this, src, timestamp);
|
workspace()->raiseWindowRequest(this, src, timestamp);
|
||||||
}
|
}
|
||||||
|
} else if (detail == XCB_STACK_MODE_BELOW) {
|
||||||
|
if (other) {
|
||||||
|
workspace()->stackBelow(this, other);
|
||||||
|
} else {
|
||||||
|
workspace()->lowerWindowRequest(this, src, timestamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (send_event) {
|
if (send_event) {
|
||||||
sendSyntheticConfigureNotify();
|
sendSyntheticConfigureNotify();
|
||||||
|
|
Loading…
Reference in a new issue