set widget->width to the right size(TM)

This commit is contained in:
Julien Danjou 2008-01-03 19:06:44 +01:00
parent 62d5711a7e
commit 33cd7c261f
1 changed files with 6 additions and 0 deletions

View File

@ -40,7 +40,10 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
NetWMIcon *icon; NetWMIcon *icon;
if(!sel) if(!sel)
{
widget->width = 0;
return 0; return 0;
}
for(r = globalconf.rules; r; r = r->next) for(r = globalconf.rules; r; r = r->next)
if(r->icon && client_match_rule(sel, r)) if(r->icon && client_match_rule(sel, r))
@ -58,7 +61,10 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
if(!(icon = ewmh_get_window_icon(sel->win))) if(!(icon = ewmh_get_window_icon(sel->win)))
{
widget->width = 0;
return 0; return 0;
}
widget->width = ((double) widget->statusbar->height / (double) icon->height) * icon->width; widget->width = ((double) widget->statusbar->height / (double) icon->height) * icon->width;