diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/comet.c | 1 | ||||
| -rw-r--r-- | src/draw.c | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/comet.c b/src/comet.c index 019444a..75175e5 100644 --- a/src/comet.c +++ b/src/comet.c @@ -354,7 +354,6 @@ int main(int argc, char **argv) State *state; } menu_ctx = { (gpointer)group, {"", ""}, NULL, state }; - // XXX: If the alignment of the group and menu button are not equal something strange happens Button *menu = button_simple_create(PANGO_ALIGN_LEFT, color); button_simple_set_text(menu, g_strdup(menu_ctx.strings[0]), text_color); button_simple_set_action(menu, menu_action, &menu_ctx); @@ -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; } |
