* See LICENSE file for license details.
*/
#include "dwm.h"
-
#include <stdio.h>
#include <string.h>
#include <X11/Xlocale.h>
}
static unsigned int
-textnw(char *text, unsigned int len)
+textnw(const char *text, unsigned int len)
{
XRectangle r;
{
Client *c;
- for(c = clients; c; c = getnext(c->next, tsel))
+ for(c = clients; c; c = getnext(c->next))
drawtitle(c);
drawstatus();
}
void
drawstatus()
{
- int i;
+ int i, x;
Bool istile = arrange == dotile;
dc.x = dc.y = 0;
drawtext(NULL, !istile, False);
dc.w = 0;
- for(i = 0; i < TLast; i++) {
+ for(i = 0; i < ntags; i++) {
dc.x += dc.w;
dc.w = textw(tags[i]);
if(istile)
else
drawtext(tags[i], (i != tsel), True);
}
- if(sel) {
- dc.x += dc.w;
- dc.w = textw(sel->name);
- drawtext(sel->name, istile, True);
- }
+ x = dc.x + dc.w;
dc.w = textw(stext);
dc.x = bx + bw - dc.w;
drawtext(stext, !istile, False);
-
+ if(sel && ((dc.w = dc.x - x) >= bh)) {
+ dc.x = x;
+ drawtext(sel->name, istile, True);
+ }
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XSync(dpy, False);
}
dc.x = dc.y = 0;
dc.w = 0;
- for(i = 0; i < TLast; i++) {
+ for(i = 0; i < ntags; i++) {
if(c->tags[i]) {
dc.x += dc.w;
- dc.w = textw(c->tags[i]);
- drawtext(c->tags[i], !istile, True);
+ dc.w = textw(tags[i]);
+ drawtext(tags[i], !istile, True);
}
}
dc.x += dc.w;
}
unsigned int
-textw(char *text)
+textw(const char *text)
{
return textnw(text, strlen(text)) + dc.font.height;
}