diff --git a/widgets/progressbar.c b/widgets/progressbar.c index 1e707dd23..159653f35 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -541,7 +541,8 @@ luaA_progressbar_bar_data_add(lua_State *L) if(!bar) bar = progressbar_bar_add(d, title); - bar->value = MAX(bar->min_value, MIN(bar->max_value, luaL_checknumber(L, 3))); + bar->value = luaL_checknumber(L, 3); + bar->value = MAX(bar->min_value, MIN(bar->max_value, bar->value)); widget_invalidate_bywidget(*widget); diff --git a/widgets/textbox.c b/widgets/textbox.c index e342713f4..006965be7 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -58,10 +58,10 @@ textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)), else { draw_parser_data_init(&pdata); - w->area.width = MIN(draw_text_extents(ctx->connection, - ctx->phys_screen, - globalconf.font, d->text, &pdata).width, - ctx->width - used); + w->area.width = draw_text_extents(ctx->connection, ctx->phys_screen, + globalconf.font, d->text, &pdata).width; + if(w->area.width > ctx->width - used) + 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);