Xinqi Bao's Git
projects
/
dwm.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
c2784e4
)
Gottox' drawtext simplification
author
Anselm R Garbe <
[email protected]
>
Sun, 1 Jun 2008 10:58:19 +0000
(11:58 +0100)
committer
Anselm R Garbe <
[email protected]
>
Sun, 1 Jun 2008 10:58:19 +0000
(11:58 +0100)
config.def.h
patch
|
blob
|
history
dwm.c
patch
|
blob
|
history
diff --git
a/config.def.h
b/config.def.h
index
b18af75
..
83a8c18
100644
(file)
--- a/
config.def.h
+++ b/
config.def.h
@@
-24,7
+24,7
@@
Rule rules[] = {
/* layout(s) */
double mfact = 0.55;
/* layout(s) */
double mfact = 0.55;
-Bool resizehints =
Tru
e; /* False means respect size hints in tiled resizals */
+Bool resizehints =
Fals
e; /* False means respect size hints in tiled resizals */
Layout layouts[] = {
/* symbol arrange function */
Layout layouts[] = {
/* symbol arrange function */
diff --git
a/dwm.c
b/dwm.c
index
4d4c769
..
3b6efaa
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-571,14
+571,8
@@
drawtext(const char *text, ulong col[ColLast], Bool invert) {
for(; len && (w = textnw(buf, len)) > dc.w - h; len--);
if(!len)
return;
for(; len && (w = textnw(buf, len)) > dc.w - h; len--);
if(!len)
return;
- if(len < olen) {
- if(len > 1)
- buf[len - 1] = '.';
- if(len > 2)
- buf[len - 2] = '.';
- if(len > 3)
- buf[len - 3] = '.';
- }
+ if(len < olen)
+ strncpy(&buf[MAX(0, len - 3)], "...", len);
XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
if(dc.font.set)
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
if(dc.font.set)
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);