summaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2015-11-29 16:26:11 -0500
committerDrew DeVault <[email protected]>2015-11-29 16:26:11 -0500
commit3f950b6e526baaf719f5a7b5d7085f6468b16b29 (patch)
tree225c3470228ee2f5ac29d29ca046132154404f43 /sway/config.c
parente906b4e24059093093b76e44029b7b8408e2a250 (diff)
parentb1bd3ae6f3210e6b3ecda2d253518da18420e6cd (diff)
Merge pull request #278 from christophgysin/merge
cmd_output: Merge instead of replace output config
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c36
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) {
return strcmp(output->name, name);
}
+void merge_output_config(struct output_config *dst, struct output_config *src) {
+ if (src->name) {
+ if (dst->name) {
+ free(dst->name);
+ }
+ dst->name = strdup(src->name);
+ }
+ if (src->enabled != -1) {
+ dst->enabled = src->enabled;
+ }
+ if (src->width != -1) {
+ dst->width = src->width;
+ }
+ if (src->height != -1) {
+ dst->height = src->height;
+ }
+ if (src->x != -1) {
+ dst->x = src->x;
+ }
+ if (src->y != -1) {
+ dst->y = src->y;
+ }
+ if (src->background) {
+ if (dst->background) {
+ free(dst->background);
+ }
+ dst->background = strdup(src->background);
+ }
+ if (src->background_option) {
+ if (dst->background_option) {
+ free(dst->background_option);
+ }
+ dst->background_option = strdup(src->background_option);
+ }
+}
+
void apply_output_config(struct output_config *oc, swayc_t *output) {
if (oc && oc->width > 0 && oc->height > 0) {
output->width = oc->width;