From 37e8b95ad9e080e3980e54a4b29d143bea4587cc Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 26 Jun 2008 16:53:58 +0200 Subject: [PATCH] widgets: handle image size in text data Signed-off-by: Julien Danjou --- widgets/taglist.c | 5 ++++- widgets/textbox.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/widgets/taglist.c b/widgets/taglist.c index f296b128a..7ae3a6fa8 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -206,7 +206,10 @@ taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w, area = draw_text_extents(ctx->connection, ctx->phys_screen, globalconf.font, text[i], &pdata[i]); - if (data->show_empty || tag->selected || tag_isoccupied(tag)) + if(pdata[i].bg_image) + area.width = MAX(area.width, pdata[i].bg_resize ? w->area.height : pdata[i].bg_image->width); + + if(data->show_empty || tag->selected || tag_isoccupied(tag)) w->area.width += area.width; area_array_append(&tda->areas, area); diff --git a/widgets/textbox.c b/widgets/textbox.c index dd0a853bf..470864541 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -65,6 +65,9 @@ textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)), ctx->phys_screen, globalconf.font, d->text, &pdata).width, ctx->width - used); + if(pdata.bg_image) + w->area.width = MAX(w->area.width, pdata.bg_resize ? w->area.height : pdata.bg_image->width); + pdata_arg = &pdata; }