mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fix crash when resizing container hidden in the scratchpad
Firstly, the container was wrongly identifying as a tiling container because it had no workspace. Secondly, when calculating the maximum possible size we can't use the workspace if it's not there, so we'll allow unlimited size in this case.
This commit is contained in:
		
							parent
							
								
									cdbfc3338b
								
							
						
					
					
						commit
						662466e8db
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
					@ -94,7 +94,7 @@ static void calculate_constraints(int *min_width, int *max_width,
 | 
				
			||||||
		*min_height = config->floating_minimum_height;
 | 
							*min_height = config->floating_minimum_height;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (config->floating_maximum_width == -1) { // no maximum
 | 
						if (config->floating_maximum_width == -1 || !con->workspace) { // no max
 | 
				
			||||||
		*max_width = INT_MAX;
 | 
							*max_width = INT_MAX;
 | 
				
			||||||
	} else if (config->floating_maximum_width == 0) { // automatic
 | 
						} else if (config->floating_maximum_width == 0) { // automatic
 | 
				
			||||||
		*max_width = con->workspace->width;
 | 
							*max_width = con->workspace->width;
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ static void calculate_constraints(int *min_width, int *max_width,
 | 
				
			||||||
		*max_width = config->floating_maximum_width;
 | 
							*max_width = config->floating_maximum_width;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (config->floating_maximum_height == -1) { // no maximum
 | 
						if (config->floating_maximum_height == -1 || !con->workspace) { // no max
 | 
				
			||||||
		*max_height = INT_MAX;
 | 
							*max_height = INT_MAX;
 | 
				
			||||||
	} else if (config->floating_maximum_height == 0) { // automatic
 | 
						} else if (config->floating_maximum_height == 0) { // automatic
 | 
				
			||||||
		*max_height = con->workspace->height;
 | 
							*max_height = con->workspace->height;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -727,8 +727,14 @@ void container_set_geometry_from_floating_view(struct sway_container *con) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool container_is_floating(struct sway_container *container) {
 | 
					bool container_is_floating(struct sway_container *container) {
 | 
				
			||||||
	return !container->parent && container->workspace &&
 | 
						if (!container->parent && container->workspace &&
 | 
				
			||||||
		list_find(container->workspace->floating, container) != -1;
 | 
								list_find(container->workspace->floating, container) != -1) {
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (container->scratchpad) {
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void container_get_box(struct sway_container *container, struct wlr_box *box) {
 | 
					void container_get_box(struct sway_container *container, struct wlr_box *box) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue