Use master area factor from unit
This commit is contained in:
parent
d5eba48b36
commit
20c9e8927e
38
src/dwm.c
38
src/dwm.c
|
@ -146,7 +146,6 @@ struct Monitor {
|
|||
Unit unit;
|
||||
Pertag *pertag;
|
||||
char ltsymbol[16];
|
||||
float mfact;
|
||||
int nmaster;
|
||||
int num;
|
||||
int by; /* bar geometry */
|
||||
|
@ -165,6 +164,7 @@ struct Monitor {
|
|||
|
||||
// actual state
|
||||
bool show_bar;
|
||||
float mfact;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -187,7 +187,6 @@ struct Pertag {
|
|||
Unit units[TAGS_COUNT + 1];
|
||||
unsigned int curtag, prevtag; /* current and previous tag */
|
||||
int nmasters[TAGS_COUNT + 1]; /* number of windows in master area */
|
||||
float mfacts[TAGS_COUNT + 1]; /* mfacts per tag */
|
||||
unsigned int sellts[TAGS_COUNT + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[TAGS_COUNT + 1][2]; /* matrix of tags and layouts indexes */
|
||||
};
|
||||
|
@ -706,7 +705,6 @@ createmon(void)
|
|||
}
|
||||
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
m->mfact = settings_get_default_master_area_factor();
|
||||
m->nmaster = settings_get_default_clients_in_master();
|
||||
m->topbar = topbar;
|
||||
m->lt[0] = &layouts[0];
|
||||
|
@ -734,7 +732,6 @@ createmon(void)
|
|||
}
|
||||
|
||||
m->pertag->nmasters[i] = m->nmaster;
|
||||
m->pertag->mfacts[i] = m->mfact;
|
||||
|
||||
m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
|
@ -743,6 +740,7 @@ createmon(void)
|
|||
|
||||
// actual state
|
||||
m->show_bar = unit_get_show_bar(m->pertag->units[m->pertag->curtag]);
|
||||
m->mfact = unit_get_master_area_factor(m->pertag->units[m->pertag->curtag]);
|
||||
|
||||
return m;
|
||||
|
||||
|
@ -1721,18 +1719,16 @@ setlayout(const Arg *arg)
|
|||
}
|
||||
}
|
||||
|
||||
/* arg > 1.0 will set mfact absolutely */
|
||||
void
|
||||
setmfact(const Arg *arg)
|
||||
{
|
||||
float f;
|
||||
if (!arg) return;
|
||||
|
||||
unit_inc_master_area_factor(
|
||||
selmon->pertag->units[selmon->pertag->curtag],
|
||||
arg->f
|
||||
);
|
||||
|
||||
if (!arg || !selmon->lt[selmon->sellt]->arrange)
|
||||
return;
|
||||
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
|
||||
if (f < 0.05 || f > 0.95)
|
||||
return;
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -1978,12 +1974,14 @@ toggleview(const Arg *arg)
|
|||
}
|
||||
|
||||
/* apply settings for this view */
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
|
||||
// TODO: maybe also set selmon->show_bar here to fix issue #7?
|
||||
selmon->mfact = unit_get_master_area_factor(selmon->pertag->units[selmon->pertag->curtag]);
|
||||
|
||||
if (selmon->show_bar !=
|
||||
unit_get_show_bar(selmon->pertag->units[selmon->pertag->curtag]))
|
||||
{
|
||||
|
@ -2328,11 +2326,13 @@ view(const Arg *arg)
|
|||
}
|
||||
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
// TODO: maybe also set selmon->show_bar here to fix issue #7?
|
||||
selmon->mfact = unit_get_master_area_factor(selmon->pertag->units[selmon->pertag->curtag]);
|
||||
|
||||
if (selmon->show_bar !=
|
||||
unit_get_show_bar(selmon->pertag->units[selmon->pertag->curtag]))
|
||||
{
|
||||
|
@ -2373,11 +2373,13 @@ viewrel(const Arg *arg)
|
|||
}
|
||||
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
// TODO: maybe also set selmon->show_bar here to fix issue #7?
|
||||
selmon->mfact = unit_get_master_area_factor(selmon->pertag->units[selmon->pertag->curtag]);
|
||||
|
||||
if (selmon->show_bar !=
|
||||
unit_get_show_bar(selmon->pertag->units[selmon->pertag->curtag]))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue