mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-07 08:21:02 -04:00
wayland: window now keeps pointer to owning terminal, not wayland
This commit is contained in:
parent
74aa604904
commit
9a0238bb52
3 changed files with 10 additions and 8 deletions
|
|
@ -654,7 +654,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* Initialize the Wayland window backend */
|
/* Initialize the Wayland window backend */
|
||||||
if ((term->window = wayl_win_init(wayl)) == NULL)
|
if ((term->window = wayl_win_init(term)) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* Let the Wayland backend know we exist */
|
/* Let the Wayland backend know we exist */
|
||||||
|
|
|
||||||
12
wayland.c
12
wayland.c
|
|
@ -825,10 +825,12 @@ wayl_destroy(struct wayland *wayl)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_window *
|
struct wl_window *
|
||||||
wayl_win_init(struct wayland *wayl)
|
wayl_win_init(struct terminal *term)
|
||||||
{
|
{
|
||||||
|
struct wayland *wayl = term->wl;
|
||||||
|
|
||||||
struct wl_window *win = calloc(1, sizeof(*win));
|
struct wl_window *win = calloc(1, sizeof(*win));
|
||||||
win->wayl = wayl;
|
win->term = term;
|
||||||
|
|
||||||
win->surface = wl_compositor_create_surface(wayl->compositor);
|
win->surface = wl_compositor_create_surface(wayl->compositor);
|
||||||
if (win->surface == NULL) {
|
if (win->surface == NULL) {
|
||||||
|
|
@ -887,12 +889,12 @@ wayl_win_destroy(struct wl_window *win)
|
||||||
/* Scrollback search */
|
/* Scrollback search */
|
||||||
wl_surface_attach(win->search_surface, NULL, 0, 0);
|
wl_surface_attach(win->search_surface, NULL, 0, 0);
|
||||||
wl_surface_commit(win->search_surface);
|
wl_surface_commit(win->search_surface);
|
||||||
wl_display_roundtrip(win->wayl->display);
|
wl_display_roundtrip(win->term->wl->display);
|
||||||
|
|
||||||
/* Main window */
|
/* Main window */
|
||||||
wl_surface_attach(win->surface, NULL, 0, 0);
|
wl_surface_attach(win->surface, NULL, 0, 0);
|
||||||
wl_surface_commit(win->surface);
|
wl_surface_commit(win->surface);
|
||||||
wl_display_roundtrip(win->wayl->display);
|
wl_display_roundtrip(win->term->wl->display);
|
||||||
|
|
||||||
tll_free(win->on_outputs);
|
tll_free(win->on_outputs);
|
||||||
if (win->search_sub_surface != NULL)
|
if (win->search_sub_surface != NULL)
|
||||||
|
|
@ -910,7 +912,7 @@ wayl_win_destroy(struct wl_window *win)
|
||||||
if (win->surface != NULL)
|
if (win->surface != NULL)
|
||||||
wl_surface_destroy(win->surface);
|
wl_surface_destroy(win->surface);
|
||||||
|
|
||||||
wl_display_roundtrip(win->wayl->display);
|
wl_display_roundtrip(win->term->wl->display);
|
||||||
|
|
||||||
free(win);
|
free(win);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ struct wl_primary {
|
||||||
|
|
||||||
struct wayland;
|
struct wayland;
|
||||||
struct wl_window {
|
struct wl_window {
|
||||||
struct wayland *wayl;
|
struct terminal *term;
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
struct xdg_surface *xdg_surface;
|
struct xdg_surface *xdg_surface;
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
|
|
@ -181,5 +181,5 @@ struct terminal *wayl_terminal_from_xdg_toplevel(
|
||||||
/* TODO: pass something other than 'term'? Need scale... */
|
/* TODO: pass something other than 'term'? Need scale... */
|
||||||
bool wayl_cursor_set(struct wayland *wayl, const struct terminal *term);
|
bool wayl_cursor_set(struct wayland *wayl, const struct terminal *term);
|
||||||
|
|
||||||
struct wl_window *wayl_win_init(struct wayland *wayl);
|
struct wl_window *wayl_win_init(struct terminal *term);
|
||||||
void wayl_win_destroy(struct wl_window *win);
|
void wayl_win_destroy(struct wl_window *win);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue