wvkbd

git clone https://git.tarina.org/wvkbd
Log | Files | Refs | README | LICENSE

commit 4ce0cf1b53b090a88202dc6ad8ddbfc8dee4e302
parent 915d01c562f5beac46f18b79470427b24e504372
Author: Stacy Harper <contact@stacyharper.net>
Date:   Wed, 25 Aug 2021 22:39:27 +0200

Better damage tracking

Diffstat:
Mdrw.c | 9++++-----
Mdrw.h | 1-
Mkeyboard.h | 6------
3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drw.c b/drw.c @@ -32,11 +32,6 @@ drwsurf_flip(struct drwsurf *ds) { struct wl_callback *cb = wl_surface_frame(ds->surf); wl_callback_add_listener(cb, &frame_listener, (void *)ds); - if (ds->dirty) { - wl_surface_damage(ds->surf, 0, 0, ds->width, ds->height); - ds->dirty = false; - } - wl_surface_attach(ds->surf, ds->buf, 0, 0); wl_surface_set_buffer_scale(ds->surf, ds->scale); wl_surface_commit(ds->surf); @@ -75,6 +70,8 @@ drw_draw_text(struct drwsurf *d, Color color, cairo_rel_move_to(d->cairo, - ((double)width / PANGO_SCALE) / 2, - ((double)height / PANGO_SCALE) / 2); pango_cairo_show_layout(d->cairo, d->layout); cairo_restore(d->cairo); + + wl_surface_damage(d->surf, x, y, w, h); } void @@ -95,6 +92,8 @@ drw_fill_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y, cairo_fill(d->cairo); cairo_restore(d->cairo); + + wl_surface_damage(d->surf, x, y, w, h); } uint32_t diff --git a/drw.h b/drw.h @@ -10,7 +10,6 @@ struct drw { }; struct drwsurf { uint32_t width, height, scale, size; - bool dirty; struct drw *ctx; struct wl_surface *surf; diff --git a/keyboard.h b/keyboard.h @@ -247,8 +247,6 @@ void kbd_unpress_key(struct kbd *kb, uint32_t time) { if (kb->last_press) { kbd_draw_key(kb, kb->last_press, false); - kb->surf->dirty = true; - if (kb->last_press->type == Copy) { zwp_virtual_keyboard_v1_key(kb->vkbd, time, 127, // COMP key WL_KEYBOARD_KEY_STATE_RELEASED); @@ -277,7 +275,6 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) { compose++; if (debug) fprintf(stderr, "showing compose %d\n", compose); kbd_switch_layout(kb, k->layout); - kb->surf->dirty = true; return; } @@ -353,8 +350,6 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) { default: break; } - - kb->surf->dirty = true; } @@ -440,7 +435,6 @@ kbd_resize(struct kbd *kb, struct layout *layouts, uint8_t layoutcount) { kbd_init_layout(&layouts[i], kb->w, kb->h); } kbd_draw_layout(kb); - d->dirty = true; } void