Rename Workspace::restack() function
There are several ways how a window can be restacked relative to another: either by placing it below the reference window or above the reference window. Currently, the restack() function places the given window below the refererence window. But it's hard to decipher from the name, one needs to take a look at the argument names to understand what's going on. Another reason to rename is that it could be useful to have a stackAbove() function to make X11Window::restackWindow() implementation simpler and more straightforward.
This commit is contained in:
parent
4bc74d6831
commit
e022bd7141
4 changed files with 14 additions and 14 deletions
|
@ -445,32 +445,32 @@ void Workspace::lowerWindowRequest(Window *window)
|
||||||
lowerWindowWithinApplication(window);
|
lowerWindowWithinApplication(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::restack(Window *window, Window *under, bool force)
|
void Workspace::stackBelow(Window *window, Window *reference, bool force)
|
||||||
{
|
{
|
||||||
if (window->isDeleted()) {
|
if (window->isDeleted()) {
|
||||||
qCWarning(KWIN_CORE) << "Workspace::restack: closed window" << window << "cannot be restacked";
|
qCWarning(KWIN_CORE) << "Workspace::stackBelow: closed window" << window << "cannot be restacked";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!force && !Window::belongToSameApplication(under, window)) {
|
if (!force && !Window::belongToSameApplication(reference, window)) {
|
||||||
// put in the stacking order below _all_ windows belonging to the active application
|
// put in the stacking order below _all_ windows belonging to the active application
|
||||||
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) {
|
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) {
|
||||||
auto other = unconstrained_stacking_order.at(i);
|
auto other = unconstrained_stacking_order.at(i);
|
||||||
if (other->isClient() && other->layer() == window->layer() && Window::belongToSameApplication(under, other)) {
|
if (other->isClient() && other->layer() == window->layer() && Window::belongToSameApplication(reference, other)) {
|
||||||
under = other;
|
reference = other;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(unconstrained_stacking_order.contains(under));
|
Q_ASSERT(unconstrained_stacking_order.contains(reference));
|
||||||
if (under == window) {
|
if (reference == window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unconstrained_stacking_order.removeAll(window);
|
unconstrained_stacking_order.removeAll(window);
|
||||||
unconstrained_stacking_order.insert(unconstrained_stacking_order.indexOf(under), window);
|
unconstrained_stacking_order.insert(unconstrained_stacking_order.indexOf(reference), window);
|
||||||
|
|
||||||
m_focusChain->moveAfterWindow(window, under);
|
m_focusChain->moveAfterWindow(window, reference);
|
||||||
updateStackingOrder();
|
updateStackingOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ void Workspace::restackWindowUnderActive(Window *window)
|
||||||
raiseWindow(window);
|
raiseWindow(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
restack(window, m_activeWindow);
|
stackBelow(window, m_activeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KWIN_BUILD_X11
|
#if KWIN_BUILD_X11
|
||||||
|
|
|
@ -226,7 +226,7 @@ void TabBoxHandlerImpl::raiseClient(Window *c) const
|
||||||
|
|
||||||
void TabBoxHandlerImpl::restack(Window *c, Window *under)
|
void TabBoxHandlerImpl::restack(Window *c, Window *under)
|
||||||
{
|
{
|
||||||
Workspace::self()->restack(c, under, true);
|
Workspace::self()->stackBelow(c, under, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBoxHandlerImpl::elevateClient(Window *c, QWindow *tabbox, bool b) const
|
void TabBoxHandlerImpl::elevateClient(Window *c, QWindow *tabbox, bool b) const
|
||||||
|
|
|
@ -235,7 +235,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
void lowerWindowRequest(Window *window);
|
void lowerWindowRequest(Window *window);
|
||||||
void restackWindowUnderActive(Window *window);
|
void restackWindowUnderActive(Window *window);
|
||||||
void restack(Window *window, Window *under, bool force = false);
|
void stackBelow(Window *window, Window *reference, bool force = false);
|
||||||
void raiseOrLowerWindow(Window *window);
|
void raiseOrLowerWindow(Window *window);
|
||||||
void updateStackingOrder(bool propagate_new_windows = false);
|
void updateStackingOrder(bool propagate_new_windows = false);
|
||||||
void forceRestacking();
|
void forceRestacking();
|
||||||
|
|
|
@ -1738,7 +1738,7 @@ void X11Window::doSetShade(ShadeMode previousShadeMode)
|
||||||
shade_geometry_change = false;
|
shade_geometry_change = false;
|
||||||
if (previousShadeMode == ShadeHover) {
|
if (previousShadeMode == ShadeHover) {
|
||||||
if (shade_below && workspace()->stackingOrder().indexOf(shade_below) > -1) {
|
if (shade_below && workspace()->stackingOrder().indexOf(shade_below) > -1) {
|
||||||
workspace()->restack(this, shade_below, true);
|
workspace()->stackBelow(this, shade_below, true);
|
||||||
}
|
}
|
||||||
if (isActive()) {
|
if (isActive()) {
|
||||||
workspace()->activateNextWindow(this);
|
workspace()->activateNextWindow(this);
|
||||||
|
@ -5503,7 +5503,7 @@ void X11Window::restackWindow(xcb_window_t above, int detail, NET::RequestSource
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other) {
|
if (other) {
|
||||||
workspace()->restack(this, other);
|
workspace()->stackBelow(this, other);
|
||||||
} else if (detail == XCB_STACK_MODE_BELOW) {
|
} else if (detail == XCB_STACK_MODE_BELOW) {
|
||||||
workspace()->lowerWindowRequest(this, src, timestamp);
|
workspace()->lowerWindowRequest(this, src, timestamp);
|
||||||
} else if (detail == XCB_STACK_MODE_ABOVE) {
|
} else if (detail == XCB_STACK_MODE_ABOVE) {
|
||||||
|
|
Loading…
Reference in a new issue