Fix remaining too long text cases

This commit is contained in:
Willow Barraco 2023-08-31 22:25:11 +02:00
parent 4444c6e664
commit 3752d0e392
No known key found for this signature in database
GPG Key ID: EABA44759877E02A
2 changed files with 6 additions and 9 deletions

4
drw.c
View File

@ -49,13 +49,13 @@ drw_draw_text(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
if (width < (w - (b*2))) { if (width < (w - (b*2))) {
cairo_rel_move_to(d->cairo, - width / 2, 0); cairo_rel_move_to(d->cairo, - width / 2, 0);
} else { } else {
cairo_rel_move_to(d->cairo, - w / 2 + b, 0); cairo_rel_move_to(d->cairo, - (w / 2) + b, 0);
} }
if (height < (h - (b*2))) { if (height < (h - (b*2))) {
cairo_rel_move_to(d->cairo, 0, - height / 2); cairo_rel_move_to(d->cairo, 0, - height / 2);
} else { } else {
cairo_rel_move_to(d->cairo, 0, - h / 2); cairo_rel_move_to(d->cairo, 0, - (h / 2) + b);
} }
pango_cairo_show_layout(d->cairo, d->layout); pango_cairo_show_layout(d->cairo, d->layout);

View File

@ -521,13 +521,10 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type) {
drw_draw_text(d, scheme->text, k->x, k->y, k->w, k->h, KBD_KEY_BORDER, label); drw_draw_text(d, scheme->text, k->x, k->y, k->w, k->h, KBD_KEY_BORDER, label);
// cleanup cairo mess right side if words too long // cleanup cairo mess right side if words too long
uint32_t right_part_x = k->x + k->w - 2 * KBD_KEY_BORDER; drw_do_rectangle(d, kb->scheme.bg, k->x + k->w - KBD_KEY_BORDER, k->y,
drw_do_rectangle(d, kb->scheme.bg, right_part_x, k->y, kb->w, k->h, false);
kb->w - right_part_x, k->h, false); drw_do_rectangle(d, kb->scheme.bg, k->x, k->y + k->h - KBD_KEY_BORDER,
kb->h, k->w, false);
uint32_t bottom_part_y = k->y + k->h - 1 * KBD_KEY_BORDER;
drw_do_rectangle(d, kb->scheme.bg, k->x, bottom_part_y,
kb->h - bottom_part_y, k->w, false);
wl_surface_damage(d->surf, k->x, k->y, k->w, k->h); wl_surface_damage(d->surf, k->x, k->y, k->w, k->h);
} }