20 } |
20 } |
21 return XTextWidth(dc.font.xfont, text, len); |
21 return XTextWidth(dc.font.xfont, text, len); |
22 } |
22 } |
23 |
23 |
24 static void |
24 static void |
25 drawtext(const char *text, Bool invert, Bool underline) |
25 drawtext(const char *text, Bool invert, Bool highlight) |
26 { |
26 { |
27 int x, y, w, h; |
27 int x, y, w, h; |
28 static char buf[256]; |
28 static char buf[256]; |
29 unsigned int len, olen; |
29 unsigned int len, olen; |
30 XGCValues gcv; |
30 XGCValues gcv; |
83 else { |
83 else { |
84 gcv.font = dc.font.xfont->fid; |
84 gcv.font = dc.font.xfont->fid; |
85 XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
85 XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
86 XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
86 XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
87 } |
87 } |
88 if(underline) { |
88 if(highlight) { |
89 points[0].x = dc.x + (h / 2) - 1; |
89 points[0].x = dc.x + 1; |
90 points[0].y = dc.y + dc.h - 3; |
90 points[0].y = dc.y + 1; |
91 points[1].x = dc.w - h + 2; |
91 points[1].x = dc.w - 3; |
92 points[1].y = 0; |
92 points[1].y = 0; |
93 XDrawLines(dpy, dc.drawable, dc.gc, points, 2, CoordModePrevious); |
93 points[2].x = 0; |
|
94 points[2].y = dc.h - 3; |
|
95 points[3].x = -(dc.w - 3); |
|
96 points[3].y = 0; |
|
97 points[4].x = 0; |
|
98 points[4].y = -(dc.h - 3); |
|
99 XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); |
94 } |
100 } |
95 } |
101 } |
96 |
102 |
97 /* extern */ |
103 /* extern */ |
98 |
104 |