summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/dwm.c b/dwm.c
index 22fbade..cecbe53 100644
--- a/dwm.c
+++ b/dwm.c
@@ -594,24 +594,24 @@ 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;
int i = -1;
char ch;
dwmblockssig = 0;
- while (text[++i]) {
- if ((unsigned char)text[i] < ' ') {
- ch = text[i];
- text[i] = '\0';
- x += TEXTW(text) - lrpad;
- text[i] = ch;
- text += i+1;
- i = -1;
- if (x >= ev->x) break;
- dwmblockssig = ch;
- }
- }
+ while (text[++i]) {
+ if ((unsigned char)text[i] < ' ') {
+ ch = text[i];
+ text[i] = '\0';
+ x += TEXTW(text) - lrpad;
+ text[i] = ch;
+ text += i+1;
+ i = -1;
+ if (x >= ev->x) break;
+ dwmblockssig = ch;
+ }
+ }
} else
click = ClkWinTitle;
} else if ((c = wintoclient(ev->window))) {
@@ -941,24 +941,25 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int indn;
- int x, w, sw = 0, stw = 0;
+ int indn;
+ 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(showsystray && m == systraytomon(m))
- stw = getsystraywidth();
+ 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);
+
for (c = m->clients; c; c = c->next) {
occ |= c->tags;
if (c->isurgent)
@@ -966,17 +967,16 @@ drawbar(Monitor *m)
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
- indn = 0;
+ indn = 0;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
-
- for (c = m->clients; c; c = c->next) {
- if (c->tags & (1 << i)) {
- drw_rect(drw, x, 1 + (indn * 2), selmon->sel == c ? 6 : 1, 1, 1, urg & 1 << i);
- indn++;
- }
- }
+ for (c = m->clients; c; c = c->next) {
+ if (c->tags & (1 << i)) {
+ drw_rect(drw, x, 1 + (indn * 2), selmon->sel == c ? 6 : 1, 1, 1, urg & 1 << i);
+ indn++;
+ }
+ }
x += w;
}
@@ -984,7 +984,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);
@@ -2248,13 +2248,17 @@ tile(Monitor *m)
if (i < m->nmaster) {
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);
- mfacts -= c->cfact;
+ 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);
- sfacts -= c->cfact;
+ if (ty + HEIGHT(c) < m->wh) {
+ ty += HEIGHT(c);
+ sfacts -= c->cfact;
+ }
}
}