Fix margins and clean up stdout

This commit is contained in:
Kyle Gunger 2023-01-18 16:08:19 -05:00
parent 60c18246d8
commit 1ddfa6343a
3 changed files with 9 additions and 12 deletions

View file

@ -289,29 +289,28 @@ expose(const struct bar *_bar)
int top_height, center_height, bottom_height;
calculate_heights(bar, &top_height, &center_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 +

View file

@ -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 */

View file

@ -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;