diff --git a/deleted.cpp b/deleted.cpp index 7515d2e81c..c4ad95bcce 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -52,7 +52,7 @@ Deleted* Deleted::create(Toplevel* c) { Deleted* d = new Deleted(c->workspace()); d->copyToDeleted(c); - d->workspace()->addDeleted(d, Allowed); + d->workspace()->addDeleted(d, c, Allowed); return d; } diff --git a/layers.cpp b/layers.cpp index 549f40eb5e..589c940be5 100644 --- a/layers.cpp +++ b/layers.cpp @@ -705,9 +705,6 @@ ToplevelList Workspace::xStackingOrder() const if (Unmanaged* c = findUnmanaged(WindowMatchPredicate(windows[ i ]))) x_stacking.append(c); } - // TODO: remove after stacking_order contains Deleted - foreach (Deleted * c, deleted) - x_stacking.append(c); if (windows != NULL) XFree(windows); const_cast< Workspace* >(this)->checkUnredirect(); diff --git a/workspace.cpp b/workspace.cpp index 214aae975a..d313d6a6d3 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -645,8 +645,6 @@ void Workspace::removeClient(Client* c, allowed_t) // TODO: if marked client is removed, notify the marked list clients.removeAll(c); desktops.removeAll(c); - unconstrained_stacking_order.removeAll(c); - stacking_order.removeAll(c); x_stacking_dirty = true; for (int i = 1; i <= numberOfDesktops(); ++i) focus_chain[i].removeAll(c); @@ -687,10 +685,22 @@ void Workspace::removeUnmanaged(Unmanaged* c, allowed_t) x_stacking_dirty = true; } -void Workspace::addDeleted(Deleted* c, allowed_t) +void Workspace::addDeleted(Deleted* c, Toplevel *orig, allowed_t) { assert(!deleted.contains(c)); deleted.append(c); + const int unconstraintedIndex = unconstrained_stacking_order.indexOf(orig); + if (unconstraintedIndex != -1) { + unconstrained_stacking_order.replace(unconstraintedIndex, c); + } else { + unconstrained_stacking_order.append(c); + } + const int index = stacking_order.indexOf(orig); + if (index != -1) { + stacking_order.replace(index, c); + } else { + stacking_order.append(c); + } x_stacking_dirty = true; } @@ -701,6 +711,8 @@ void Workspace::removeDeleted(Deleted* c, allowed_t) scene->windowDeleted(c); emit deletedRemoved(c); deleted.removeAll(c); + unconstrained_stacking_order.removeAll(c); + stacking_order.removeAll(c); x_stacking_dirty = true; } diff --git a/workspace.h b/workspace.h index d2c3d8cd86..40b4edb413 100644 --- a/workspace.h +++ b/workspace.h @@ -481,7 +481,7 @@ public: void removeUnmanaged(Unmanaged*, allowed_t); // Only called from Unmanaged::release() void removeDeleted(Deleted*, allowed_t); - void addDeleted(Deleted*, allowed_t); + void addDeleted(Deleted*, Toplevel*, allowed_t); bool checkStartupNotification(Window w, KStartupInfoId& id, KStartupInfoData& data);