mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fix wrong output container coordinates
This commit is contained in:
		
							parent
							
								
									deb63eda88
								
							
						
					
					
						commit
						f3ef1da750
					
				
					 2 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
					@ -123,11 +123,13 @@ void terminate_swaybg(pid_t pid) {
 | 
				
			||||||
void apply_output_config(struct output_config *oc, struct sway_container *output) {
 | 
					void apply_output_config(struct output_config *oc, struct sway_container *output) {
 | 
				
			||||||
	assert(output->type == C_OUTPUT);
 | 
						assert(output->type == C_OUTPUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct wlr_output_layout *output_layout =
 | 
				
			||||||
 | 
							root_container.sway_root->output_layout;
 | 
				
			||||||
	struct wlr_output *wlr_output = output->sway_output->wlr_output;
 | 
						struct wlr_output *wlr_output = output->sway_output->wlr_output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (oc && oc->enabled == 0) {
 | 
						if (oc && oc->enabled == 0) {
 | 
				
			||||||
		wlr_output_layout_remove(root_container.sway_root->output_layout,
 | 
					 | 
				
			||||||
			wlr_output);
 | 
					 | 
				
			||||||
		container_output_destroy(output);
 | 
							container_output_destroy(output);
 | 
				
			||||||
 | 
							wlr_output_layout_remove(output_layout, wlr_output);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,11 +150,9 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
 | 
				
			||||||
	// Find position for it
 | 
						// Find position for it
 | 
				
			||||||
	if (oc && (oc->x != -1 || oc->y != -1)) {
 | 
						if (oc && (oc->x != -1 || oc->y != -1)) {
 | 
				
			||||||
		wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
 | 
							wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
 | 
				
			||||||
		wlr_output_layout_add(root_container.sway_root->output_layout,
 | 
							wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y);
 | 
				
			||||||
			wlr_output, oc->x, oc->y);
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		wlr_output_layout_add_auto(root_container.sway_root->output_layout,
 | 
							wlr_output_layout_add_auto(output_layout, wlr_output);
 | 
				
			||||||
			wlr_output);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!oc || !oc->background) {
 | 
						if (!oc || !oc->background) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,8 +160,11 @@ struct sway_container *container_output_create(
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apply_output_config(oc, output);
 | 
						// Insert the child before applying config so that the container coordinates
 | 
				
			||||||
 | 
						// get updated
 | 
				
			||||||
	container_add_child(&root_container, output);
 | 
						container_add_child(&root_container, output);
 | 
				
			||||||
 | 
						apply_output_config(oc, output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	load_swaybars();
 | 
						load_swaybars();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Create workspace
 | 
						// Create workspace
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue