diff options
| author | Drew DeVault <sir@cmpwn.com> | 2015-11-29 09:07:22 -0500 | 
|---|---|---|
| committer | Drew DeVault <sir@cmpwn.com> | 2015-11-29 09:07:22 -0500 | 
| commit | c942f1624e2b4af217076431465b8e4b87c0c3c6 (patch) | |
| tree | 7b015c5b2ace18d54a7769b67eed2336c7bec4bd /sway/config.c | |
| parent | 0af15cc19e4cfa27ff087bb1dc27f71cb4c921cf (diff) | |
| parent | 7059eccaa12e7f74d8dfd4744a05ec7d438c9f08 (diff) | |
| download | sway-c942f1624e2b4af217076431465b8e4b87c0c3c6.tar.xz | |
Merge pull request #275 from christophgysin/cmd_output
refactor cmd_output
Diffstat (limited to 'sway/config.c')
| -rw-r--r-- | sway/config.c | 16 | 
1 files changed, 11 insertions, 5 deletions
| diff --git a/sway/config.c b/sway/config.c index e9785aba..dd466e5b 100644 --- a/sway/config.c +++ b/sway/config.c @@ -261,6 +261,14 @@ bool read_config(FILE *file, bool is_active) {  	return success;  } +int output_name_cmp(const void *item, const void *data) +{ +	const struct output_config *output = item; +	const char *name = data; + +	return strcmp(output->name, name); +} +  void apply_output_config(struct output_config *oc, swayc_t *output) {  	if (oc && oc->width > 0 && oc->height > 0) {  		output->width = oc->width; @@ -291,12 +299,10 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {  	if (!oc || !oc->background) {  		// Look for a * config for background -		int i; -		for (i = 0; i < config->output_configs->length; ++i) { +		int i = list_seq_find(config->output_configs, output_name_cmp, "*"); +		if (i >= 0) {  			oc = config->output_configs->items[i]; -			if (strcasecmp("*", oc->name) == 0) { -				break; -			} +		} else {  			oc = NULL;  		}  	} | 
