From 1ddfa6343a0d8386cff9063b497f3b661c5be65b Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Wed, 18 Jan 2023 16:08:19 -0500 Subject: [PATCH] Fix margins and clean up stdout --- bar/bar.c | 11 +++++------ bar/wayland.c | 4 ++-- particles/string.c | 6 ++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/bar/bar.c b/bar/bar.c index d763cc3..50f1b6f 100644 --- a/bar/bar.c +++ b/bar/bar.c @@ -289,29 +289,28 @@ expose(const struct bar *_bar) int top_height, center_height, bottom_height; calculate_heights(bar, &top_height, ¢er_height, &bottom_height); - LOG_INFO("Widths: %d %d %d", top_height, center_height, bottom_height); bool virt = is_vertical(_bar); - int y = bar->border.top_width + bar->border.top_margin; + int y = bar->border.top_width + bar->top_margin; int x = bar->border.left_width + bar->left_margin; bar_expose_section(&bar->left, bar, pix, x, y, virt); if (virt) - y = bar->height / 2 - center_height / 2 - bar->top_spacing; + y = (bar->height_with_border - center_height) / 2; else - x = bar->width / 2 - center_width / 2 - bar->left_spacing; + x = (bar->width_with_border - center_width) / 2; bar_expose_section(&bar->center, bar, pix, x, y, virt); if(virt) - y = bar->height - ( + y = bar->height_with_border - ( bottom_height + bar->top_spacing + bar->bottom_margin + bar->border.bottom_width); else - x = bar->width - ( + x = bar->width_with_border - ( right_width + bar->left_spacing + bar->right_margin + diff --git a/bar/wayland.c b/bar/wayland.c index 98a5c97..e480d4b 100644 --- a/bar/wayland.c +++ b/bar/wayland.c @@ -1048,8 +1048,8 @@ update_size(struct wayland_backend *backend) // I need to read more to understand how bar->width and bar->height are used zwlr_layer_surface_v1_set_size( backend->layer_surface, - bar->width_with_border / scale, - bar->height_with_border / scale + (bar->width_with_border % scale + bar->width_with_border) / scale, + (bar->height_with_border % scale + bar->height_with_border) / scale ); /* Trigger a 'configure' event, after which we'll have the width */ diff --git a/particles/string.c b/particles/string.c index 26b8dea..c13f968 100644 --- a/particles/string.c +++ b/particles/string.c @@ -71,7 +71,7 @@ begin_expose(struct exposable *exposable) exposable->width += e->kern_x[i] + e->glyphs[i]->advance.x; } } - LOG_INFO("String height: %d", exposable->height); + return exposable->width; } @@ -107,9 +107,7 @@ expose(const struct exposable *exposable, pixman_image_t *pix, int x, int y, int * font family. */ // TODO: FIX THIS - const double baseline = (double)y + - (double)(exposable->height + font->ascent + font->descent) / 2.0 - - (font->descent > 0 ? font->descent : 0); + const double baseline = (double)y + font->ascent; x += exposable->particle->left_margin;