summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-01-18 11:08:34 +0100
committerbakkeby <[email protected]>2022-01-18 11:08:34 +0100
commite6dc6a30167818f6254e98a6d7a8f9762c0c9d59 (patch)
tree82ff809ac45da1f97ffbe1bb64f03d85c79064cc
parent489ac300925d156cbcc3b814234021e07e5b8e05 (diff)
downloaddwm-flexipatch-e6dc6a30167818f6254e98a6d7a8f9762c0c9d59.tar.gz
dwm-flexipatch-e6dc6a30167818f6254e98a6d7a8f9762c0c9d59.zip
Refactoring restack to allow it to work without having the bar as a reference ref. #214
-rw-r--r--dwm.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index c27f65c..3e52255 100644
--- a/dwm.c
+++ b/dwm.c
@@ -3000,7 +3000,7 @@ resizemouse(const Arg *arg)
void
restack(Monitor *m)
{
- Client *c;
+ Client *c, *f = NULL;
XEvent ev;
XWindowChanges wc;
#if WARP_PATCH && FLEXTILE_DELUXE_LAYOUT
@@ -3015,11 +3015,17 @@ restack(Monitor *m)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win);
- if (m->lt[m->sellt]->arrange && m->bar) {
+ if (m->lt[m->sellt]->arrange) {
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)
- if (!c->isfloating && ISVISIBLE(c)) {
+ if (!c->isfloating && ISVISIBLE(c) && c != f) {
XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
wc.sibling = c->win;
}