aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/config.h4
-rw-r--r--sway/commands/output.c3
-rw-r--r--sway/config/output.c7
-rw-r--r--sway/tree/container.c1
4 files changed, 9 insertions, 6 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index 231356f2..4dd8e94c 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -364,10 +364,8 @@ void apply_input_config(struct input_config *ic, struct libinput_device *dev);
364void free_input_config(struct input_config *ic); 364void free_input_config(struct input_config *ic);
365 365
366int output_name_cmp(const void *item, const void *data); 366int output_name_cmp(const void *item, const void *data);
367void output_config_defaults(struct output_config *oc); 367struct output_config *new_output_config();
368void merge_output_config(struct output_config *dst, struct output_config *src); 368void merge_output_config(struct output_config *dst, struct output_config *src);
369/** Sets up a WLC output handle based on a given output_config.
370 */
371void apply_output_config(struct output_config *oc, swayc_t *output); 369void apply_output_config(struct output_config *oc, swayc_t *output);
372void free_output_config(struct output_config *oc); 370void free_output_config(struct output_config *oc);
373 371
diff --git a/sway/commands/output.c b/sway/commands/output.c
index bbf8efc3..11da0ff6 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -27,11 +27,10 @@ struct cmd_results *cmd_output(int argc, char **argv) {
27 } 27 }
28 const char *name = argv[0]; 28 const char *name = argv[0];
29 29
30 struct output_config *output = calloc(1, sizeof(struct output_config)); 30 struct output_config *output = new_output_config();
31 if (!output) { 31 if (!output) {
32 return cmd_results_new(CMD_FAILURE, "output", "Unable to allocate output config"); 32 return cmd_results_new(CMD_FAILURE, "output", "Unable to allocate output config");
33 } 33 }
34 output_config_defaults(output);
35 output->name = strdup(name); 34 output->name = strdup(name);
36 35
37 // TODO: atoi doesn't handle invalid numbers 36 // TODO: atoi doesn't handle invalid numbers
diff --git a/sway/config/output.c b/sway/config/output.c
index 4a0a5cc9..26798503 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -14,13 +14,18 @@ int output_name_cmp(const void *item, const void *data) {
14 return strcmp(output->name, name); 14 return strcmp(output->name, name);
15} 15}
16 16
17void output_config_defaults(struct output_config *oc) { 17struct output_config *new_output_config() {
18 struct output_config *oc = calloc(1, sizeof(struct output_config));
19 if (oc == NULL) {
20 return NULL;
21 }
18 oc->enabled = -1; 22 oc->enabled = -1;
19 oc->width = oc->height -1; 23 oc->width = oc->height -1;
20 oc->refresh_rate = -1; 24 oc->refresh_rate = -1;
21 oc->x = oc->y = -1; 25 oc->x = oc->y = -1;
22 oc->scale = -1; 26 oc->scale = -1;
23 oc->transform = -1; 27 oc->transform = -1;
28 return oc;
24} 29}
25 30
26void merge_output_config(struct output_config *dst, struct output_config *src) { 31void merge_output_config(struct output_config *dst, struct output_config *src) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index ec3311a0..d9bed7d8 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -93,6 +93,7 @@ swayc_t *new_output(struct sway_output *sway_output) {
93 sway_log(L_DEBUG, "Creating default workspace %s", ws_name); 93 sway_log(L_DEBUG, "Creating default workspace %s", ws_name);
94 new_workspace(output, ws_name); 94 new_workspace(output, ws_name);
95 free(ws_name); 95 free(ws_name);
96 update_root_geometry();
96 return output; 97 return output;
97} 98}
98 99