mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Prefer named output config over wildcard config.
This makes sure that a named output config is applied before the
general wildcard config when a new output is created. This ensures that
the config:
    output * ...
    output NAME ...
behaves the same way as:
    output NAME ...
    output * ...
			
			
This commit is contained in:
		
							parent
							
								
									91d6113d4a
								
							
						
					
					
						commit
						016a77424a
					
				
					 1 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
					@ -90,22 +90,28 @@ swayc_t *new_output(wlc_handle handle) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sway_log(L_DEBUG, "New output %lu:%s", handle, name);
 | 
						sway_log(L_DEBUG, "New output %lu:%s", handle, name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct output_config *oc = NULL;
 | 
						struct output_config *oc = NULL, *all = NULL;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	for (i = 0; i < config->output_configs->length; ++i) {
 | 
						for (i = 0; i < config->output_configs->length; ++i) {
 | 
				
			||||||
		struct output_config *cur = config->output_configs->items[i];
 | 
							struct output_config *cur = config->output_configs->items[i];
 | 
				
			||||||
		if (strcasecmp(name, cur->name) == 0) {
 | 
							if (strcasecmp(name, cur->name) == 0) {
 | 
				
			||||||
			sway_log(L_DEBUG, "Matched output config for %s", name);
 | 
								sway_log(L_DEBUG, "Matched output config for %s", name);
 | 
				
			||||||
			oc = cur;
 | 
								oc = cur;
 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (strcasecmp("*", cur->name) == 0) {
 | 
							if (strcasecmp("*", cur->name) == 0) {
 | 
				
			||||||
			sway_log(L_DEBUG, "Matched wildcard output config for %s", name);
 | 
								sway_log(L_DEBUG, "Matched wildcard output config for %s", name);
 | 
				
			||||||
			oc = cur;
 | 
								all = cur;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (oc && all) {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!oc) {
 | 
				
			||||||
 | 
							oc = all;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (oc && !oc->enabled) {
 | 
						if (oc && !oc->enabled) {
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue