diff --git a/src/layers.cpp b/src/layers.cpp index a39a80835f..d5a6faf5c6 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -445,22 +445,12 @@ void Workspace::lowerWindowRequest(Window *window) lowerWindowWithinApplication(window); } -void Workspace::stackBelow(Window *window, Window *reference, bool force) +void Workspace::stackBelow(Window *window, Window *reference) { if (window->isDeleted()) { qCWarning(KWIN_CORE) << "Workspace::stackBelow: closed window" << window << "cannot be restacked"; return; } - if (!force && !Window::belongToSameApplication(reference, window)) { - // put in the stacking order below _all_ windows belonging to the active application - for (int i = 0; i < unconstrained_stacking_order.size(); ++i) { - auto other = unconstrained_stacking_order.at(i); - if (other->isClient() && other->layer() == window->layer() && Window::belongToSameApplication(reference, other)) { - reference = other; - break; - } - } - } Q_ASSERT(unconstrained_stacking_order.contains(reference)); if (reference == window) { @@ -480,7 +470,20 @@ void Workspace::restackWindowUnderActive(Window *window) raiseWindow(window); return; } - stackBelow(window, m_activeWindow); + + Window *reference = m_activeWindow; + if (!Window::belongToSameApplication(reference, window)) { + // put in the stacking order below _all_ windows belonging to the active application + for (int i = 0; i < unconstrained_stacking_order.size(); ++i) { + auto other = unconstrained_stacking_order.at(i); + if (other->isClient() && other->layer() == window->layer() && Window::belongToSameApplication(reference, other)) { + reference = other; + break; + } + } + } + + stackBelow(window, reference); } #if KWIN_BUILD_X11 diff --git a/src/tabbox/tabbox.cpp b/src/tabbox/tabbox.cpp index b5b1475041..24ce6602f6 100644 --- a/src/tabbox/tabbox.cpp +++ b/src/tabbox/tabbox.cpp @@ -226,7 +226,7 @@ void TabBoxHandlerImpl::raiseClient(Window *c) const void TabBoxHandlerImpl::restack(Window *c, Window *under) { - Workspace::self()->stackBelow(c, under, true); + Workspace::self()->stackBelow(c, under); } void TabBoxHandlerImpl::elevateClient(Window *c, QWindow *tabbox, bool b) const diff --git a/src/workspace.h b/src/workspace.h index e2a7ae2893..165001c09d 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -235,7 +235,7 @@ public: #endif void lowerWindowRequest(Window *window); void restackWindowUnderActive(Window *window); - void stackBelow(Window *window, Window *reference, bool force = false); + void stackBelow(Window *window, Window *reference); void raiseOrLowerWindow(Window *window); void updateStackingOrder(bool propagate_new_windows = false); void forceRestacking(); diff --git a/src/x11window.cpp b/src/x11window.cpp index e92d6ad3c1..b4b32dc1ca 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -1738,7 +1738,7 @@ void X11Window::doSetShade(ShadeMode previousShadeMode) shade_geometry_change = false; if (previousShadeMode == ShadeHover) { if (shade_below && workspace()->stackingOrder().indexOf(shade_below) > -1) { - workspace()->stackBelow(this, shade_below, true); + workspace()->stackBelow(this, shade_below); } if (isActive()) { workspace()->activateNextWindow(this);