summaryrefslogtreecommitdiffhomepage
path: root/dwm.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-01-18 11:08:34 +0100
committerbakkeby <[email protected]>2022-02-11 11:43:35 +0100
commit5c80a54b623a72b0855a9d46575565cc446f3bd6 (patch)
tree77cf50e8b407bbce4538539807049c57986364e4 /dwm.c
parentb17ea8e2de2846b4a2dd8593cf181275854577a7 (diff)
downloaddwm-flexipatch-5c80a54b623a72b0855a9d46575565cc446f3bd6.tar.gz
dwm-flexipatch-5c80a54b623a72b0855a9d46575565cc446f3bd6.zip
Refactoring restack to allow it to work without having the bar as a reference ref. #214
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index 803f77a..03ea7c3 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;
}