mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	view: fix bug in view_snap_to_edge()
Use view_move() and view_move_resize() correctly. view_move_resize() should only be used when the view actually changes width and/or height, otherwise the serials might cause a delay in moving xdg-shell clients. Issue #201
This commit is contained in:
		
							parent
							
								
									cef9723505
								
							
						
					
					
						commit
						be89478f7a
					
				
					 2 changed files with 28 additions and 11 deletions
				
			
		
							
								
								
									
										30
									
								
								src/view.c
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								src/view.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -24,16 +24,6 @@ view_close(struct view *view)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_move_resize(struct view *view, struct wlr_box geo)
 | 
			
		||||
{
 | 
			
		||||
	if (view->impl->configure) {
 | 
			
		||||
		view->impl->configure(view, geo);
 | 
			
		||||
	}
 | 
			
		||||
	ssd_update_title(view);
 | 
			
		||||
	view_discover_output(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_move(struct view *view, double x, double y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +33,19 @@ view_move(struct view *view, double x, double y)
 | 
			
		|||
	view_discover_output(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_move_resize(struct view *view, struct wlr_box geo)
 | 
			
		||||
{
 | 
			
		||||
	if (view->w == geo.width && view->h == geo.height) {
 | 
			
		||||
		wlr_log(WLR_ERROR, "use view_move() if not resizing");
 | 
			
		||||
	}
 | 
			
		||||
	if (view->impl->configure) {
 | 
			
		||||
		view->impl->configure(view, geo);
 | 
			
		||||
	}
 | 
			
		||||
	ssd_update_title(view);
 | 
			
		||||
	view_discover_output(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define MIN_VIEW_WIDTH (100)
 | 
			
		||||
#define MIN_VIEW_HEIGHT (60)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -602,7 +605,12 @@ view_snap_to_edge(struct view *view, const char *direction)
 | 
			
		|||
			view_edge_invert(edge));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	view_move_resize(view, dst);
 | 
			
		||||
	if (view->w == dst.width && view->h == dst.height) {
 | 
			
		||||
		/* move horizontally/vertically without changing size */
 | 
			
		||||
		view_move(view, dst.x, dst.y);
 | 
			
		||||
	} else {
 | 
			
		||||
		view_move_resize(view, dst);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue