rootston: add destroy to view interface
This commit is contained in:
parent
1f8854f217
commit
6ac3534df6
|
@ -142,6 +142,7 @@ struct roots_view {
|
||||||
void (*maximize)(struct roots_view *view, bool maximized);
|
void (*maximize)(struct roots_view *view, bool maximized);
|
||||||
void (*set_fullscreen)(struct roots_view *view, bool fullscreen);
|
void (*set_fullscreen)(struct roots_view *view, bool fullscreen);
|
||||||
void (*close)(struct roots_view *view);
|
void (*close)(struct roots_view *view);
|
||||||
|
void (*destroy)(struct roots_view *view);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct roots_view_child {
|
struct roots_view_child {
|
||||||
|
|
|
@ -422,6 +422,10 @@ void view_destroy(struct roots_view *view) {
|
||||||
|
|
||||||
wl_signal_emit(&view->events.destroy, view);
|
wl_signal_emit(&view->events.destroy, view);
|
||||||
|
|
||||||
|
if (view->destroy) {
|
||||||
|
view->destroy(view);
|
||||||
|
}
|
||||||
|
|
||||||
free(view);
|
free(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,19 @@ static void close(struct roots_view *view) {
|
||||||
wl_client_destroy(surf->client);
|
wl_client_destroy(surf->client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroy(struct roots_view *view) {
|
||||||
|
assert(view->type == ROOTS_WL_SHELL_VIEW);
|
||||||
|
struct roots_wl_shell_surface *roots_surface = view->roots_wl_shell_surface;
|
||||||
|
wl_list_remove(&roots_surface->destroy.link);
|
||||||
|
wl_list_remove(&roots_surface->request_move.link);
|
||||||
|
wl_list_remove(&roots_surface->request_resize.link);
|
||||||
|
wl_list_remove(&roots_surface->request_maximize.link);
|
||||||
|
wl_list_remove(&roots_surface->request_fullscreen.link);
|
||||||
|
wl_list_remove(&roots_surface->set_state.link);
|
||||||
|
wl_list_remove(&roots_surface->surface_commit.link);
|
||||||
|
free(roots_surface);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_request_move(struct wl_listener *listener, void *data) {
|
static void handle_request_move(struct wl_listener *listener, void *data) {
|
||||||
struct roots_wl_shell_surface *roots_surface =
|
struct roots_wl_shell_surface *roots_surface =
|
||||||
wl_container_of(listener, roots_surface, request_move);
|
wl_container_of(listener, roots_surface, request_move);
|
||||||
|
@ -174,15 +187,7 @@ static void handle_new_popup(struct wl_listener *listener, void *data) {
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct roots_wl_shell_surface *roots_surface =
|
struct roots_wl_shell_surface *roots_surface =
|
||||||
wl_container_of(listener, roots_surface, destroy);
|
wl_container_of(listener, roots_surface, destroy);
|
||||||
wl_list_remove(&roots_surface->destroy.link);
|
|
||||||
wl_list_remove(&roots_surface->request_move.link);
|
|
||||||
wl_list_remove(&roots_surface->request_resize.link);
|
|
||||||
wl_list_remove(&roots_surface->request_maximize.link);
|
|
||||||
wl_list_remove(&roots_surface->request_fullscreen.link);
|
|
||||||
wl_list_remove(&roots_surface->set_state.link);
|
|
||||||
wl_list_remove(&roots_surface->surface_commit.link);
|
|
||||||
view_destroy(roots_surface->view);
|
view_destroy(roots_surface->view);
|
||||||
free(roots_surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
|
@ -238,6 +243,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
view->roots_wl_shell_surface = roots_surface;
|
view->roots_wl_shell_surface = roots_surface;
|
||||||
view->resize = resize;
|
view->resize = resize;
|
||||||
view->close = close;
|
view->close = close;
|
||||||
|
view->destroy = destroy;
|
||||||
roots_surface->view = view;
|
roots_surface->view = view;
|
||||||
|
|
||||||
view_map(view, surface->surface);
|
view_map(view, surface->surface);
|
||||||
|
|
|
@ -180,6 +180,18 @@ static void close(struct roots_view *view) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroy(struct roots_view *view) {
|
||||||
|
struct roots_xdg_surface *roots_xdg_surface = view->roots_xdg_surface;
|
||||||
|
wl_list_remove(&roots_xdg_surface->surface_commit.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->destroy.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->new_popup.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_move.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_resize.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_maximize.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_fullscreen.link);
|
||||||
|
free(roots_xdg_surface);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_request_move(struct wl_listener *listener, void *data) {
|
static void handle_request_move(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xdg_surface *roots_xdg_surface =
|
struct roots_xdg_surface *roots_xdg_surface =
|
||||||
wl_container_of(listener, roots_xdg_surface, request_move);
|
wl_container_of(listener, roots_xdg_surface, request_move);
|
||||||
|
@ -280,15 +292,7 @@ static void handle_new_popup(struct wl_listener *listener, void *data) {
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xdg_surface *roots_xdg_surface =
|
struct roots_xdg_surface *roots_xdg_surface =
|
||||||
wl_container_of(listener, roots_xdg_surface, destroy);
|
wl_container_of(listener, roots_xdg_surface, destroy);
|
||||||
wl_list_remove(&roots_xdg_surface->surface_commit.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->destroy.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->new_popup.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_move.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_resize.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_maximize.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_fullscreen.link);
|
|
||||||
view_destroy(roots_xdg_surface->view);
|
view_destroy(roots_xdg_surface->view);
|
||||||
free(roots_xdg_surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
|
void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
|
@ -346,6 +350,7 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
view->maximize = maximize;
|
view->maximize = maximize;
|
||||||
view->set_fullscreen = set_fullscreen;
|
view->set_fullscreen = set_fullscreen;
|
||||||
view->close = close;
|
view->close = close;
|
||||||
|
view->destroy = destroy;
|
||||||
roots_surface->view = view;
|
roots_surface->view = view;
|
||||||
|
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
|
|
|
@ -180,6 +180,21 @@ static void close(struct roots_view *view) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroy(struct roots_view *view) {
|
||||||
|
assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
|
||||||
|
struct roots_xdg_surface_v6 *roots_xdg_surface = view->roots_xdg_surface_v6;
|
||||||
|
wl_list_remove(&roots_xdg_surface->surface_commit.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->destroy.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->new_popup.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->map.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->unmap.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_move.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_resize.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_maximize.link);
|
||||||
|
wl_list_remove(&roots_xdg_surface->request_fullscreen.link);
|
||||||
|
free(roots_xdg_surface);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_request_move(struct wl_listener *listener, void *data) {
|
static void handle_request_move(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
||||||
wl_container_of(listener, roots_xdg_surface, request_move);
|
wl_container_of(listener, roots_xdg_surface, request_move);
|
||||||
|
@ -298,25 +313,13 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
||||||
static void handle_unmap(struct wl_listener *listener, void *data) {
|
static void handle_unmap(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
||||||
wl_container_of(listener, roots_xdg_surface, unmap);
|
wl_container_of(listener, roots_xdg_surface, unmap);
|
||||||
struct roots_view *view = roots_xdg_surface->view;
|
view_unmap(roots_xdg_surface->view);
|
||||||
|
|
||||||
view_unmap(view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
||||||
wl_container_of(listener, roots_xdg_surface, destroy);
|
wl_container_of(listener, roots_xdg_surface, destroy);
|
||||||
wl_list_remove(&roots_xdg_surface->surface_commit.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->destroy.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->new_popup.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->map.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->unmap.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_move.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_resize.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_maximize.link);
|
|
||||||
wl_list_remove(&roots_xdg_surface->request_fullscreen.link);
|
|
||||||
view_destroy(roots_xdg_surface->view);
|
view_destroy(roots_xdg_surface->view);
|
||||||
free(roots_xdg_surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
||||||
|
@ -378,5 +381,6 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
||||||
view->maximize = maximize;
|
view->maximize = maximize;
|
||||||
view->set_fullscreen = set_fullscreen;
|
view->set_fullscreen = set_fullscreen;
|
||||||
view->close = close;
|
view->close = close;
|
||||||
|
view->destroy = destroy;
|
||||||
roots_surface->view = view;
|
roots_surface->view = view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,9 +106,9 @@ static void set_fullscreen(struct roots_view *view, bool fullscreen) {
|
||||||
wlr_xwayland_surface_set_fullscreen(view->xwayland_surface, fullscreen);
|
wlr_xwayland_surface_set_fullscreen(view->xwayland_surface, fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void destroy(struct roots_view *view) {
|
||||||
struct roots_xwayland_surface *roots_surface =
|
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
||||||
wl_container_of(listener, roots_surface, destroy);
|
struct roots_xwayland_surface *roots_surface = view->roots_xwayland_surface;
|
||||||
wl_list_remove(&roots_surface->destroy.link);
|
wl_list_remove(&roots_surface->destroy.link);
|
||||||
wl_list_remove(&roots_surface->request_configure.link);
|
wl_list_remove(&roots_surface->request_configure.link);
|
||||||
wl_list_remove(&roots_surface->request_move.link);
|
wl_list_remove(&roots_surface->request_move.link);
|
||||||
|
@ -116,10 +116,15 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
wl_list_remove(&roots_surface->request_maximize.link);
|
wl_list_remove(&roots_surface->request_maximize.link);
|
||||||
wl_list_remove(&roots_surface->map_notify.link);
|
wl_list_remove(&roots_surface->map_notify.link);
|
||||||
wl_list_remove(&roots_surface->unmap_notify.link);
|
wl_list_remove(&roots_surface->unmap_notify.link);
|
||||||
view_destroy(roots_surface->view);
|
|
||||||
free(roots_surface);
|
free(roots_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
struct roots_xwayland_surface *roots_surface =
|
||||||
|
wl_container_of(listener, roots_surface, destroy);
|
||||||
|
view_destroy(roots_surface->view);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_request_configure(struct wl_listener *listener, void *data) {
|
static void handle_request_configure(struct wl_listener *listener, void *data) {
|
||||||
struct roots_xwayland_surface *roots_surface =
|
struct roots_xwayland_surface *roots_surface =
|
||||||
wl_container_of(listener, roots_surface, request_configure);
|
wl_container_of(listener, roots_surface, request_configure);
|
||||||
|
@ -307,6 +312,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
||||||
view->maximize = maximize;
|
view->maximize = maximize;
|
||||||
view->set_fullscreen = set_fullscreen;
|
view->set_fullscreen = set_fullscreen;
|
||||||
view->close = close;
|
view->close = close;
|
||||||
|
view->destroy = destroy;
|
||||||
roots_surface->view = view;
|
roots_surface->view = view;
|
||||||
|
|
||||||
view_map(view, surface->surface);
|
view_map(view, surface->surface);
|
||||||
|
|
Loading…
Reference in New Issue