From 44cb73e94a3b98513cdd56044cd2394e89b0e4b6 Mon Sep 17 00:00:00 2001 From: Felix Kratz Date: Wed, 5 Apr 2023 19:58:09 +0200 Subject: [PATCH] respect bracket paddings --- src/bar.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/bar.c b/src/bar.c index afb660f..ca2508c 100644 --- a/src/bar.c +++ b/src/bar.c @@ -251,17 +251,28 @@ static void bar_calculate_bounds_top_bottom(struct bar* bar) { next_position = &bar_center_left_first_item_x, rtl = true; else continue; + int group_padding_left = 0; + int group_padding_right = 0; + + if (bar_item->group && (bar_item->group->first_item == bar_item)) + group_padding_left = bar_item->group->members[0]->background.padding_left; + + if (bar_item->group && (bar_item->group->last_item == bar_item)) + group_padding_right = bar_item->group->members[0]->background.padding_right; + if (bar_item->position == POSITION_RIGHT || bar_item->position == POSITION_CENTER_LEFT) { *next_position = min(*next_position - bar_item_display_length - - bar_item->background.padding_right, + - bar_item->background.padding_right + - group_padding_right, bar->window.frame.size.width - bar_item_display_length ); } else { *next_position += max((int)-*next_position, - bar_item->background.padding_left); + bar_item->background.padding_left + + group_padding_left ); } bar_item->graph.rtl = rtl; @@ -291,14 +302,18 @@ static void bar_calculate_bounds_top_bottom(struct bar* bar) { *next_position += bar_item->has_const_width ? bar_item_display_length + bar_item->background.padding_right + + group_padding_right - bar_item->custom_width - : - bar_item->background.padding_left; + : (- bar_item->background.padding_left + - group_padding_left ); } else { *next_position += bar_item->has_const_width ? bar_item->custom_width - bar_item->background.padding_left + - group_padding_left : (bar_item_length - + bar_item->background.padding_right); + + bar_item->background.padding_right + + group_padding_right ); } }