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 | 22c1c4beb4baa369f883fb5360c40158513c8e10 (diff) | |
| download | sway-a1b5b93d299bfe129f2b3409a7f642049fcce1d6.tar.xz | |
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 @@  #include "sway/commands.h"  #include "sway/config.h" +#include "sway/output.h" +#include "sway/tree/layout.h"  #include "list.h"  #include "log.h" @@ -80,16 +82,25 @@ struct cmd_results *cmd_output(int argc, char **argv) {  	// will be applied during normal "new output" event from wlroots.  	char identifier[128];  	bool all = strcmp(output->name, "*") == 0; -	for (int i = 0; i < root_container.children->length; ++i) { -		struct sway_container *cont = root_container.children->items[i]; -		if (cont->type != C_OUTPUT) { -			continue; -		} +	list_t *sway_outputs = root_container.sway_root->outputs; +	for (int i = 0; i < sway_outputs->length; ++i) { +		struct sway_output *sway_output = sway_outputs->items[i]; +		output_get_identifier(identifier, sizeof(identifier), sway_output); +		wlr_log(L_DEBUG, "Checking identifier %s", identifier); +		if (all || strcmp(sway_output->wlr_output->name, output->name) == 0 +				|| strcmp(identifier, output->name) == 0) { +			if (!sway_output->swayc) { +				if (!output->enabled) { +					if (!all) { +						break; +					} +					continue; +				} + +				output_enable(sway_output); +			} -		output_get_identifier(identifier, sizeof(identifier), cont->sway_output); -		if (all || strcmp(cont->name, output->name) == 0 || -				strcmp(identifier, output->name) == 0) { -			apply_output_config(output, cont); +			apply_output_config(output, sway_output->swayc);  			if (!all) {  				// Stop looking if the output config isn't applicable to all | 
