Permalink
Browse files

resize master size in px values

  • Loading branch information...
c00kiemon5ter committed Apr 8, 2012
1 parent 2b01087 commit d053c33a202d914ca685771216ad9d58a4113c5c
Showing with 9 additions and 10 deletions.
  1. +4 −4 config.def.h
  2. +5 −6 monsterwm.c
View
@@ -53,10 +53,10 @@ static key keys[] = {
{ MOD1|SHIFT, XK_c, killclient, {NULL}},
{ MOD1, XK_j, next_win, {NULL}},
{ MOD1, XK_k, prev_win, {NULL}},
- { MOD1, XK_h, resize_master, {.i = -1}}, /* decrease */
- { MOD1, XK_l, resize_master, {.i = +1}}, /* increase */
- { MOD1, XK_o, resize_stack, {.i = -10}}, /* shrink */
- { MOD1, XK_p, resize_stack, {.i = +10}}, /* grow */
+ { MOD1, XK_h, resize_master, {.i = -10}}, /* decrease size in px */
+ { MOD1, XK_l, resize_master, {.i = +10}}, /* increase size in px */
+ { MOD1, XK_o, resize_stack, {.i = -10}}, /* shrink size in px */
+ { MOD1, XK_p, resize_stack, {.i = +10}}, /* grow size in px */
{ MOD1|CONTROL, XK_h, rotate, {.i = -1}},
{ MOD1|CONTROL, XK_l, rotate, {.i = +1}},
{ MOD1|SHIFT, XK_h, rotate_filled, {.i = -1}},
View
@@ -162,8 +162,7 @@ static int xerrorstart();
static Bool running = True, showpanel = SHOW_PANEL;
static int previous_desktop = 0, current_desktop = 0, retval = 0;
-static int screen, wh, ww, mode = DEFAULT_MODE, growth = 0;
-static float master_size = MASTER_SIZE;
+static int screen, wh, ww, mode = DEFAULT_MODE, master_size = 0, growth = 0;
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0, win_unfocus, win_focus;
static Display *dis;
@@ -675,9 +674,9 @@ void removeclient(client *c) {
* the size of a window can't be less than MINWSZ
*/
void resize_master(const Arg *arg) {
- float msz = master_size + ((float)arg->i / 100);
- if (msz > 0.95 || msz < 0.05) return;
- master_size = msz;
+ int msz = (mode == BSTACK ? wh:ww) * MASTER_SIZE + master_size + arg->i;
+ if (msz < MINWSZ || (mode == BSTACK ? wh:ww) - msz < MINWSZ) return;
+ master_size += arg->i;
tile();
}
@@ -806,7 +805,7 @@ void spawn(const Arg *arg) {
/* arrange windows in normal or bottom stack tile */
void stack(int hh, int cy) {
client *c = NULL, *t = NULL; Bool b = mode == BSTACK;
- int n = 0, d = 0, z = b ? ww:hh, ma = (mode == BSTACK ? wh:ww) * master_size;
+ int n = 0, d = 0, z = b ? ww:hh, ma = (mode == BSTACK ? wh:ww) * MASTER_SIZE + master_size;
/* count stack windows and grab first non-floating, non-fullscreen window */
for (t = head; t; t=t->next) if (!ISFFT(t)) { if (c) ++n; else c = t; }

0 comments on commit d053c33

Please sign in to comment.