forked from mirror/dwl
remove n counter from zoom(), add comments
This commit is contained in:
parent
a224f26469
commit
4bc7f2d8e4
1 changed files with 11 additions and 8 deletions
19
dwl.c
19
dwl.c
|
@ -1640,28 +1640,31 @@ xytomon(double x, double y)
|
||||||
void
|
void
|
||||||
zoom(const Arg *arg)
|
zoom(const Arg *arg)
|
||||||
{
|
{
|
||||||
unsigned int n = 0;
|
|
||||||
Client *c, *sel = selclient();
|
Client *c, *sel = selclient();
|
||||||
|
|
||||||
if (!sel || !selmon->lt[selmon->sellt]->arrange || sel->isfloating)
|
if (!sel || !selmon->lt[selmon->sellt]->arrange || sel->isfloating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Search for the first tiled window that is not sel, marking sel as
|
||||||
|
* NULL if we pass it along the way */
|
||||||
wl_list_for_each(c, &clients, link)
|
wl_list_for_each(c, &clients, link)
|
||||||
if (VISIBLEON(c, selmon) && !c->isfloating) {
|
if (VISIBLEON(c, selmon) && !c->isfloating) {
|
||||||
if (++n == 1 && c == sel)
|
if (c != sel)
|
||||||
sel = NULL;
|
|
||||||
else if (n == 2) {
|
|
||||||
if (!sel)
|
|
||||||
sel = c;
|
|
||||||
break;
|
break;
|
||||||
}
|
sel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 1)
|
/* Return if no other tiled window was found */
|
||||||
|
if (&c->link == &clients)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* If we passed sel, move c to the front; otherwise, move sel to the
|
||||||
|
* front */
|
||||||
|
if (!sel)
|
||||||
|
sel = c;
|
||||||
wl_list_remove(&sel->link);
|
wl_list_remove(&sel->link);
|
||||||
wl_list_insert(&clients, &sel->link);
|
wl_list_insert(&clients, &sel->link);
|
||||||
|
|
||||||
focusclient(sel, NULL, 1);
|
focusclient(sel, NULL, 1);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue