diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index 67b442ad..aa4675ce 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -271,6 +271,42 @@ int output_name_cmp(const void *item, const void *data) { | |||
271 | return strcmp(output->name, name); | 271 | return strcmp(output->name, name); |
272 | } | 272 | } |
273 | 273 | ||
274 | void merge_output_config(struct output_config *dst, struct output_config *src) { | ||
275 | if (src->name) { | ||
276 | if (dst->name) { | ||
277 | free(dst->name); | ||
278 | } | ||
279 | dst->name = strdup(src->name); | ||
280 | } | ||
281 | if (src->enabled != -1) { | ||
282 | dst->enabled = src->enabled; | ||
283 | } | ||
284 | if (src->width != -1) { | ||
285 | dst->width = src->width; | ||
286 | } | ||
287 | if (src->height != -1) { | ||
288 | dst->height = src->height; | ||
289 | } | ||
290 | if (src->x != -1) { | ||
291 | dst->x = src->x; | ||
292 | } | ||
293 | if (src->y != -1) { | ||
294 | dst->y = src->y; | ||
295 | } | ||
296 | if (src->background) { | ||
297 | if (dst->background) { | ||
298 | free(dst->background); | ||
299 | } | ||
300 | dst->background = strdup(src->background); | ||
301 | } | ||
302 | if (src->background_option) { | ||
303 | if (dst->background_option) { | ||
304 | free(dst->background_option); | ||
305 | } | ||
306 | dst->background_option = strdup(src->background_option); | ||
307 | } | ||
308 | } | ||
309 | |||
274 | void apply_output_config(struct output_config *oc, swayc_t *output) { | 310 | void apply_output_config(struct output_config *oc, swayc_t *output) { |
275 | if (oc && oc->width > 0 && oc->height > 0) { | 311 | if (oc && oc->width > 0 && oc->height > 0) { |
276 | output->width = oc->width; | 312 | output->width = oc->width; |