diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sway/config.c b/sway/config.c index e9785aba..dd466e5b 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -261,6 +261,14 @@ bool read_config(FILE *file, bool is_active) { | |||
261 | return success; | 261 | return success; |
262 | } | 262 | } |
263 | 263 | ||
264 | int output_name_cmp(const void *item, const void *data) | ||
265 | { | ||
266 | const struct output_config *output = item; | ||
267 | const char *name = data; | ||
268 | |||
269 | return strcmp(output->name, name); | ||
270 | } | ||
271 | |||
264 | void apply_output_config(struct output_config *oc, swayc_t *output) { | 272 | void apply_output_config(struct output_config *oc, swayc_t *output) { |
265 | if (oc && oc->width > 0 && oc->height > 0) { | 273 | if (oc && oc->width > 0 && oc->height > 0) { |
266 | output->width = oc->width; | 274 | output->width = oc->width; |
@@ -291,12 +299,10 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { | |||
291 | 299 | ||
292 | if (!oc || !oc->background) { | 300 | if (!oc || !oc->background) { |
293 | // Look for a * config for background | 301 | // Look for a * config for background |
294 | int i; | 302 | int i = list_seq_find(config->output_configs, output_name_cmp, "*"); |
295 | for (i = 0; i < config->output_configs->length; ++i) { | 303 | if (i >= 0) { |
296 | oc = config->output_configs->items[i]; | 304 | oc = config->output_configs->items[i]; |
297 | if (strcasecmp("*", oc->name) == 0) { | 305 | } else { |
298 | break; | ||
299 | } | ||
300 | oc = NULL; | 306 | oc = NULL; |
301 | } | 307 | } |
302 | } | 308 | } |