diff options
author | Ethan Marshall <ethan@ethanjmarshall.co.uk> | 2021-12-05 17:01:20 +0000 |
---|---|---|
committer | Ethan Marshall <ethan@ethanjmarshall.co.uk> | 2021-12-05 17:01:20 +0000 |
commit | 7e843c47ba573ab03a62f06638c297b9da7e5e75 (patch) | |
tree | 7784d5e20d454345c5b37c5f679798062471d5bb /dwm.c | |
parent | 125a12548fec6560579a9586178804ba0cfad2f0 (diff) |
Fix small edge cases
Fix case where only windows available are sticky
Fix case where stack is empty sometimes segfaulting
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -951,8 +951,13 @@ expose(XEvent *e) void focus(Client *c) { - if (!c || !ISVISIBLE(c)) - for (c = selmon->stack; c && (!ISVISIBLE(c) || c->issticky); c = c->snext); + if (!c || !ISVISIBLE(c)) { + for (c = selmon->stack; c && (!ISVISIBLE(c) || (c->issticky && !selmon->sel->issticky)); c = c->snext); + + if (!c) /* No windows found; check for available stickies */ + for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); + } + if (selmon->sel && selmon->sel != c) unfocus(selmon->sel, 0); if (c) { |