tag_setncol and tag_setnmaster shouldn't go over the numbers of clients
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
a28f931d08
commit
b7e379c2d0
|
@ -36,6 +36,8 @@ uicb_tag_setnmaster(int screen, char * arg)
|
||||||
{
|
{
|
||||||
Tag **curtags = tags_get_current(screen);
|
Tag **curtags = tags_get_current(screen);
|
||||||
Layout *curlay = curtags[0]->layout;
|
Layout *curlay = curtags[0]->layout;
|
||||||
|
Client *c;
|
||||||
|
int n;
|
||||||
|
|
||||||
if(!arg || (curlay->arrange != layout_tile
|
if(!arg || (curlay->arrange != layout_tile
|
||||||
&& curlay->arrange != layout_tileleft
|
&& curlay->arrange != layout_tileleft
|
||||||
|
@ -46,6 +48,13 @@ uicb_tag_setnmaster(int screen, char * arg)
|
||||||
if((curtags[0]->nmaster = (int) compute_new_value_from_arg(arg, (double) curtags[0]->nmaster)) < 0)
|
if((curtags[0]->nmaster = (int) compute_new_value_from_arg(arg, (double) curtags[0]->nmaster)) < 0)
|
||||||
curtags[0]->nmaster = 0;
|
curtags[0]->nmaster = 0;
|
||||||
|
|
||||||
|
for(n = 0, c = globalconf.clients; c; c = c->next)
|
||||||
|
if(IS_TILED(c, screen))
|
||||||
|
n++;
|
||||||
|
|
||||||
|
if(curtags[0]->nmaster > n - 1)
|
||||||
|
curtags[0]->nmaster = n;
|
||||||
|
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
|
|
||||||
globalconf.screens[screen].need_arrange = True;
|
globalconf.screens[screen].need_arrange = True;
|
||||||
|
@ -56,6 +65,8 @@ uicb_tag_setncol(int screen, char * arg)
|
||||||
{
|
{
|
||||||
Tag **curtags = tags_get_current(screen);
|
Tag **curtags = tags_get_current(screen);
|
||||||
Layout *curlay = curtags[0]->layout;
|
Layout *curlay = curtags[0]->layout;
|
||||||
|
Client *c;
|
||||||
|
int n;
|
||||||
|
|
||||||
if(!arg || (curlay->arrange != layout_tile
|
if(!arg || (curlay->arrange != layout_tile
|
||||||
&& curlay->arrange != layout_tileleft
|
&& curlay->arrange != layout_tileleft
|
||||||
|
@ -63,9 +74,17 @@ uicb_tag_setncol(int screen, char * arg)
|
||||||
&& curlay->arrange != layout_tiletop))
|
&& curlay->arrange != layout_tiletop))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if((curtags[0]->ncol = (int) compute_new_value_from_arg(arg, (double) curtags[0]->ncol)) < 1)
|
if((curtags[0]->ncol = (int) compute_new_value_from_arg(arg, (double) curtags[0]->ncol)) < 1)
|
||||||
curtags[0]->ncol = 1;
|
curtags[0]->ncol = 1;
|
||||||
|
|
||||||
|
for(n = 0, c = globalconf.clients; c; c = c->next)
|
||||||
|
if(IS_TILED(c, screen))
|
||||||
|
n++;
|
||||||
|
|
||||||
|
if(curtags[0]->ncol > n - 1)
|
||||||
|
curtags[0]->ncol = n - 1;
|
||||||
|
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
|
|
||||||
globalconf.screens[screen].need_arrange = True;
|
globalconf.screens[screen].need_arrange = True;
|
||||||
|
|
Loading…
Reference in New Issue