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}, {"zoom", uicb_zoom},
/* layouts/tile.c */ /* layouts/tile.c */
{"setmwfact", uicb_setmwfact}, {"setmwfact", uicb_setmwfact},
{"incnmaster", uicb_incnmaster}, {"setnmaster", uicb_setnmaster},
/* awesome.c */ /* awesome.c */
{"quit", uicb_quit}, {"quit", uicb_quit},
{NULL, NULL} {NULL, NULL}

View File

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

View File

@ -5,7 +5,7 @@
#include <config.h> #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 uicb_setmwfact(Display *, awesome_config *, const char *); /* sets master width factor */
void tile(Display *, awesome_config *); void tile(Display *, awesome_config *);
void tileleft(Display *, awesome_config *); void tileleft(Display *, awesome_config *);