Don't return -1 from render_horizontal_item - wmenu - 🔧 fork of wmenu
(HTM) git clone git@git.drkhsh.at/wmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 086211c83c6f9110512d32633290d0a93401411a
(DIR) parent e23e2154719f07a8b052669a75ca239850fd3b1f
(HTM) Author: adnano <me@adnano.co>
Date: Mon, 26 Feb 2024 14:29:53 -0500
Don't return -1 from render_horizontal_item
Diffstat:
M main.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
---
(DIR) diff --git a/main.c b/main.c
@@ -215,21 +215,17 @@ 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);
int text_y = (state->line_height / 2.0) - (text_height / 2.0);
- if (x + left_padding + text_width > width) {
- return -1;
- } else {
- if (background) {
- int bg_width = text_width + left_padding + right_padding;
- cairo_set_source_u32(cairo, background);
- cairo_rectangle(cairo, x, y, bg_width, height);
- cairo_fill(cairo);
- }
-
- cairo_move_to(cairo, x + left_padding, y + text_y);
- cairo_set_source_u32(cairo, foreground);
- pango_printf(cairo, state->font, 1, str);
+ if (background) {
+ int bg_width = text_width + left_padding + right_padding;
+ cairo_set_source_u32(cairo, background);
+ cairo_rectangle(cairo, x, y, bg_width, height);
+ cairo_fill(cairo);
}
+ cairo_move_to(cairo, x + left_padding, y + text_y);
+ cairo_set_source_u32(cairo, foreground);
+ pango_printf(cairo, state->font, 1, str);
+
return x + text_width + left_padding + right_padding;
}