mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	view: Add view_min_size helper function
Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
		
							parent
							
								
									62123dc37e
								
							
						
					
					
						commit
						8652f97887
					
				
					 2 changed files with 29 additions and 0 deletions
				
			
		
							
								
								
									
										28
									
								
								src/view.c
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								src/view.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -29,6 +29,34 @@ view_move(struct view *view, double x, double y)
 | 
			
		|||
	view->impl->move(view, x, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define MIN_VIEW_WIDTH (100)
 | 
			
		||||
#define MIN_VIEW_HEIGHT (60)
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_min_size(struct view *view, int *w, int *h)
 | 
			
		||||
{
 | 
			
		||||
	int min_width = MIN_VIEW_WIDTH;
 | 
			
		||||
	int min_height = MIN_VIEW_HEIGHT;
 | 
			
		||||
#if HAVE_XWAYLAND
 | 
			
		||||
	if (view->type == LAB_XWAYLAND_VIEW) {
 | 
			
		||||
		if (view->xwayland_surface->size_hints) {
 | 
			
		||||
			if (view->xwayland_surface->size_hints->min_width > 0 ||
 | 
			
		||||
				view->xwayland_surface->size_hints->min_height > 0) {
 | 
			
		||||
				min_width = view->xwayland_surface->size_hints->min_width;
 | 
			
		||||
				min_height = view->xwayland_surface->size_hints->min_height;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (w) {
 | 
			
		||||
		*w = min_width;
 | 
			
		||||
	}
 | 
			
		||||
	if (h) {
 | 
			
		||||
		*h = min_height;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_minimize(struct view *view, bool minimized)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue