Compute style when we need to.

This commit is contained in:
Julien Danjou 2008-03-16 09:57:44 +01:00
parent cf58c338e4
commit 403d7e89f9
1 changed files with 3 additions and 3 deletions

View File

@ -145,14 +145,13 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
for(b = widget->buttons; b; b = b->next) for(b = widget->buttons; b; b = b->next)
if(ev->button == b->button && CLEANMASK(ev->state) == b->mod && b->func) if(ev->button == b->button && CLEANMASK(ev->state) == b->mod && b->func)
{
style = taglist_style_get(vscreen, tag);
switch(widget->statusbar->position) switch(widget->statusbar->position)
{ {
case Top: case Top:
case Bottom: case Bottom:
for(tag = vscreen.tags; tag; tag = tag->next, i++) for(tag = vscreen.tags; tag; tag = tag->next, i++)
{ {
style = taglist_style_get(vscreen, tag);
width = draw_textwidth(globalconf.display, style.font, tag->name) width = draw_textwidth(globalconf.display, style.font, tag->name)
+ style.font->height; + style.font->height;
if(ev->x >= widget->area.x + prev_width if(ev->x >= widget->area.x + prev_width
@ -168,6 +167,7 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
case Right: case Right:
for(tag = vscreen.tags; tag; tag = tag->next, i++) for(tag = vscreen.tags; tag; tag = tag->next, i++)
{ {
style = taglist_style_get(vscreen, tag);
width = draw_textwidth(globalconf.display, style.font, tag->name) + style.font->height; width = draw_textwidth(globalconf.display, style.font, tag->name) + style.font->height;
if(ev->y >= widget->area.x + prev_width if(ev->y >= widget->area.x + prev_width
&& ev->y < widget->area.x + prev_width + width) && ev->y < widget->area.x + prev_width + width)
@ -182,6 +182,7 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
default: default:
for(tag = vscreen.tags; tag; tag = tag->next, i++) for(tag = vscreen.tags; tag; tag = tag->next, i++)
{ {
style = taglist_style_get(vscreen, tag);
width = draw_textwidth(globalconf.display, style.font, tag->name) + style.font->height; width = draw_textwidth(globalconf.display, style.font, tag->name) + style.font->height;
if(widget->statusbar->width - ev->y >= widget->area.x + prev_width if(widget->statusbar->width - ev->y >= widget->area.x + prev_width
&& widget->statusbar->width - ev->y < widget->area.x + prev_width + width) && widget->statusbar->width - ev->y < widget->area.x + prev_width + width)
@ -194,7 +195,6 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
} }
break; break;
} }
}
} }
Widget * Widget *