comparison draw.c @ 5:e060ab82b136

gapless grid
author paulo@thepaulopc
date Wed, 27 Jan 2010 23:28:29 -0800
parents 7024076fa948
children 0968b3739b8d
comparison
equal deleted inserted replaced
0:5739fa29b644 1:97968aa783cf
78 dc.w = sw - x; 78 dc.w = sw - x;
79 } 79 }
80 drawtext(stext, dc.norm); 80 drawtext(stext, dc.norm);
81 if((dc.w = dc.x - x) > bh) { 81 if((dc.w = dc.x - x) > bh) {
82 dc.x = x; 82 dc.x = x;
83 drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm);
84 }
85 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
86
87 if (TASKBAR) {
88 dc.x = dc.y = 0;
89 dc.w = sw;
83 for(j=0, c = clients; c; c = c->next) { 90 for(j=0, c = clients; c; c = c->next) {
84 if(isvisible(c)) 91 if(isvisible(c))
85 j++; 92 j++;
86 } 93 }
87 if(j && j < MAX_TASKS) 94 if(j && j < MAX_TASKS)
88 dc.w /= j; 95 dc.w /= j;
89 else { 96 else
90 drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm); 97 drawtext("", dc.norm);
91 j = 0; 98 for(c = clients; j && c && dc.x < sw; c = c->next) {
92 }
93 for(c = clients; j && c; c = c->next) {
94 if(isvisible(c)) { 99 if(isvisible(c)) {
95 drawtext(c->name, (c == sel) ? dc.sel : dc.norm); 100 drawtext(c->name, (c == sel) ? dc.sel : dc.norm);
96 dc.x += dc.w; 101 dc.x += dc.w;
97 j--; 102 j--;
98 } 103 }
99 } 104 }
105 XCopyArea(dpy, dc.drawable, tbarwin, dc.gc, 0, 0, sw, bh, 0, 0);
100 } 106 }
101 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0); 107
102 XSync(dpy, False); 108 XSync(dpy, False);
103 } 109 }
104 110
105 void 111 void
106 drawtext(const char *text, unsigned long col[ColLast]) { 112 drawtext(const char *text, unsigned long col[ColLast]) {