summaryrefslogtreecommitdiffstats
path: root/draw.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@10kloc.org>2006-10-06 11:50:15 +0200
committerAnselm R. Garbe <arg@10kloc.org>2006-10-06 11:50:15 +0200
commit6651dd7fd9e8e95cfc6c472f1adfeff41735d798 (patch)
tree2ba87a8d0df487298c1507de1ec4b26867e0dd19 /draw.c
parentyet another small fix and simplification of dotile (diff)
downloaddwm-6651dd7fd9e8e95cfc6c472f1adfeff41735d798.tar.gz
dwm-6651dd7fd9e8e95cfc6c472f1adfeff41735d798.zip
code polishing, removed unnecessary newlines
Diffstat (limited to '')
-rw-r--r--draw.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/draw.c b/draw.c
index c5cd35b..178f1d2 100644
--- a/draw.c
+++ b/draw.c
@@ -1,5 +1,4 @@
1/* 1/* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
2 * (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details. 2 * See LICENSE file for license details.
4 */ 3 */
5#include "dwm.h" 4#include "dwm.h"
@@ -30,21 +29,17 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
30 29
31 XSetForeground(dpy, dc.gc, col[ColBG]); 30 XSetForeground(dpy, dc.gc, col[ColBG]);
32 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 31 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
33
34 if(!text) 32 if(!text)
35 return; 33 return;
36
37 w = 0; 34 w = 0;
38 olen = len = strlen(text); 35 olen = len = strlen(text);
39 if(len >= sizeof(buf)) 36 if(len >= sizeof(buf))
40 len = sizeof(buf) - 1; 37 len = sizeof(buf) - 1;
41 memcpy(buf, text, len); 38 memcpy(buf, text, len);
42 buf[len] = 0; 39 buf[len] = 0;
43
44 h = dc.font.ascent + dc.font.descent; 40 h = dc.font.ascent + dc.font.descent;
45 y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; 41 y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
46 x = dc.x + (h / 2); 42 x = dc.x + (h / 2);
47
48 /* shorten text if necessary */ 43 /* shorten text if necessary */
49 while(len && (w = textnw(buf, len)) > dc.w - h) 44 while(len && (w = textnw(buf, len)) > dc.w - h)
50 buf[--len] = 0; 45 buf[--len] = 0;
@@ -56,7 +51,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
56 if(len > 3) 51 if(len > 3)
57 buf[len - 3] = '.'; 52 buf[len - 3] = '.';
58 } 53 }
59
60 if(w > dc.w) 54 if(w > dc.w)
61 return; /* too long */ 55 return; /* too long */
62 gcv.foreground = col[ColFG]; 56 gcv.foreground = col[ColFG];
@@ -93,7 +87,6 @@ drawstatus(void) {
93 int i, x; 87 int i, x;
94 88
95 dc.x = dc.y = 0; 89 dc.x = dc.y = 0;
96
97 for(i = 0; i < ntags; i++) { 90 for(i = 0; i < ntags; i++) {
98 dc.w = textw(tags[i]); 91 dc.w = textw(tags[i]);
99 if(seltag[i]) 92 if(seltag[i])
@@ -102,10 +95,8 @@ drawstatus(void) {
102 drawtext(tags[i], dc.norm, sel && sel->tags[i]); 95 drawtext(tags[i], dc.norm, sel && sel->tags[i]);
103 dc.x += dc.w; 96 dc.x += dc.w;
104 } 97 }
105
106 dc.w = bmw; 98 dc.w = bmw;
107 drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False); 99 drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
108
109 x = dc.x + dc.w; 100 x = dc.x + dc.w;
110 dc.w = textw(stext); 101 dc.w = textw(stext);
111 dc.x = bx + bw - dc.w; 102 dc.x = bx + bw - dc.w;
@@ -114,7 +105,6 @@ drawstatus(void) {
114 dc.w = bw - x; 105 dc.w = bw - x;
115 } 106 }
116 drawtext(stext, dc.status, False); 107 drawtext(stext, dc.status, False);
117
118 if((dc.w = dc.x - x) > bh) { 108 if((dc.w = dc.x - x) > bh) {
119 dc.x = x; 109 dc.x = x;
120 if(sel) 110 if(sel)
@@ -134,7 +124,6 @@ drawtitle(Client *c) {
134 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); 124 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
135 return; 125 return;
136 } 126 }
137
138 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); 127 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
139 XMapWindow(dpy, c->twin); 128 XMapWindow(dpy, c->twin);
140 dc.x = dc.y = 0; 129 dc.x = dc.y = 0;
@@ -177,7 +166,6 @@ setfont(const char *fontstr) {
177 XFontSetExtents *font_extents; 166 XFontSetExtents *font_extents;
178 XFontStruct **xfonts; 167 XFontStruct **xfonts;
179 char **font_names; 168 char **font_names;
180
181 dc.font.ascent = dc.font.descent = 0; 169 dc.font.ascent = dc.font.descent = 0;
182 font_extents = XExtentsOfFontSet(dc.font.set); 170 font_extents = XExtentsOfFontSet(dc.font.set);
183 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); 171 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);