diff options
| author | Federico Angelilli <code@fedang.net> | 2024-03-16 18:29:19 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-03-16 18:29:19 +0100 |
| commit | 6913ec943a1c71804ec81a9adbb19cfd899a202d (patch) | |
| tree | 88d166a48eb3adc07280beef3d989f877b6f558a /src/draw.c | |
| parent | e5cf2bb25fdec735240bf7d965db6f6ef694ccc0 (diff) | |
Store alignment correctly in compute_group_layout
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -200,6 +200,7 @@ static GList *compute_group_layout(Drawer *draw, GList *btns, int bx, bool root) GList *layouts = NULL; for (GList *it = btns; it; it = it->next) { Button *btn = it->data; + PangoAlignment align = btn->align; Layout *layout = g_malloc0(sizeof(Layout)); layouts = g_list_prepend(layouts, layout); @@ -216,7 +217,8 @@ retry: ButtonGroup *group = CAST(btn, ButtonGroup); g_assert_nonnull(group->children); - // If there is only one child treat a group like a single button + // NOTE: If a group has only one children treat it as a single button + // As a consequence btn->align can't be trusted if (group->children->next == NULL) { layout->btn = btn = group->children->data; g_assert_true(btn->simple); @@ -254,11 +256,11 @@ retry: bx += layout->width; if (root) { - draw->layout_bx[btn->align] = bx; - draw->layout_end[btn->align] = layouts; + draw->layout_bx[align] = bx; + draw->layout_end[align] = layouts; } - if (it->next != NULL && (!root || CAST(it->next->data, Button)->align == btn->align)) + if (it->next != NULL && (!root || CAST(it->next->data, Button)->align == align)) bx += draw->sep; } |
