From a7f871dcfb95745da02a8b4f107bd6ebe040c8e6 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 26 Sep 2012 19:12:16 +0200 Subject: [PATCH] wlt: theme: fix calculating window size regarding buttons We need to avoid reducing window size beyond our minimal width used to draw buttons. Signed-off-by: David Herrmann --- src/wlt_theme.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/wlt_theme.c b/src/wlt_theme.c index 96c1caa..c69d889 100644 --- a/src/wlt_theme.c +++ b/src/wlt_theme.c @@ -239,7 +239,9 @@ static void widget_redraw(struct wlt_widget *widget, void *data) width = theme->buffer.width; height = theme->buffer.height; if (width < 2 || - width < 2 * theme->frame_width) { + width < 2 * theme->frame_width || + width < 2 * theme->button_margin + 2 * theme->button_padding + + 3 * theme->button_size) { widget_draw_fallback(theme); } else if (height < theme->control_height + 2 * theme->frame_width) { widget_draw_fallback(theme); @@ -262,6 +264,14 @@ static void widget_prepare_resize(struct wlt_widget *widget, *width = minw; if (*height < minh) *height = minh; + + minw = 2 * theme->button_margin + 2 * theme->button_padding + + 3 * theme->button_size; + minh = theme->button_size + 2 * theme->button_padding; + if (*width < minw) + *width = minw; + if (*height < minh) + *height = minh; } static void widget_resize(struct wlt_widget *widget, struct wlt_rect *alloc,