font: remove 4px padding on the right

Added `menu.items.padding.x` padding between item text and arrow instead.

Replaced `if (!string)` with `if (string_null_or_empty(string))` in
`font_extents()` just as a minor optimization.
This commit is contained in:
tokyo4j 2025-09-21 20:40:49 +09:00 committed by Johan Malm
parent 141f932efa
commit ebce406b11
3 changed files with 6 additions and 11 deletions

View file

@ -22,7 +22,7 @@ static PangoRectangle
font_extents(struct font *font, const char *string)
{
PangoRectangle rect = { 0 };
if (!string) {
if (string_null_or_empty(string)) {
return rect;
}
cairo_surface_t *surface;
@ -43,10 +43,6 @@ font_extents(struct font *font, const char *string)
pango_layout_get_extents(layout, NULL, &rect);
pango_extents_to_pixels(&rect, NULL);
/* we put a 2 px edge on each side - because Openbox does it :) */
/* TODO: remove the 4 pixel addition and always do the padding by the caller */
rect.width += 4;
cairo_destroy(c);
cairo_surface_destroy(surface);
pango_font_description_free(desc);