diff --git a/render.c b/render.c index a8fd5f2e..09c1b87f 100644 --- a/render.c +++ b/render.c @@ -1912,13 +1912,14 @@ render_render_timer(struct terminal *term, struct timeval render_time) term->wl->shm, width, height, cookie, false, 1); wl_subsurface_set_position( - win->render_timer_sub_surface, + win->render_timer_surface.sub, margin / term->scale, (term->margins.top + term->cell_height - margin) / term->scale); render_osd( term, - win->render_timer_surface, win->render_timer_sub_surface, + win->render_timer_surface.surf, + win->render_timer_surface.sub, buf, text, term->colors.table[0], term->colors.table[8 + 1], width, height, margin, margin); diff --git a/terminal.c b/terminal.c index 0aab462b..2ff02783 100644 --- a/terminal.c +++ b/terminal.c @@ -2825,7 +2825,7 @@ term_surface_kind(const struct terminal *term, const struct wl_surface *surface) return TERM_SURF_SEARCH; else if (surface == term->window->scrollback_indicator_surface.surf) return TERM_SURF_SCROLLBACK_INDICATOR; - else if (surface == term->window->render_timer_surface) + else if (surface == term->window->render_timer_surface.surf) return TERM_SURF_RENDER_TIMER; else if (surface == term->window->csd.surface[CSD_SURF_TITLE].surf) return TERM_SURF_TITLE; diff --git a/wayland.c b/wayland.c index ca95663e..d8968ab6 100644 --- a/wayland.c +++ b/wayland.c @@ -1367,16 +1367,10 @@ wayl_win_init(struct terminal *term) wl_surface_commit(win->surface); if (conf->tweak.render_timer_osd) { - win->render_timer_surface = wl_compositor_create_surface(wayl->compositor); - if (win->render_timer_surface == NULL) { + if (!wayl_win_subsurface_new(win, &win->render_timer_surface)) { LOG_ERR("failed to create render timer surface"); goto out; } - win->render_timer_sub_surface = wl_subcompositor_get_subsurface( - wayl->sub_compositor, win->render_timer_surface, win->surface); - wl_subsurface_set_sync(win->render_timer_sub_surface); - wl_surface_set_user_data(win->render_timer_surface, win); - wl_surface_commit(win->render_timer_surface); } return win; @@ -1404,9 +1398,9 @@ wayl_win_destroy(struct wl_window *win) * nor mouse focus). */ - if (win->render_timer_surface != NULL) { - wl_surface_attach(win->render_timer_surface, NULL, 0, 0); - wl_surface_commit(win->render_timer_surface); + if (win->render_timer_surface.surf != NULL) { + wl_surface_attach(win->render_timer_surface.surf, NULL, 0, 0); + wl_surface_commit(win->render_timer_surface.surf); } if (win->scrollback_indicator_surface.surf != NULL) { @@ -1445,11 +1439,8 @@ wayl_win_destroy(struct wl_window *win) csd_destroy(win); wayl_win_subsurface_destroy(&win->search_surface); wayl_win_subsurface_destroy(&win->scrollback_indicator_surface); + wayl_win_subsurface_destroy(&win->render_timer_surface); - if (win->render_timer_sub_surface != NULL) - wl_subsurface_destroy(win->render_timer_sub_surface); - if (win->render_timer_surface != NULL) - wl_surface_destroy(win->render_timer_surface); if (win->frame_callback != NULL) wl_callback_destroy(win->frame_callback); if (win->xdg_toplevel_decoration != NULL) diff --git a/wayland.h b/wayland.h index 31ae3b82..4b146d57 100644 --- a/wayland.h +++ b/wayland.h @@ -379,9 +379,7 @@ struct wl_window { struct wl_surf_subsurf search_surface; struct wl_surf_subsurf scrollback_indicator_surface; - - struct wl_surface *render_timer_surface; - struct wl_subsurface *render_timer_sub_surface; + struct wl_surf_subsurf render_timer_surface; struct wl_callback *frame_callback;