mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 13:13:17 +00:00
Destroy sub-surfaces with parent layer-shell surface
Closes: https://github.com/swaywm/sway/issues/6337
This commit is contained in:
parent
1bf1d84b75
commit
e2b4c573d6
|
@ -25,6 +25,8 @@ struct sway_layer_surface {
|
||||||
bool mapped;
|
bool mapped;
|
||||||
struct wlr_box extent;
|
struct wlr_box extent;
|
||||||
enum zwlr_layer_shell_v1_layer layer;
|
enum zwlr_layer_shell_v1_layer layer;
|
||||||
|
|
||||||
|
struct wl_list subsurfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_layer_popup {
|
struct sway_layer_popup {
|
||||||
|
@ -44,6 +46,7 @@ struct sway_layer_popup {
|
||||||
struct sway_layer_subsurface {
|
struct sway_layer_subsurface {
|
||||||
struct wlr_subsurface *wlr_subsurface;
|
struct wlr_subsurface *wlr_subsurface;
|
||||||
struct sway_layer_surface *layer_surface;
|
struct sway_layer_surface *layer_surface;
|
||||||
|
struct wl_list link;
|
||||||
|
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
|
|
|
@ -352,6 +352,8 @@ static void unmap(struct sway_layer_surface *sway_layer) {
|
||||||
sway_layer->layer_surface->surface, true);
|
sway_layer->layer_surface->surface, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void layer_subsurface_destroy(struct sway_layer_subsurface *subsurface);
|
||||||
|
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct sway_layer_surface *sway_layer =
|
struct sway_layer_surface *sway_layer =
|
||||||
wl_container_of(listener, sway_layer, destroy);
|
wl_container_of(listener, sway_layer, destroy);
|
||||||
|
@ -360,6 +362,12 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
if (sway_layer->layer_surface->mapped) {
|
if (sway_layer->layer_surface->mapped) {
|
||||||
unmap(sway_layer);
|
unmap(sway_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sway_layer_subsurface *subsurface, *subsurface_tmp;
|
||||||
|
wl_list_for_each_safe(subsurface, subsurface_tmp, &sway_layer->subsurfaces, link) {
|
||||||
|
layer_subsurface_destroy(subsurface);
|
||||||
|
}
|
||||||
|
|
||||||
wl_list_remove(&sway_layer->link);
|
wl_list_remove(&sway_layer->link);
|
||||||
wl_list_remove(&sway_layer->destroy.link);
|
wl_list_remove(&sway_layer->destroy.link);
|
||||||
wl_list_remove(&sway_layer->map.link);
|
wl_list_remove(&sway_layer->map.link);
|
||||||
|
@ -428,11 +436,8 @@ static void subsurface_handle_commit(struct wl_listener *listener, void *data) {
|
||||||
subsurface_damage(subsurface, false);
|
subsurface_damage(subsurface, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subsurface_handle_destroy(struct wl_listener *listener,
|
static void layer_subsurface_destroy(struct sway_layer_subsurface *subsurface) {
|
||||||
void *data) {
|
wl_list_remove(&subsurface->link);
|
||||||
struct sway_layer_subsurface *subsurface =
|
|
||||||
wl_container_of(listener, subsurface, destroy);
|
|
||||||
|
|
||||||
wl_list_remove(&subsurface->map.link);
|
wl_list_remove(&subsurface->map.link);
|
||||||
wl_list_remove(&subsurface->unmap.link);
|
wl_list_remove(&subsurface->unmap.link);
|
||||||
wl_list_remove(&subsurface->destroy.link);
|
wl_list_remove(&subsurface->destroy.link);
|
||||||
|
@ -440,6 +445,13 @@ static void subsurface_handle_destroy(struct wl_listener *listener,
|
||||||
free(subsurface);
|
free(subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void subsurface_handle_destroy(struct wl_listener *listener,
|
||||||
|
void *data) {
|
||||||
|
struct sway_layer_subsurface *subsurface =
|
||||||
|
wl_container_of(listener, subsurface, destroy);
|
||||||
|
layer_subsurface_destroy(subsurface);
|
||||||
|
}
|
||||||
|
|
||||||
static struct sway_layer_subsurface *create_subsurface(
|
static struct sway_layer_subsurface *create_subsurface(
|
||||||
struct wlr_subsurface *wlr_subsurface,
|
struct wlr_subsurface *wlr_subsurface,
|
||||||
struct sway_layer_surface *layer_surface) {
|
struct sway_layer_surface *layer_surface) {
|
||||||
|
@ -451,6 +463,7 @@ static struct sway_layer_subsurface *create_subsurface(
|
||||||
|
|
||||||
subsurface->wlr_subsurface = wlr_subsurface;
|
subsurface->wlr_subsurface = wlr_subsurface;
|
||||||
subsurface->layer_surface = layer_surface;
|
subsurface->layer_surface = layer_surface;
|
||||||
|
wl_list_insert(&layer_surface->subsurfaces, &subsurface->link);
|
||||||
|
|
||||||
subsurface->map.notify = subsurface_handle_map;
|
subsurface->map.notify = subsurface_handle_map;
|
||||||
wl_signal_add(&wlr_subsurface->events.map, &subsurface->map);
|
wl_signal_add(&wlr_subsurface->events.map, &subsurface->map);
|
||||||
|
@ -643,6 +656,8 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_list_init(&sway_layer->subsurfaces);
|
||||||
|
|
||||||
sway_layer->surface_commit.notify = handle_surface_commit;
|
sway_layer->surface_commit.notify = handle_surface_commit;
|
||||||
wl_signal_add(&layer_surface->surface->events.commit,
|
wl_signal_add(&layer_surface->surface->events.commit,
|
||||||
&sway_layer->surface_commit);
|
&sway_layer->surface_commit);
|
||||||
|
|
Loading…
Reference in a new issue