mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
Add sway_surface
For extending wlr_surface with additional things.
This commit is contained in:
parent
022df2542b
commit
5421198489
5 changed files with 43 additions and 0 deletions
24
sway/desktop/surface.c
Normal file
24
sway/desktop/surface.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <stdlib.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue