Don't return -1 from render_horizontal_item

This commit is contained in:
adnano 2024-02-26 14:29:53 -05:00
parent e23e215471
commit 086211c83c

4
main.c
View file

@ -215,9 +215,6 @@ static int render_horizontal_item(struct menu_state *state, cairo_t *cairo, cons
get_text_size(cairo, state->font, &text_width, &text_height, NULL, 1, str); get_text_size(cairo, state->font, &text_width, &text_height, NULL, 1, str);
int text_y = (state->line_height / 2.0) - (text_height / 2.0); int text_y = (state->line_height / 2.0) - (text_height / 2.0);
if (x + left_padding + text_width > width) {
return -1;
} else {
if (background) { if (background) {
int bg_width = text_width + left_padding + right_padding; int bg_width = text_width + left_padding + right_padding;
cairo_set_source_u32(cairo, background); cairo_set_source_u32(cairo, background);
@ -228,7 +225,6 @@ static int render_horizontal_item(struct menu_state *state, cairo_t *cairo, cons
cairo_move_to(cairo, x + left_padding, y + text_y); cairo_move_to(cairo, x + left_padding, y + text_y);
cairo_set_source_u32(cairo, foreground); cairo_set_source_u32(cairo, foreground);
pango_printf(cairo, state->font, 1, str); pango_printf(cairo, state->font, 1, str);
}
return x + text_width + left_padding + right_padding; return x + text_width + left_padding + right_padding;
} }