comparison draw.c @ 4:a54de16f8277

fix taskbar behavior when exceeding MAX_TASKS; bound moveresize() to windowarea
author paulo@localhost
date Fri, 24 Apr 2009 01:34:17 -0700
parents 7024076fa948
children
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]) {