-
Notifications
You must be signed in to change notification settings - Fork 0
/
dwm.c.rej
110 lines (107 loc) · 3.82 KB
/
dwm.c.rej
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
diff a/dwm.c b/dwm.c (rejected hunks)
@@ -430,25 +443,29 @@
focus(NULL);
}
if (ev->window == selmon->barwin) {
- i = x = 0;
- do
- x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
- if (i < LENGTH(tags)) {
- click = ClkTagBar;
- arg.ui = 1 << i;
- } else if (ev->x < x + blw)
- click = ClkLtSymbol;
- else if (ev->x > selmon->ww - TEXTW(stext))
- click = ClkStatusText;
- else
- click = ClkWinTitle;
+ if (ev->x < ble - blw) {
+ i = -1, x = -ev->x;
+ do
+ x += TEXTW(tags[++i]);
+ while (x <= 0);
+ click = ClkTagBar;
+ arg.ui = 1 << i;
+ } else if (ev->x < ble)
+ click = ClkLtSymbol;
+ else if (ev->x < selmon->ww - wstext)
+ click = ClkWinTitle;
+ else if ((x = selmon->ww - RSPAD - ev->x) > 0 && (x -= wstext - LSPAD - RSPAD) <= 0) {
+ updatedwmblockssig(x);
+ click = ClkStatusText;
+ } else
+ return;
} else if ((c = wintoclient(ev->window))) {
focus(c);
restack(selmon);
XAllowEvents(dpy, ReplayPointer, CurrentTime);
click = ClkClientWin;
- }
+ } else
+ click = ClkRootWin;
for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
@@ -695,7 +712,7 @@
void
drawbar(Monitor *m)
{
- int x, w, sw = 0;
+ int x, w;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -703,9 +720,32 @@
/* 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; /* 2px right padding */
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
+ char *stc = stextc;
+ char *stp = stextc;
+ char tmp;
+
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ x = m->ww - wstext;
+ drw_rect(drw, x, 0, LSPAD, bh, 1, 1); x += LSPAD; /* to keep left padding clean */
+ for (;;) {
+ if ((unsigned char)*stc >= ' ') {
+ stc++;
+ continue;
+ }
+ tmp = *stc;
+ if (stp != stc) {
+ *stc = '\0';
+ x = drw_text(drw, x, 0, TTEXTW(stp), bh, 0, stp, 0);
+ }
+ if (tmp == '\0')
+ break;
+ if (tmp - DELIMITERENDCHAR - 1 < LENGTH(colors))
+ drw_setscheme(drw, scheme[tmp - DELIMITERENDCHAR - 1]);
+ *stc = tmp;
+ stp = ++stc;
+ }
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, x, 0, m->ww - x, bh, 1, 1); /* to keep right padding clean */
}
for (c = m->clients; c; c = c->next) {
@@ -724,11 +764,17 @@
urg & 1 << i);
x += w;
}
- w = blw = TEXTW(m->ltsymbol);
+ w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
- if ((w = m->ww - sw - x) > bh) {
+ if (m == selmon) {
+ blw = w, ble = x;
+ w = m->ww - wstext - x;
+ } else
+ w = m->ww - x;
+
+ if (w > 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);