Disconnect wl_shell clients when closing

This commit is contained in:
emersion 2017-10-06 16:44:55 +02:00
parent ecc0f712af
commit b21f783c34
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 29 additions and 22 deletions

View File

@ -17,6 +17,12 @@ static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
height);
}
static void close(struct roots_view *view) {
assert(view->type == ROOTS_WL_SHELL_VIEW);
struct wlr_wl_shell_surface *surf = view->wl_shell_surface;
wl_client_destroy(surf->client);
}
static void handle_request_move(struct wl_listener *listener, void *data) {
struct roots_wl_shell_surface *roots_surface =
wl_container_of(listener, roots_surface, request_move);
@ -88,6 +94,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
view->roots_wl_shell_surface = roots_surface;
view->wlr_surface = surface->surface;
view->resize = resize;
view->close = close;
view->desktop = desktop;
roots_surface->view = view;
list_add(desktop->views, view);

View File

@ -9,28 +9,6 @@
#include "rootston/desktop.h"
#include "rootston/server.h"
static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
wl_list_remove(&roots_surface->destroy.link);
view_destroy(roots_surface->view);
free(roots_surface);
}
static void handle_request_configure(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, request_configure);
struct wlr_xwayland_surface *xwayland_surface =
roots_surface->view->xwayland_surface;
struct wlr_xwayland_surface_configure_event *event = data;
roots_surface->view->x = (double)event->x;
roots_surface->view->y = (double)event->y;
wlr_xwayland_surface_configure(roots_surface->view->desktop->xwayland,
xwayland_surface, event->x, event->y, event->width, event->height);
}
static void activate(struct roots_view *view, bool active) {
assert(view->type == ROOTS_XWAYLAND_VIEW);
if (active) {
@ -53,6 +31,28 @@ static void close(struct roots_view *view) {
wlr_xwayland_surface_close(view->desktop->xwayland, view->xwayland_surface);
}
static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
wl_list_remove(&roots_surface->destroy.link);
view_destroy(roots_surface->view);
free(roots_surface);
}
static void handle_request_configure(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, request_configure);
struct wlr_xwayland_surface *xwayland_surface =
roots_surface->view->xwayland_surface;
struct wlr_xwayland_surface_configure_event *event = data;
roots_surface->view->x = (double)event->x;
roots_surface->view->y = (double)event->y;
wlr_xwayland_surface_configure(roots_surface->view->desktop->xwayland,
xwayland_surface, event->x, event->y, event->width, event->height);
}
void handle_xwayland_surface(struct wl_listener *listener, void *data) {
struct roots_desktop *desktop =
wl_container_of(listener, desktop, xwayland_surface);