Refactoring restack to allow it to work without having the bar as a reference ref. #214

This commit is contained in:
bakkeby 2022-01-18 11:08:34 +01:00
parent 489ac30092
commit e6dc6a3016

14
dwm.c
View File

@ -3000,7 +3000,7 @@ resizemouse(const Arg *arg)
void void
restack(Monitor *m) restack(Monitor *m)
{ {
Client *c; Client *c, *f = NULL;
XEvent ev; XEvent ev;
XWindowChanges wc; XWindowChanges wc;
#if WARP_PATCH && FLEXTILE_DELUXE_LAYOUT #if WARP_PATCH && FLEXTILE_DELUXE_LAYOUT
@ -3015,11 +3015,17 @@ restack(Monitor *m)
return; return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange) if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win); XRaiseWindow(dpy, m->sel->win);
if (m->lt[m->sellt]->arrange && m->bar) { if (m->lt[m->sellt]->arrange) {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = m->bar->win; if (m->bar) {
wc.sibling = m->bar->win;
} else {
for (f = m->stack; f && (f->isfloating || !ISVISIBLE(f)); f = f->snext); // find first tiled stack client
if (f)
wc.sibling = f->win;
}
for (c = m->stack; c; c = c->snext) for (c = m->stack; c; c = c->snext)
if (!c->isfloating && ISVISIBLE(c)) { if (!c->isfloating && ISVISIBLE(c) && c != f) {
XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
wc.sibling = c->win; wc.sibling = c->win;
} }