mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Arrange backgrounds only when required
This commit is contained in:
		
							parent
							
								
									464239f7ac
								
							
						
					
					
						commit
						a2bc6f3bfd
					
				
					 4 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -59,6 +59,7 @@ void move_workspace_to(swayc_t* workspace, swayc_t* destination);
 | 
				
			||||||
void update_layout_geometry(swayc_t *parent, enum swayc_layouts prev_layout);
 | 
					void update_layout_geometry(swayc_t *parent, enum swayc_layouts prev_layout);
 | 
				
			||||||
void update_geometry(swayc_t *view);
 | 
					void update_geometry(swayc_t *view);
 | 
				
			||||||
void arrange_windows(swayc_t *container, double width, double height);
 | 
					void arrange_windows(swayc_t *container, double width, double height);
 | 
				
			||||||
 | 
					void arrange_backgrounds(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
swayc_t *get_focused_container(swayc_t *parent);
 | 
					swayc_t *get_focused_container(swayc_t *parent);
 | 
				
			||||||
swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);
 | 
					swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,6 +158,7 @@ bool set_focused_container(swayc_t *c) {
 | 
				
			||||||
		// rearrange if parent container is tabbed/stacked
 | 
							// rearrange if parent container is tabbed/stacked
 | 
				
			||||||
		swayc_t *parent = swayc_tabbed_stacked_ancestor(p);
 | 
							swayc_t *parent = swayc_tabbed_stacked_ancestor(p);
 | 
				
			||||||
		if (parent != NULL) {
 | 
							if (parent != NULL) {
 | 
				
			||||||
 | 
								arrange_backgrounds();
 | 
				
			||||||
			arrange_windows(parent, -1, -1);
 | 
								arrange_windows(parent, -1, -1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (p->type == C_WORKSPACE) {
 | 
						} else if (p->type == C_WORKSPACE) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -961,9 +961,12 @@ void arrange_windows(swayc_t *container, double width, double height) {
 | 
				
			||||||
	update_visibility(container);
 | 
						update_visibility(container);
 | 
				
			||||||
	arrange_windows_r(container, width, height);
 | 
						arrange_windows_r(container, width, height);
 | 
				
			||||||
	layout_log(&root_container, 0);
 | 
						layout_log(&root_container, 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void arrange_backgrounds(void) {
 | 
				
			||||||
 | 
						struct background_config *bg;
 | 
				
			||||||
	for (int i = 0; i < desktop_shell.backgrounds->length; ++i) {
 | 
						for (int i = 0; i < desktop_shell.backgrounds->length; ++i) {
 | 
				
			||||||
		struct background_config *bg = desktop_shell.backgrounds->items[i];
 | 
							bg = desktop_shell.backgrounds->items[i];
 | 
				
			||||||
		wlc_view_send_to_back(bg->handle);
 | 
							wlc_view_send_to_back(bg->handle);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -308,6 +308,7 @@ bool workspace_switch(swayc_t *workspace) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
 | 
						swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
 | 
				
			||||||
 | 
						arrange_backgrounds();
 | 
				
			||||||
	arrange_windows(output, -1, -1);
 | 
						arrange_windows(output, -1, -1);
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue