commit 8282dc7
chld
·
2026-07-14 01:01:44 +0000 UTC
parent 076492a
implement titles
1 files changed,
+11,
-3
M
xl.c
M
xl.c
+11,
-3
1@@ -79,7 +79,7 @@ int main(int ac, char **av) {
2 if (XQueryPointer(d, r, &w_r, &w_r, &x, &y, &d1, &d2, &m_r)) {
3 }
4
5- XColor col[5];
6+ XColor col[6];
7 for (size_t c = 0; cols[c] != NULL; c++) {
8 XParseColor(d, DefaultColormap(d, s), cols[c], &col[c]);
9 XAllocColor(d, DefaultColormap(d, s), &col[c]);
10@@ -159,6 +159,8 @@ int main(int ac, char **av) {
11 } else {
12 XSetForeground(d, gc, col[1].pixel);
13 }
14+ if(prgs[j][0]=='!')
15+ XSetForeground(d, gc, col[5].pixel);
16
17 XFillRectangle(d, w, gc, 0, (hi * j) / (int)p_i, wi, hi / (int)p_i + 1);
18 }
19@@ -167,7 +169,9 @@ int main(int ac, char **av) {
20 int direction, as, des;
21 XCharStruct ov;
22
23- XTextExtents(font, prgs[i], strlen(prgs[i]), &direction, &as, &des,
24+ XTextExtents(font, (prgs[i][0]=='!') ? prgs[i]+1 : prgs[i],
25+ (prgs[i][0]=='!') ? strlen(prgs[i])-1 : strlen(prgs[i]),
26+ &direction, &as, &des,
27 &ov);
28
29 if (sel == i) {
30@@ -175,11 +179,14 @@ int main(int ac, char **av) {
31 } else {
32 XSetForeground(d, gc, col[2].pixel);
33 }
34+ if(prgs[i][0]=='!')
35+ XSetForeground(d, gc, col[2].pixel);
36
37 if (strcmp(prgs[i], "EMPTY") != 0) {
38 XDrawString(d, w, gc, (wi - ov.width) / 2,
39 (hi * i) / (int)p_i + (hi / (int)p_i + (as + des)) / 2,
40- prgs[i], strlen(prgs[i]));
41+ (prgs[i][0]=='!') ? prgs[i]+1 : prgs[i],
42+ (prgs[i][0]=='!') ? strlen(prgs[i])-1 : strlen(prgs[i]));
43 }
44 }
45 break;
46@@ -190,6 +197,7 @@ int main(int ac, char **av) {
47 break;
48 case ButtonPress:
49 if (strcmp(prgs[sel], "EMPTY") != 0) {
50+ if(prgs[sel][0]=='!') break;
51 printf("%s\n", prgs[sel]);
52 goto q;
53 }