diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index 1fd123b7..a67322d1 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #endif | 21 | #endif |
22 | #include <wlr/types/wlr_output.h> | 22 | #include <wlr/types/wlr_output.h> |
23 | #include "sway/input/input-manager.h" | 23 | #include "sway/input/input-manager.h" |
24 | #include "sway/input/seat.h" | ||
24 | #include "sway/commands.h" | 25 | #include "sway/commands.h" |
25 | #include "sway/config.h" | 26 | #include "sway/config.h" |
26 | #include "sway/layout.h" | 27 | #include "sway/layout.h" |
@@ -109,6 +110,23 @@ void free_config(struct sway_config *config) { | |||
109 | free(config); | 110 | free(config); |
110 | } | 111 | } |
111 | 112 | ||
113 | static void destroy_removed_seats(struct sway_config *old_config, | ||
114 | struct sway_config *new_config) { | ||
115 | struct seat_config *seat_config; | ||
116 | struct sway_seat *seat; | ||
117 | int i; | ||
118 | for (i = 0; i < old_config->seat_configs->length; i++) { | ||
119 | seat_config = old_config->seat_configs->items[i]; | ||
120 | /* Also destroy seats that aren't present in new config */ | ||
121 | if (new_config && list_seq_find(new_config->seat_configs, | ||
122 | seat_name_cmp, seat_config->name) < 0) { | ||
123 | seat = input_manager_get_seat(input_manager, | ||
124 | seat_config->name); | ||
125 | sway_seat_destroy(seat); | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | |||
112 | static void config_defaults(struct sway_config *config) { | 130 | static void config_defaults(struct sway_config *config) { |
113 | if (!(config->symbols = create_list())) goto cleanup; | 131 | if (!(config->symbols = create_list())) goto cleanup; |
114 | if (!(config->modes = create_list())) goto cleanup; | 132 | if (!(config->modes = create_list())) goto cleanup; |
@@ -382,6 +400,7 @@ bool load_main_config(const char *file, bool is_active) { | |||
382 | } | 400 | } |
383 | 401 | ||
384 | if (old_config) { | 402 | if (old_config) { |
403 | destroy_removed_seats(old_config, config); | ||
385 | free_config(old_config); | 404 | free_config(old_config); |
386 | } | 405 | } |
387 | config->reading = false; | 406 | config->reading = false; |