mirror of
				https://github.com/labwc/labwc.git
				synced 2025-10-29 05:40:24 -04:00 
			
		
		
		
	view: respect client-initiated resize of non-maximized axis
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				labwc.github.io / notify (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	labwc.github.io / notify (push) Has been cancelled
				
			When implementing single-axis maximize some time ago, I made the simplifying assumption that a view couldn't be resized while maximized (even in only one axis). And indeed for compositor-initiated resize, we always unmaximize the view first. However, I didn't account for the client resizing the non-maximized axis, which we can't (and shouldn't) prevent. When this happens, we should also update the natural geometry of that single axis so that we don't undo the resize when un-maximizing. P.S. xdg-shell clients resizing the *maximized* axis is still an unsolved problem, exacerbated by the fact that xdg-shell protocol doesn't allow clients to even know about single-axis maximize. P.P.S. the view_invalidate_last_layout_geometry() logic may need similar updates, I'm not sure.
This commit is contained in:
		
							parent
							
								
									888dbedeed
								
							
						
					
					
						commit
						ebd39dfe0d
					
				
					 2 changed files with 25 additions and 6 deletions
				
			
		|  | @ -90,9 +90,9 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges) | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		/* Store natural geometry at start of move */ | ||||||
|  | 		view_store_natural_geometry(view); | ||||||
| 		if (view_is_floating(view)) { | 		if (view_is_floating(view)) { | ||||||
| 			/* Store natural geometry at start of move */ |  | ||||||
| 			view_store_natural_geometry(view); |  | ||||||
| 			view_invalidate_last_layout_geometry(view); | 			view_invalidate_last_layout_geometry(view); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								src/view.c
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								src/view.c
									
										
									
									
									
								
							|  | @ -971,8 +971,11 @@ void | ||||||
| view_store_natural_geometry(struct view *view) | view_store_natural_geometry(struct view *view) | ||||||
| { | { | ||||||
| 	assert(view); | 	assert(view); | ||||||
| 	if (!view_is_floating(view)) { | 	/*
 | ||||||
| 		/* Do not overwrite the stored geometry with special cases */ | 	 * Do not overwrite the stored geometry if fullscreen or tiled. | ||||||
|  | 	 * Maximized views are handled on a per-axis basis (see below). | ||||||
|  | 	 */ | ||||||
|  | 	if (view->fullscreen || view_is_tiled(view)) { | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -983,7 +986,14 @@ view_store_natural_geometry(struct view *view) | ||||||
| 	 * xdg-toplevel configure event, which means the application should | 	 * xdg-toplevel configure event, which means the application should | ||||||
| 	 * choose its own size. | 	 * choose its own size. | ||||||
| 	 */ | 	 */ | ||||||
| 	view->natural_geometry = view->pending; | 	if (!(view->maximized & VIEW_AXIS_HORIZONTAL)) { | ||||||
|  | 		view->natural_geometry.x = view->pending.x; | ||||||
|  | 		view->natural_geometry.width = view->pending.width; | ||||||
|  | 	} | ||||||
|  | 	if (!(view->maximized & VIEW_AXIS_VERTICAL)) { | ||||||
|  | 		view->natural_geometry.y = view->pending.y; | ||||||
|  | 		view->natural_geometry.height = view->pending.height; | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int | int | ||||||
|  | @ -1472,11 +1482,20 @@ view_maximize(struct view *view, enum view_axis axis, | ||||||
| 		 */ | 		 */ | ||||||
| 		interactive_cancel(view); | 		interactive_cancel(view); | ||||||
| 		if (store_natural_geometry && view_is_floating(view)) { | 		if (store_natural_geometry && view_is_floating(view)) { | ||||||
| 			view_store_natural_geometry(view); |  | ||||||
| 			view_invalidate_last_layout_geometry(view); | 			view_invalidate_last_layout_geometry(view); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/*
 | ||||||
|  | 	 * Update natural geometry for any axis that wasn't already | ||||||
|  | 	 * maximized. This is needed even when unmaximizing, because in | ||||||
|  | 	 * single-axis cases the client may have resized the other axis | ||||||
|  | 	 * while one axis was maximized. | ||||||
|  | 	 */ | ||||||
|  | 	if (store_natural_geometry) { | ||||||
|  | 		view_store_natural_geometry(view); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * When natural geometry is unknown (0x0) for an xdg-shell view, | 	 * When natural geometry is unknown (0x0) for an xdg-shell view, | ||||||
| 	 * we normally send a configure event of 0x0 to get the client's | 	 * we normally send a configure event of 0x0 to get the client's | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 John Lindgren
						John Lindgren