render: move frame_callback to term.render

This commit is contained in:
Daniel Eklöf 2019-07-24 20:11:49 +02:00
parent ebf0a11fa0
commit 4838763d18
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 11 additions and 9 deletions

4
main.c
View file

@ -848,8 +848,8 @@ out:
mtx_unlock(&term.kbd.repeat.mutex);
shm_fini();
if (term.frame_callback != NULL)
wl_callback_destroy(term.frame_callback);
if (term.render.frame_callback != NULL)
wl_callback_destroy(term.render.frame_callback);
if (term.wl.xdg_toplevel != NULL)
xdg_toplevel_destroy(term.wl.xdg_toplevel);
if (term.wl.xdg_surface != NULL)

View file

@ -563,9 +563,9 @@ grid_render(struct terminal *term)
cairo_surface_flush(buf->cairo_surface);
wl_surface_attach(term->wl.surface, buf->wl_buf, 0, 0);
assert(term->frame_callback == NULL);
term->frame_callback = wl_surface_frame(term->wl.surface);
wl_callback_add_listener(term->frame_callback, &frame_listener, term);
assert(term->render.frame_callback == NULL);
term->render.frame_callback = wl_surface_frame(term->wl.surface);
wl_callback_add_listener(term->render.frame_callback, &frame_listener, term);
wl_surface_commit(term->wl.surface);
@ -585,9 +585,9 @@ frame_callback(void *data, struct wl_callback *wl_callback, uint32_t callback_da
{
struct terminal *term = data;
assert(term->frame_callback == wl_callback);
assert(term->render.frame_callback == wl_callback);
wl_callback_destroy(wl_callback);
term->frame_callback = NULL;
term->render.frame_callback = NULL;
grid_render(term);
}
@ -754,6 +754,6 @@ render_update_cursor_surface(struct terminal *term)
void
render_refresh(struct terminal *term)
{
if (term->frame_callback == NULL)
if (term->render.frame_callback == NULL)
grid_render(term);
}

View file

@ -321,7 +321,9 @@ struct terminal {
cairo_font_extents_t fextents;
struct wayland wl;
struct wl_callback *frame_callback;
struct {
struct wl_callback *frame_callback;
} render;
};
void term_damage_rows(struct terminal *term, int start, int end);