mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render-timer: use wayl_win_subsurface_new/destroy()
This commit is contained in:
parent
c8324943de
commit
438853a2d8
4 changed files with 10 additions and 20 deletions
5
render.c
5
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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
19
wayland.c
19
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue