Changed bar->bar to bar->widget

This commit is contained in:
Kris Maglione 2006-06-22 03:38:42 -04:00
parent 50bed8e056
commit 7d74df656f
4 changed files with 26 additions and 26 deletions

View File

@ -27,9 +27,9 @@ create_bar(Bar **b_link, char *name)
b->id = id++;
cext_strlcpy(b->name, name, sizeof(b->name));
b->bar = blitz_create_input(barpmap, bargc, &def.font);
b->bar->color = def.normcolor;
b->bar->align = CENTER;
b->widget = blitz_create_input(barpmap, bargc, &def.font);
b->widget->color = def.normcolor;
b->widget->align = CENTER;
for(i=b_link; *i; i=&(*i)->next)
if(strcmp((*i)->name, name) >= 0)
@ -48,9 +48,9 @@ destroy_bar(Bar **b_link, Bar *b)
*p = b->next;
b->next = free_bars;
if(b->bar->text)
free(b->bar->text);
blitz_destroy_input(b->bar);
if(b->widget->text)
free(b->widget->text);
blitz_destroy_input(b->widget);
free_bars = b;
}
@ -102,13 +102,13 @@ draw_bar()
for(b=lbar, nb=2 ;nb; --nb && (b = rbar))
for(; b && (w < brect.width); b=b->next, size++) {
b->bar->rect.x = 0;
b->bar->rect.y = 0;
b->bar->rect.width = brect.height;
if(b->bar->text && strlen(b->bar->text))
b->bar->rect.width += blitz_textwidth(b->bar->font, b->bar->text);
b->bar->rect.height = brect.height;
w += b->bar->rect.width;
b->widget->rect.x = 0;
b->widget->rect.y = 0;
b->widget->rect.width = brect.height;
if(b->widget->text && strlen(b->widget->text))
b->widget->rect.width += blitz_textwidth(b->widget->font, b->widget->text);
b->widget->rect.height = brect.height;
w += b->widget->rect.width;
}
if(b) { /* give all bars same width */
@ -119,24 +119,24 @@ draw_bar()
w = brect.width / size;
for(b = lbar, nb=2 ;nb; b = rbar, nb--) {
for(; b; b=b->next) {
b->bar->rect.x = i * w;
b->bar->rect.width = w;
b->widget->rect.x = i * w;
b->widget->rect.width = w;
}
}
}
else { /* expand rbar properly */
if(rbar)
rbar->bar->rect.width += (brect.width - w);
rbar->widget->rect.width += (brect.width - w);
for(b=lbar, nb=2 ;nb--; b = rbar)
for(; b; prev = b, b=b->next)
if(prev) b->bar->rect.x = prev->bar->rect.x + prev->bar->rect.width;
if(prev) b->widget->rect.x = prev->widget->rect.x + prev->widget->rect.width;
}
for(b=lbar, nb=2 ;nb; b=rbar, nb--)
for(; b; b=b->next) {
if(b == rbar)
b->bar->align = EAST;
blitz_draw_input(b->bar);
b->widget->align = EAST;
blitz_draw_input(b->widget);
}
MapBar:
XCopyArea(dpy, barpmap, barwin, bargc, 0, 0, brect.width, brect.height, 0, 0);

View File

@ -74,14 +74,14 @@ handle_buttonrelease(XEvent *e)
static char buf[32];
if(ev->window == barwin) {
for(b=lbar; b; b=b->next)
if(ispointinrect(ev->x, ev->y, &b->bar->rect)) {
if(ispointinrect(ev->x, ev->y, &b->widget->rect)) {
snprintf(buf, sizeof(buf), "LeftBarClick %s %d\n",
b->name, ev->button);
write_event(buf);
return;
}
for(b=rbar; b; b=b->next)
if(ispointinrect(ev->x, ev->y, &b->bar->rect)) {
if(ispointinrect(ev->x, ev->y, &b->widget->rect)) {
snprintf(buf, sizeof(buf), "RightBarClick %s %d\n",
b->name, ev->button);
write_event(buf);

View File

@ -825,12 +825,12 @@ fs_clunk(Req *r) {
case FsFBar:
buf = f->bar->buf;
i = strlen(f->bar->buf);
parse_colors(&buf, &i, &f->bar->bar->color);
parse_colors(&buf, &i, &f->bar->widget->color);
while(buf[i - 1] == '\n')
buf[--i] = '\0';
if(f->bar->bar->text)
free(f->bar->bar->text);
f->bar->bar->text = strdup(buf);
if(f->bar->widget->text)
free(f->bar->widget->text);
f->bar->widget->text = strdup(buf);
draw_bar();
break;
case FsFEvent:

View File

@ -128,7 +128,7 @@ struct Bar {
char buf[280];
char name[256];
unsigned short id;
BlitzWidget *bar;
BlitzWidget *widget;
};
typedef struct Rule Rule;