diff options
| author | Devin J. Pohly <djpohly@gmail.com> | 2020-07-24 17:35:19 -0400 | 
|---|---|---|
| committer | Devin J. Pohly <djpohly@gmail.com> | 2020-07-24 17:35:19 -0400 | 
| commit | 4bc7f2d8e48e0836bdbc7084cc0d4105991724c7 (patch) | |
| tree | abab6d51454b8d829101e648b324bad8df57059a /dwl.c | |
| parent | a224f26469f49c04f895d65aa8b66c37005f33c9 (diff) | |
remove n counter from zoom(), add comments
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 19 | 
1 files changed, 11 insertions, 8 deletions
| @@ -1640,28 +1640,31 @@ xytomon(double x, double y)  void  zoom(const Arg *arg)  { -	unsigned int n = 0;  	Client *c, *sel = selclient();  	if (!sel || !selmon->lt[selmon->sellt]->arrange || sel->isfloating)  		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)  		if (VISIBLEON(c, selmon) && !c->isfloating) { -			if (++n == 1 && c == sel) -				sel = NULL; -			else if (n == 2) { -				if (!sel) -					sel = c; +			if (c != sel)  				break; -			} +			sel = NULL;  		} -	if (n == 1) +	/* Return if no other tiled window was found */ +	if (&c->link == &clients)  		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_insert(&clients, &sel->link); +  	focusclient(sel, NULL, 1);  	arrange(selmon);  } | 
