Skip to content

Commit

Permalink
[Box] When estimating height, set correct width on children
Browse files Browse the repository at this point in the history
Issue: #1943
  • Loading branch information
DaveDavenport committed Feb 15, 2024
1 parent 13c2a61 commit 831bddc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/widgets/box.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static int box_get_desired_height(widget *wid, const int width) {
box *b = (box *)wid;
int spacing = distance_get_pixel(b->spacing, b->type);
int height = 0;
int nw = width - widget_padding_get_padding_width(wid);
if (b->type == ROFI_ORIENTATION_VERTICAL) {
int active_widgets = 0;
for (GList *iter = g_list_first(b->children); iter != NULL;
Expand All @@ -105,7 +106,7 @@ static int box_get_desired_height(widget *wid, const int width) {
continue;
}
active_widgets++;
height += widget_get_desired_height(child, width);
height += widget_get_desired_height(child, nw);
}
if (active_widgets > 0) {
height += (active_widgets - 1) * spacing;
Expand All @@ -117,7 +118,7 @@ static int box_get_desired_height(widget *wid, const int width) {
if (!child->enabled) {
continue;
}
height = MAX(widget_get_desired_height(child, width), height);
height = MAX(widget_get_desired_height(child, nw), height);
}
}
height += widget_padding_get_padding_height(wid);
Expand Down

0 comments on commit 831bddc

Please sign in to comment.