mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fix apply_output_config return value when enabling output
apply_output_config would call output_enable and always return true, even if the output couldn't be enabled.
This commit is contained in:
		
							parent
							
								
									43bd8dc437
								
							
						
					
					
						commit
						58a40ce07b
					
				
					 3 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
					@ -90,7 +90,7 @@ struct sway_output *all_output_by_name_or_id(const char *name_or_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void output_sort_workspaces(struct sway_output *output);
 | 
					void output_sort_workspaces(struct sway_output *output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void output_enable(struct sway_output *output, struct output_config *oc);
 | 
					bool output_enable(struct sway_output *output, struct output_config *oc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void output_disable(struct sway_output *output);
 | 
					void output_disable(struct sway_output *output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,8 +249,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
 | 
				
			||||||
		if (!oc || oc->dpms_state != DPMS_OFF) {
 | 
							if (!oc || oc->dpms_state != DPMS_OFF) {
 | 
				
			||||||
			wlr_output_enable(wlr_output, true);
 | 
								wlr_output_enable(wlr_output, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		output_enable(output, oc);
 | 
							return output_enable(output, oc);
 | 
				
			||||||
		return true;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (oc && oc->dpms_state == DPMS_ON) {
 | 
						if (oc && oc->dpms_state == DPMS_ON) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,9 +104,9 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
 | 
				
			||||||
	return output;
 | 
						return output;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void output_enable(struct sway_output *output, struct output_config *oc) {
 | 
					bool output_enable(struct sway_output *output, struct output_config *oc) {
 | 
				
			||||||
	if (!sway_assert(!output->enabled, "output is already enabled")) {
 | 
						if (!sway_assert(!output->enabled, "output is already enabled")) {
 | 
				
			||||||
		return;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	struct wlr_output *wlr_output = output->wlr_output;
 | 
						struct wlr_output *wlr_output = output->wlr_output;
 | 
				
			||||||
	size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
 | 
						size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
 | 
				
			||||||
| 
						 | 
					@ -117,7 +117,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
 | 
				
			||||||
	output->enabled = true;
 | 
						output->enabled = true;
 | 
				
			||||||
	if (!apply_output_config(oc, output)) {
 | 
						if (!apply_output_config(oc, output)) {
 | 
				
			||||||
		output->enabled = false;
 | 
							output->enabled = false;
 | 
				
			||||||
		return;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output->configured = true;
 | 
						output->configured = true;
 | 
				
			||||||
| 
						 | 
					@ -155,6 +155,8 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	arrange_layers(output);
 | 
						arrange_layers(output);
 | 
				
			||||||
	arrange_root();
 | 
						arrange_root();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void evacuate_sticky(struct sway_workspace *old_ws,
 | 
					static void evacuate_sticky(struct sway_workspace *old_ws,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue