From 7d8a85532b8ee97af9568443fd97e9701943b225 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sat, 16 Mar 2024 21:11:51 +0100 Subject: Add min and max button width --- src/draw.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/draw.c') diff --git a/src/draw.c b/src/draw.c index 5a43a51..51a8a59 100644 --- a/src/draw.c +++ b/src/draw.c @@ -187,6 +187,15 @@ static void compute_width(Drawer *draw, Window *win) log_debug("Draw context width calculated [width=%d]", draw->width); } +static void layout_check_width(Layout *layout) +{ + if (layout->btn->max_width > 0) + layout->width = MIN(layout->btn->max_width, layout->width); + + if (layout->btn->min_width > 0) + layout->width = MAX(layout->btn->min_width, layout->width); +} + static GList *compute_group_layout(Drawer *draw, GList *btns, int bx, bool root) { GList *layouts = NULL; @@ -242,6 +251,7 @@ retry: // NOTE: We add half a line width on both sides layout->width += layout->line_w; + layout_check_width(layout); // Apply layout_func on the layout ANIMATION(btn, layout, layout); -- cgit v1.2.3