- if (!raised && self->layer != old)
- if (orig->frame) { /* only restack if the original window is managed */
+ /* restack. but only if the original window is managed.
+
+ raised is used so that only the bottom-most window in the stacking
+ order is raised, the others will automatically come with it.
+
+ also only the highest windows in the stacking order (no transients)
+ are lowered, cuz the rest come for free
+ */
+ if (!raised && orig->frame) {
+ if (self->layer > old) {
+ stacking_remove(CLIENT_AS_WINDOW(self));
+ stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
+ } else if (self->layer < old && self->transients == NULL) {