summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/dwm.c b/dwm.c
index 7882132..9d8e65d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -231,7 +231,6 @@ static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
-static void pop(Client *);
static Client *prevtiled(Client *c);
static void propertynotify(XEvent *e);
static void pushdown(const Arg *arg);
@@ -485,7 +484,7 @@ arrange(Monitor *m)
void
arrangemon(Monitor *m)
{
- strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
+ strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol - 1);
if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m);
}
@@ -605,7 +604,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
- else if (ev->x > (x = selmon->ww - TEXTW(stext) + lrpad - getsystraywidth())) {
+ else if (ev->x > (x = selmon->ww - (int)TEXTW(stext) + lrpad - getsystraywidth())) {
click = ClkStatusText;
char *text = rawstext;
@@ -952,20 +951,23 @@ void
drawbar(Monitor *m)
{
int indn;
- int x, w, sw = 0, stw = 0;
+ int x, w, tw = 0, stw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
+ if (!m->showbar)
+ return;
+
if(showsystray && m == systraytomon(m))
stw = getsystraywidth();
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
- sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
+ tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
+ drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
}
resizebarwin(m);
@@ -994,7 +996,7 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
- if ((w = m->ww - sw - stw - x) > bh) {
+ if ((w = m->ww - tw - stw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
@@ -1113,7 +1115,7 @@ focusstack(const Arg *arg)
{
Client *c = NULL, *i;
- if (!selmon->sel)
+ if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
return;
if (arg->i > 0) {
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
@@ -1564,15 +1566,6 @@ nexttiled(Client *c)
return c;
}
-void
-pop(Client *c)
-{
- detach(c);
- attach(c);
- focus(c);
- arrange(c->mon);
-}
-
Client *
prevtiled(Client *c) {
Client *p, *r;
@@ -2051,7 +2044,7 @@ setlayout(const Arg *arg)
selmon->sellt ^= 1;
if (arg && arg->v)
selmon->lt[selmon->sellt] = (Layout *)arg->v;
- strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
+ strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol - 1);
if (selmon->sel)
arrange(selmon);
else
@@ -2084,7 +2077,7 @@ setmfact(const Arg *arg)
if (!arg || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
- if (f < 0.1 || f > 0.9)
+ if (f < 0.05 || f > 0.95)
return;
selmon->mfact = f;
arrange(selmon);
@@ -2306,11 +2299,14 @@ tile(Monitor *m)
h = (m->wh - my) * (c->cfact / mfacts);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
my += HEIGHT(c);
+ if (my + HEIGHT(c) < m->wh)
+ my += HEIGHT(c);
mfacts -= c->cfact;
} else {
h = (m->wh - ty) * (c->cfact / sfacts);
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
- ty += HEIGHT(c);
+ if (ty + HEIGHT(c) < m->wh)
+ ty += HEIGHT(c);
sfacts -= c->cfact;
}
}