mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-07-13 06:24:29 +02:00
only commit surface when it changed
Previously wvkbd would commit an (usually) unchanged surface at the framerate of the compositor, this only commits the buffer when we render something new. Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
committed by
Maarten van Gompel
parent
a2cacb7e25
commit
1843e60a74
18
drw.c
18
drw.c
@ -20,30 +20,12 @@ drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, uint32_t s) {
|
||||
setup_buffer(ds);
|
||||
}
|
||||
|
||||
static void surface_frame_callback(void *data, struct wl_callback *cb,
|
||||
uint32_t time);
|
||||
|
||||
static struct wl_callback_listener frame_listener = {.done =
|
||||
surface_frame_callback};
|
||||
|
||||
void
|
||||
drwsurf_flip(struct drwsurf *ds) {
|
||||
ds->cb = wl_surface_frame(ds->surf);
|
||||
wl_callback_add_listener(ds->cb, &frame_listener, (void *)ds);
|
||||
|
||||
wl_surface_attach(ds->surf, ds->buf, 0, 0);
|
||||
wl_surface_commit(ds->surf);
|
||||
}
|
||||
|
||||
void
|
||||
surface_frame_callback(void *data, struct wl_callback *cb, uint32_t time) {
|
||||
struct drwsurf *ds = (struct drwsurf *)data;
|
||||
wl_callback_destroy(cb);
|
||||
ds->cb = NULL;
|
||||
|
||||
drwsurf_flip(ds);
|
||||
}
|
||||
|
||||
void
|
||||
drw_draw_text(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h, const char *label) {
|
||||
|
Reference in New Issue
Block a user