Tie the damage tracking to the drawing methods

So that keyboard.c just need to draw things, and stop worring about
damaging.
This commit is contained in:
Willow Barraco 2025-04-18 07:47:57 +02:00
parent 47d27e48d5
commit ace77b2aaa
No known key found for this signature in database
GPG Key ID: EABA44759877E02A
3 changed files with 3 additions and 12 deletions

3
drw.c
View File

@ -131,6 +131,7 @@ drw_draw_text(struct drwsurf *ds, Color color, uint32_t x, uint32_t y,
{
drwsurf_flip(ds);
struct drwbuf *d = ds->back_buffer;
drwsurf_damage(ds, x, y, w, h);
cairo_save(d->cairo);
@ -159,6 +160,7 @@ drw_do_clear(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
{
drwsurf_flip(ds);
struct drwbuf *d = ds->back_buffer;
drwsurf_damage(ds, x, y, w, h);
cairo_save(d->cairo);
@ -175,6 +177,7 @@ drw_do_rectangle(struct drwsurf *ds, Color color, uint32_t x, uint32_t y,
{
drwsurf_flip(ds);
struct drwbuf *d = ds->back_buffer;
drwsurf_damage(ds, x, y, w, h);
cairo_save(d->cairo);

1
drw.h
View File

@ -33,7 +33,6 @@ struct drwsurf {
};
struct kbd;
void drwsurf_damage(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, double s);
void drwsurf_attach(struct drwsurf *ds);
void drwsurf_flip(struct drwsurf *ds);

View File

@ -544,14 +544,6 @@ kbd_clear_last_popup(struct kbd *kb)
if (kb->last_popup_w && kb->last_popup_h) {
drw_do_clear(kb->popup_surf, kb->last_popup_x, kb->last_popup_y,
kb->last_popup_w, kb->last_popup_h);
drwsurf_damage(
kb->popup_surf,
kb->last_popup_x,
kb->last_popup_y,
kb->last_popup_w,
kb->last_popup_h
);
kb->last_popup_w = kb->last_popup_h = 0;
}
}
@ -584,7 +576,6 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
KBD_KEY_BORDER, label, scheme->font_description);
drwsurf_damage(kb->surf, k->x, k->y, k->w, k->h);
if (type == Press || type == Unpress) {
kbd_clear_last_popup(kb);
@ -601,7 +592,6 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
drw_draw_text(kb->popup_surf, scheme->text, k->x, kb->last_popup_y,
k->w, k->h, KBD_KEY_BORDER, label,
scheme->font_description);
drwsurf_damage(kb->popup_surf, k->x, kb->last_popup_y, k->w, k->h);
}
}
@ -628,7 +618,6 @@ kbd_draw_layout(struct kbd *kb)
}
next_key++;
}
drwsurf_damage(d, 0, 0, kb->w, kb->h);
}
void