Fix small edge cases
Fix case where only windows available are sticky Fix case where stack is empty sometimes segfaulting
This commit is contained in:
parent
125a12548f
commit
7e843c47ba
1 changed files with 7 additions and 2 deletions
9
dwm.c
9
dwm.c
|
@ -951,8 +951,13 @@ expose(XEvent *e)
|
||||||
void
|
void
|
||||||
focus(Client *c)
|
focus(Client *c)
|
||||||
{
|
{
|
||||||
if (!c || !ISVISIBLE(c))
|
if (!c || !ISVISIBLE(c)) {
|
||||||
for (c = selmon->stack; c && (!ISVISIBLE(c) || c->issticky); c = c->snext);
|
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)
|
if (selmon->sel && selmon->sel != c)
|
||||||
unfocus(selmon->sel, 0);
|
unfocus(selmon->sel, 0);
|
||||||
if (c) {
|
if (c) {
|
||||||
|
|
Loading…
Reference in a new issue