From 731b309c8573a18e887e9d9b7b5bff1e372d333b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 29 Jul 2008 15:43:00 +0200 Subject: [PATCH] textbox: fix background size computing Signed-off-by: Julien Danjou --- widgets/textbox.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/widgets/textbox.c b/widgets/textbox.c index bc645e58a..0bb0085cf 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -60,6 +60,7 @@ textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)), else { draw_parser_data_init(&pdata); + pdata_arg = &pdata; w->area.width = draw_text_extents(ctx->connection, ctx->phys_screen, globalconf.font, d->text, d->len, &pdata).width; @@ -67,9 +68,8 @@ textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)), w->area.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; + w->area.width = MAX(w->area.width, + pdata.bg_resize ? ((double) pdata.bg_image->width / (double) pdata.bg_image->height) * w->area.height : pdata.bg_image->width); } w->area.height = ctx->height;