diff --git a/include/extensions.h b/include/extensions.h index 311ead1d..67c7d5fe 100644 --- a/include/extensions.h +++ b/include/extensions.h @@ -9,13 +9,15 @@ struct background_config { wlc_handle output; wlc_resource surface; - struct wl_resource *resource; + // we need the wl_resource of the surface in the destructor + struct wl_resource *wl_surface_res; }; struct panel_config { wlc_handle output; wlc_resource surface; - struct wl_resource *resource; + // we need the wl_resource of the surface in the destructor + struct wl_resource *wl_surface_res; }; struct desktop_shell_state { diff --git a/sway/extensions.c b/sway/extensions.c index 5e09bdbb..d37eaddd 100644 --- a/sway/extensions.c +++ b/sway/extensions.c @@ -14,7 +14,7 @@ void background_surface_destructor(struct wl_resource *resource) { int i; for (i = 0; i < desktop_shell.backgrounds->length; ++i) { struct background_config *config = desktop_shell.backgrounds->items[i]; - if (config->resource == resource) { + if (config->wl_surface_res == resource) { list_del(desktop_shell.backgrounds, i); break; } @@ -26,7 +26,7 @@ void panel_surface_destructor(struct wl_resource *resource) { int i; for (i = 0; i < desktop_shell.panels->length; ++i) { struct panel_config *config = desktop_shell.panels->items[i]; - if (config->resource == resource) { + if (config->wl_surface_res == resource) { list_del(desktop_shell.panels, i); arrange_windows(&root_container, -1, -1); break; @@ -58,7 +58,7 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc struct background_config *config = malloc(sizeof(struct background_config)); config->output = output; config->surface = wlc_resource_from_wl_surface_resource(surface); - config->resource = surface; + config->wl_surface_res = surface; list_add(desktop_shell.backgrounds, config); wl_resource_set_destructor(surface, background_surface_destructor); } @@ -73,7 +73,7 @@ static void set_panel(struct wl_client *client, struct wl_resource *resource, struct panel_config *config = malloc(sizeof(struct panel_config)); config->output = output; config->surface = wlc_resource_from_wl_surface_resource(surface); - config->resource = surface; + config->wl_surface_res = surface; list_add(desktop_shell.panels, config); wl_resource_set_destructor(surface, panel_surface_destructor); desktop_shell.panel_size = *wlc_surface_get_size(config->surface);