diff options
author | Ivan Molodetskikh <yalterz@gmail.com> | 2019-10-09 16:06:30 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-11-17 20:18:42 +0100 |
commit | 5421198489675d4700e68eb143c94cda914c8586 (patch) | |
tree | 1f4f447dba45e302f2e35e1d3de81f6fccce64d5 /sway/desktop/surface.c | |
parent | output: add max_render_time (diff) | |
download | sway-5421198489675d4700e68eb143c94cda914c8586.tar.gz sway-5421198489675d4700e68eb143c94cda914c8586.tar.zst sway-5421198489675d4700e68eb143c94cda914c8586.zip |
Add sway_surface
For extending wlr_surface with additional things.
Diffstat (limited to 'sway/desktop/surface.c')
-rw-r--r-- | sway/desktop/surface.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <wlr/types/wlr_surface.h> | ||
3 | #include "sway/server.h" | ||
4 | #include "sway/surface.h" | ||
5 | |||
6 | void handle_destroy(struct wl_listener *listener, void *data) { | ||
7 | struct sway_surface *surface = wl_container_of(listener, surface, destroy); | ||
8 | |||
9 | surface->wlr_surface->data = NULL; | ||
10 | wl_list_remove(&surface->destroy.link); | ||
11 | |||
12 | free(surface); | ||
13 | } | ||
14 | |||
15 | void handle_compositor_new_surface(struct wl_listener *listener, void *data) { | ||
16 | struct wlr_surface *wlr_surface = data; | ||
17 | |||
18 | struct sway_surface *surface = calloc(1, sizeof(struct sway_surface)); | ||
19 | surface->wlr_surface = wlr_surface; | ||
20 | wlr_surface->data = surface; | ||
21 | |||
22 | surface->destroy.notify = handle_destroy; | ||
23 | wl_signal_add(&wlr_surface->events.destroy, &surface->destroy); | ||
24 | } | ||