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 <dh.herrmann@googlemail.com>
This commit is contained in:
parent
f9de068a09
commit
a7f871dcfb
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user