mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-03 07:15:29 -04:00
wayland: implement wayl_win_destroy()
This commit is contained in:
parent
942ff566a2
commit
9e6c28f5b6
5 changed files with 37 additions and 27 deletions
23
main.c
23
main.c
|
|
@ -463,7 +463,7 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data)
|
||||||
* ourselves we just received keyboard input, and in
|
* ourselves we just received keyboard input, and in
|
||||||
* this case *not* delay rendering?
|
* this case *not* delay rendering?
|
||||||
*/
|
*/
|
||||||
if (term->render.frame_callback == NULL) {
|
if (term->window.frame_callback == NULL) {
|
||||||
/* First timeout - reset each time we receive input. */
|
/* First timeout - reset each time we receive input. */
|
||||||
timerfd_settime(
|
timerfd_settime(
|
||||||
term->delayed_render_timer.lower_fd, 0,
|
term->delayed_render_timer.lower_fd, 0,
|
||||||
|
|
@ -1151,7 +1151,6 @@ out:
|
||||||
|
|
||||||
shm_fini();
|
shm_fini();
|
||||||
|
|
||||||
tll_free(term.window.on_outputs);
|
|
||||||
if (term.selection.clipboard.data_source != NULL)
|
if (term.selection.clipboard.data_source != NULL)
|
||||||
wl_data_source_destroy(term.selection.clipboard.data_source);
|
wl_data_source_destroy(term.selection.clipboard.data_source);
|
||||||
if (term.selection.clipboard.data_offer != NULL)
|
if (term.selection.clipboard.data_offer != NULL)
|
||||||
|
|
@ -1172,24 +1171,8 @@ out:
|
||||||
xkb_state_unref(term.kbd.xkb_state);
|
xkb_state_unref(term.kbd.xkb_state);
|
||||||
if (term.kbd.xkb != NULL)
|
if (term.kbd.xkb != NULL)
|
||||||
xkb_context_unref(term.kbd.xkb);
|
xkb_context_unref(term.kbd.xkb);
|
||||||
if (term.window.search_sub_surface != NULL)
|
|
||||||
wl_subsurface_destroy(term.window.search_sub_surface);
|
wayl_win_destroy(&term.window);
|
||||||
if (term.window.search_surface != NULL)
|
|
||||||
wl_surface_destroy(term.window.search_surface);
|
|
||||||
if (term.render.frame_callback != NULL)
|
|
||||||
wl_callback_destroy(term.render.frame_callback);
|
|
||||||
if (term.window.xdg_toplevel_decoration != NULL)
|
|
||||||
zxdg_toplevel_decoration_v1_destroy(term.window.xdg_toplevel_decoration);
|
|
||||||
if (term.window.xdg_decoration_manager != NULL)
|
|
||||||
zxdg_decoration_manager_v1_destroy(term.window.xdg_decoration_manager);
|
|
||||||
if (term.window.xdg_toplevel != NULL)
|
|
||||||
xdg_toplevel_destroy(term.window.xdg_toplevel);
|
|
||||||
if (term.window.xdg_surface != NULL)
|
|
||||||
xdg_surface_destroy(term.window.xdg_surface);
|
|
||||||
if (term.window.shell != NULL)
|
|
||||||
xdg_wm_base_destroy(term.window.shell);
|
|
||||||
if (term.window.surface != NULL)
|
|
||||||
wl_surface_destroy(term.window.surface);
|
|
||||||
wayl_destroy(&term.wl);
|
wayl_destroy(&term.wl);
|
||||||
|
|
||||||
free(term.vt.osc.data);
|
free(term.vt.osc.data);
|
||||||
|
|
|
||||||
12
render.c
12
render.c
|
|
@ -700,9 +700,9 @@ grid_render(struct terminal *term)
|
||||||
assert(term->grid->offset >= 0 && term->grid->offset < term->grid->num_rows);
|
assert(term->grid->offset >= 0 && term->grid->offset < term->grid->num_rows);
|
||||||
assert(term->grid->view >= 0 && term->grid->view < term->grid->num_rows);
|
assert(term->grid->view >= 0 && term->grid->view < term->grid->num_rows);
|
||||||
|
|
||||||
assert(term->render.frame_callback == NULL);
|
assert(term->window.frame_callback == NULL);
|
||||||
term->render.frame_callback = wl_surface_frame(term->window.surface);
|
term->window.frame_callback = wl_surface_frame(term->window.surface);
|
||||||
wl_callback_add_listener(term->render.frame_callback, &frame_listener, term);
|
wl_callback_add_listener(term->window.frame_callback, &frame_listener, term);
|
||||||
|
|
||||||
wl_surface_set_buffer_scale(term->window.surface, term->scale);
|
wl_surface_set_buffer_scale(term->window.surface, term->scale);
|
||||||
wl_surface_commit(term->window.surface);
|
wl_surface_commit(term->window.surface);
|
||||||
|
|
@ -723,9 +723,9 @@ frame_callback(void *data, struct wl_callback *wl_callback, uint32_t callback_da
|
||||||
{
|
{
|
||||||
struct terminal *term = data;
|
struct terminal *term = data;
|
||||||
|
|
||||||
assert(term->render.frame_callback == wl_callback);
|
assert(term->window.frame_callback == wl_callback);
|
||||||
wl_callback_destroy(wl_callback);
|
wl_callback_destroy(wl_callback);
|
||||||
term->render.frame_callback = NULL;
|
term->window.frame_callback = NULL;
|
||||||
grid_render(term);
|
grid_render(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1000,6 +1000,6 @@ render_update_cursor_surface(struct terminal *term)
|
||||||
void
|
void
|
||||||
render_refresh(struct terminal *term)
|
render_refresh(struct terminal *term)
|
||||||
{
|
{
|
||||||
if (term->render.frame_callback == NULL)
|
if (term->window.frame_callback == NULL)
|
||||||
grid_render(term);
|
grid_render(term);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,6 @@ struct terminal {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int scrollback_lines;
|
int scrollback_lines;
|
||||||
struct wl_callback *frame_callback;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
size_t count;
|
size_t count;
|
||||||
|
|
|
||||||
24
wayland.c
24
wayland.c
|
|
@ -64,3 +64,27 @@ wayl_destroy(struct wayland *wayl)
|
||||||
if (wayl->display != NULL)
|
if (wayl->display != NULL)
|
||||||
wl_display_disconnect(wayl->display);
|
wl_display_disconnect(wayl->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wayl_win_destroy(struct wl_window *win)
|
||||||
|
{
|
||||||
|
tll_free(win->on_outputs);
|
||||||
|
if (win->search_sub_surface != NULL)
|
||||||
|
wl_subsurface_destroy(win->search_sub_surface);
|
||||||
|
if (win->search_surface != NULL)
|
||||||
|
wl_surface_destroy(win->search_surface);
|
||||||
|
if (win->frame_callback != NULL)
|
||||||
|
wl_callback_destroy(win->frame_callback);
|
||||||
|
if (win->xdg_toplevel_decoration != NULL)
|
||||||
|
zxdg_toplevel_decoration_v1_destroy(win->xdg_toplevel_decoration);
|
||||||
|
if (win->xdg_decoration_manager != NULL)
|
||||||
|
zxdg_decoration_manager_v1_destroy(win->xdg_decoration_manager);
|
||||||
|
if (win->xdg_toplevel != NULL)
|
||||||
|
xdg_toplevel_destroy(win->xdg_toplevel);
|
||||||
|
if (win->xdg_surface != NULL)
|
||||||
|
xdg_surface_destroy(win->xdg_surface);
|
||||||
|
if (win->shell != NULL)
|
||||||
|
xdg_wm_base_destroy(win->shell);
|
||||||
|
if (win->surface != NULL)
|
||||||
|
wl_surface_destroy(win->surface);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ struct wl_window {
|
||||||
struct wl_surface *search_surface;
|
struct wl_surface *search_surface;
|
||||||
struct wl_subsurface *search_sub_surface;
|
struct wl_subsurface *search_sub_surface;
|
||||||
|
|
||||||
|
struct wl_callback *frame_callback;
|
||||||
|
|
||||||
tll(const struct monitor *) on_outputs; /* Outputs we're mapped on */
|
tll(const struct monitor *) on_outputs; /* Outputs we're mapped on */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -79,3 +81,5 @@ struct wayland {
|
||||||
/* TODO: return allocated pointer */
|
/* TODO: return allocated pointer */
|
||||||
void wayl_init(struct wayland *wayl);
|
void wayl_init(struct wayland *wayl);
|
||||||
void wayl_destroy(struct wayland *wayl);
|
void wayl_destroy(struct wayland *wayl);
|
||||||
|
|
||||||
|
void wayl_win_destroy(struct wl_window *win);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue