change incnmaster to setnmaster

This commit is contained in:
Julien Danjou 2007-09-11 15:53:03 +02:00
parent eb1759f28f
commit 6085246aa8
3 changed files with 13 additions and 10 deletions

View File

@ -93,7 +93,7 @@ static const NameFuncLink KeyfuncList[] = {
{"zoom", uicb_zoom},
/* layouts/tile.c */
{"setmwfact", uicb_setmwfact},
{"incnmaster", uicb_incnmaster},
{"setnmaster", uicb_setnmaster},
/* awesome.c */
{"quit", uicb_quit},
{NULL, NULL}

View File

@ -12,28 +12,31 @@ extern Client *sel, *clients;
/* static */
static double mwfact = 0.6;
static void _tile(awesome_config *, const Bool); /* arranges all windows tiled */
static double mwfact = 0.6;
static int nmaster = 2;
void
uicb_incnmaster(Display *disp,
uicb_setnmaster(Display *disp,
awesome_config *awesomeconf,
const char * arg)
{
int i;
int delta;
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
return;
if(!arg)
nmaster = awesomeconf->nmaster;
else
else if(sscanf(arg, "%d", &delta))
{
i = strtol(arg, (char **) NULL, 10);
if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * awesomeconf->borderpx)
if((arg[0] == '+' || arg[0] == '-')
&& !((nmaster + delta) < 1 || wah / (nmaster + delta) <= 2 * awesomeconf->borderpx))
nmaster += delta;
else if(delta >= 1 && wah / delta <= 2 * awesomeconf->borderpx)
nmaster = delta;
else
return;
nmaster += i;
}
if(sel)
arrange(disp, awesomeconf);
@ -54,7 +57,7 @@ uicb_setmwfact(Display *disp,
/* arg handling, manipulate mwfact */
if(!arg)
mwfact = awesomeconf->mwfact;
else if(1 == sscanf(arg, "%lf", &delta))
else if(sscanf(arg, "%lf", &delta))
{
if(arg[0] != '+' && arg[0] != '-')
mwfact = delta;

View File

@ -5,7 +5,7 @@
#include <config.h>
void uicb_incnmaster(Display *, awesome_config *, const char *); /* change number of master windows */
void uicb_setnmaster(Display *, awesome_config *, const char *); /* change number of master windows */
void uicb_setmwfact(Display *, awesome_config *, const char *); /* sets master width factor */
void tile(Display *, awesome_config *);
void tileleft(Display *, awesome_config *);