diff options
| -rw-r--r-- | config.arg.h | 4 | ||||
| -rw-r--r-- | config.default.h | 4 | ||||
| -rw-r--r-- | tile.c | 16 | ||||
| -rw-r--r-- | tile.h | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/config.arg.h b/config.arg.h index 79bdf78..5cac5b5 100644 --- a/config.arg.h +++ b/config.arg.h | |||
| @@ -48,8 +48,8 @@ Key keys[] = { \ | |||
| 48 | { MODKEY, XK_b, togglebar, NULL }, \ | 48 | { MODKEY, XK_b, togglebar, NULL }, \ |
| 49 | { MODKEY, XK_j, focusnext, NULL }, \ | 49 | { MODKEY, XK_j, focusnext, NULL }, \ |
| 50 | { MODKEY, XK_k, focusprev, NULL }, \ | 50 | { MODKEY, XK_k, focusprev, NULL }, \ |
| 51 | { MODKEY, XK_h, addtomwfact, "-0.05" }, \ | 51 | { MODKEY, XK_h, setmwfact, "-0.05" }, \ |
| 52 | { MODKEY, XK_l, addtomwfact, "0.05" }, \ | 52 | { MODKEY, XK_l, setmwfact, "+0.05" }, \ |
| 53 | { MODKEY, XK_m, togglemax, NULL }, \ | 53 | { MODKEY, XK_m, togglemax, NULL }, \ |
| 54 | { MODKEY, XK_Return, zoom, NULL }, \ | 54 | { MODKEY, XK_Return, zoom, NULL }, \ |
| 55 | { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \ | 55 | { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \ |
diff --git a/config.default.h b/config.default.h index 4e9a16f..dab8cc7 100644 --- a/config.default.h +++ b/config.default.h | |||
| @@ -46,8 +46,8 @@ Key keys[] = { \ | |||
| 46 | { MODKEY, XK_b, togglebar, NULL }, \ | 46 | { MODKEY, XK_b, togglebar, NULL }, \ |
| 47 | { MODKEY, XK_j, focusnext, NULL }, \ | 47 | { MODKEY, XK_j, focusnext, NULL }, \ |
| 48 | { MODKEY, XK_k, focusprev, NULL }, \ | 48 | { MODKEY, XK_k, focusprev, NULL }, \ |
| 49 | { MODKEY, XK_h, addtomwfact, "-0.05" }, \ | 49 | { MODKEY, XK_h, setmwfact, "-0.05" }, \ |
| 50 | { MODKEY, XK_l, addtomwfact, "0.05" }, \ | 50 | { MODKEY, XK_l, setmwfact, "+0.05" }, \ |
| 51 | { MODKEY, XK_m, togglemax, NULL }, \ | 51 | { MODKEY, XK_m, togglemax, NULL }, \ |
| 52 | { MODKEY, XK_Return, zoom, NULL }, \ | 52 | { MODKEY, XK_Return, zoom, NULL }, \ |
| 53 | { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \ | 53 | { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \ |
| @@ -9,18 +9,24 @@ static double mwfact = MWFACT; | |||
| 9 | /* extern */ | 9 | /* extern */ |
| 10 | 10 | ||
| 11 | void | 11 | void |
| 12 | addtomwfact(const char *arg) { | 12 | setmwfact(const char *arg) { |
| 13 | double delta; | 13 | double delta, newfact; |
| 14 | 14 | ||
| 15 | if(!isarrange(tile)) | 15 | if(!isarrange(tile)) |
| 16 | return; | 16 | return; |
| 17 | |||
| 18 | /* arg handling, manipulate mwfact */ | 17 | /* arg handling, manipulate mwfact */ |
| 19 | if(arg == NULL) | 18 | if(arg == NULL) |
| 20 | mwfact = MWFACT; | 19 | mwfact = MWFACT; |
| 21 | else if(1 == sscanf(arg, "%lf", &delta)) { | 20 | else if(1 == sscanf(arg, "%lf", &delta)) { |
| 22 | if(delta + mwfact > 0.1 && delta + mwfact < 0.9) | 21 | if(arg[0] != '+' && arg[0] != '-') |
| 23 | mwfact += delta; | 22 | newfact = delta; |
| 23 | else | ||
| 24 | newfact = mwfact + delta; | ||
| 25 | if(newfact < 0.1) | ||
| 26 | newfact = 0.1; | ||
| 27 | else if(newfact > 0.9) | ||
| 28 | newfact = 0.9; | ||
| 29 | mwfact = newfact; | ||
| 24 | } | 30 | } |
| 25 | arrange(); | 31 | arrange(); |
| 26 | } | 32 | } |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* See LICENSE file for copyright and license details. */ | 1 | /* See LICENSE file for copyright and license details. */ |
| 2 | 2 | ||
| 3 | /* tile.c */ | 3 | /* tile.c */ |
| 4 | void addtomwfact(const char *arg); /* adds arg value [0.1 .. 0.9] to master width factor */ | 4 | void setmwfact(const char *arg); /* sets master width factor */ |
| 5 | void tile(void); /* arranges all windows tiled */ | 5 | void tile(void); /* arranges all windows tiled */ |
| 6 | void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */ | 6 | void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */ |
