From 5421198489675d4700e68eb143c94cda914c8586 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 9 Oct 2019 16:06:30 +0300 Subject: Add sway_surface For extending wlr_surface with additional things. --- sway/desktop/surface.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sway/desktop/surface.c (limited to 'sway/desktop') diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c new file mode 100644 index 00000000..41d4ce3f --- /dev/null +++ b/sway/desktop/surface.c @@ -0,0 +1,24 @@ +#include +#include +#include "sway/server.h" +#include "sway/surface.h" + +void handle_destroy(struct wl_listener *listener, void *data) { + struct sway_surface *surface = wl_container_of(listener, surface, destroy); + + surface->wlr_surface->data = NULL; + wl_list_remove(&surface->destroy.link); + + free(surface); +} + +void handle_compositor_new_surface(struct wl_listener *listener, void *data) { + struct wlr_surface *wlr_surface = data; + + struct sway_surface *surface = calloc(1, sizeof(struct sway_surface)); + surface->wlr_surface = wlr_surface; + wlr_surface->data = surface; + + surface->destroy.notify = handle_destroy; + wl_signal_add(&wlr_surface->events.destroy, &surface->destroy); +} -- cgit v1.2.3-54-g00ecf