diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-06-05 17:56:32 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-06-06 20:11:24 -0400 |
commit | a1b5b93d299bfe129f2b3409a7f642049fcce1d6 (patch) | |
tree | 4d87f5ab8f0f18ada1fc12a4eb4ba3b5d0350527 /sway/commands/output.c | |
parent | Merge pull request #2116 from RedSoxFan/fix-2113 (diff) | |
download | sway-a1b5b93d299bfe129f2b3409a7f642049fcce1d6.tar.gz sway-a1b5b93d299bfe129f2b3409a7f642049fcce1d6.tar.zst sway-a1b5b93d299bfe129f2b3409a7f642049fcce1d6.zip |
Store sway_outputs so that they can be reenabled
Diffstat (limited to 'sway/commands/output.c')
-rw-r--r-- | sway/commands/output.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sway/commands/output.c b/sway/commands/output.c index bc12310e..6c789cc9 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "sway/commands.h" | 1 | #include "sway/commands.h" |
2 | #include "sway/config.h" | 2 | #include "sway/config.h" |
3 | #include "sway/output.h" | ||
4 | #include "sway/tree/layout.h" | ||
3 | #include "list.h" | 5 | #include "list.h" |
4 | #include "log.h" | 6 | #include "log.h" |
5 | 7 | ||
@@ -80,16 +82,25 @@ struct cmd_results *cmd_output(int argc, char **argv) { | |||
80 | // will be applied during normal "new output" event from wlroots. | 82 | // will be applied during normal "new output" event from wlroots. |
81 | char identifier[128]; | 83 | char identifier[128]; |
82 | bool all = strcmp(output->name, "*") == 0; | 84 | bool all = strcmp(output->name, "*") == 0; |
83 | for (int i = 0; i < root_container.children->length; ++i) { | 85 | list_t *sway_outputs = root_container.sway_root->outputs; |
84 | struct sway_container *cont = root_container.children->items[i]; | 86 | for (int i = 0; i < sway_outputs->length; ++i) { |
85 | if (cont->type != C_OUTPUT) { | 87 | struct sway_output *sway_output = sway_outputs->items[i]; |
86 | continue; | 88 | output_get_identifier(identifier, sizeof(identifier), sway_output); |
87 | } | 89 | wlr_log(L_DEBUG, "Checking identifier %s", identifier); |
90 | if (all || strcmp(sway_output->wlr_output->name, output->name) == 0 | ||
91 | || strcmp(identifier, output->name) == 0) { | ||
92 | if (!sway_output->swayc) { | ||
93 | if (!output->enabled) { | ||
94 | if (!all) { | ||
95 | break; | ||
96 | } | ||
97 | continue; | ||
98 | } | ||
99 | |||
100 | output_enable(sway_output); | ||
101 | } | ||
88 | 102 | ||
89 | output_get_identifier(identifier, sizeof(identifier), cont->sway_output); | 103 | apply_output_config(output, sway_output->swayc); |
90 | if (all || strcmp(cont->name, output->name) == 0 || | ||
91 | strcmp(identifier, output->name) == 0) { | ||
92 | apply_output_config(output, cont); | ||
93 | 104 | ||
94 | if (!all) { | 105 | if (!all) { |
95 | // Stop looking if the output config isn't applicable to all | 106 | // Stop looking if the output config isn't applicable to all |