aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/container.c8
-rw-r--r--sway/extensions.c29
2 files changed, 34 insertions, 3 deletions
diff --git a/sway/container.c b/sway/container.c
index 3315fd93..c260e01a 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -82,13 +82,15 @@ swayc_t *new_output(wlc_handle handle) {
struct output_config *oc = NULL;
int i;
for (i = 0; i < config->output_configs->length; ++i) {
- oc = config->output_configs->items[i];
- if (strcasecmp(name, oc->name) == 0) {
+ struct output_config *cur = config->output_configs->items[i];
+ if (strcasecmp(name, cur->name) == 0) {
sway_log(L_DEBUG, "Matched output config for %s", name);
+ oc = cur;
break;
}
- if (strcasecmp("*", oc->name) == 0) {
+ if (strcasecmp("*", cur->name) == 0) {
sway_log(L_DEBUG, "Matched wildcard output config for %s", name);
+ oc = cur;
break;
}
}
diff --git a/sway/extensions.c b/sway/extensions.c
index 1f8e9a7c..18621015 100644
--- a/sway/extensions.c
+++ b/sway/extensions.c
@@ -8,6 +8,31 @@
struct desktop_shell_state desktop_shell;
+void background_surface_destructor(struct wl_resource *resource) {
+ sway_log(L_DEBUG, "Background surface killed");
+ int i;
+ for (i = 0; i < desktop_shell.backgrounds->length; ++i) {
+ struct background_config *config = desktop_shell.backgrounds->items[i];
+ if (config->resource == resource) {
+ list_del(desktop_shell.backgrounds, i);
+ break;
+ }
+ }
+}
+
+void panel_surface_destructor(struct wl_resource *resource) {
+ sway_log(L_DEBUG, "Panel surface killed");
+ int i;
+ for (i = 0; i < desktop_shell.panels->length; ++i) {
+ struct panel_config *config = desktop_shell.panels->items[i];
+ if (config->resource == resource) {
+ list_del(desktop_shell.panels, i);
+ arrange_windows(&root_container, -1, -1);
+ break;
+ }
+ }
+}
+
static void set_background(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *_output, struct wl_resource *surface) {
wlc_handle output = wlc_handle_from_wl_output_resource(_output);
@@ -18,7 +43,9 @@ 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;
list_add(desktop_shell.backgrounds, config);
+ wl_resource_set_destructor(surface, background_surface_destructor);
}
static void set_panel(struct wl_client *client, struct wl_resource *resource,
@@ -31,7 +58,9 @@ 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;
list_add(desktop_shell.panels, config);
+ wl_resource_set_destructor(surface, panel_surface_destructor);
desktop_shell.panel_size = *wlc_surface_get_size(config->surface);
arrange_windows(&root_container, -1, -1);
}