mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	output: Add output_nearest_to()
Reimplement output_from_cursor_coords() as output_nearest_to_cursor().
This commit is contained in:
		
							parent
							
								
									84294c9cfb
								
							
						
					
					
						commit
						976136299d
					
				
					 5 changed files with 25 additions and 22 deletions
				
			
		
							
								
								
									
										28
									
								
								src/output.c
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								src/output.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -458,6 +458,25 @@ output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
 | 
			
		|||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct output *
 | 
			
		||||
output_nearest_to(struct server *server, int lx, int ly)
 | 
			
		||||
{
 | 
			
		||||
	double closest_x, closest_y;
 | 
			
		||||
	wlr_output_layout_closest_point(server->output_layout, NULL, lx, ly,
 | 
			
		||||
		&closest_x, &closest_y);
 | 
			
		||||
 | 
			
		||||
	return output_from_wlr_output(server,
 | 
			
		||||
		wlr_output_layout_output_at(server->output_layout,
 | 
			
		||||
			closest_x, closest_y));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct output *
 | 
			
		||||
output_nearest_to_cursor(struct server *server)
 | 
			
		||||
{
 | 
			
		||||
	return output_nearest_to(server, server->seat.cursor->x,
 | 
			
		||||
		server->seat.cursor->y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool
 | 
			
		||||
output_is_usable(struct output *output)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -518,15 +537,6 @@ output_usable_area_in_layout_coords(struct output *output)
 | 
			
		|||
	return box;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct output *
 | 
			
		||||
output_from_cursor_coords(struct server *server)
 | 
			
		||||
{
 | 
			
		||||
	struct wlr_output *wlr_output;
 | 
			
		||||
	wlr_output = wlr_output_layout_output_at(server->output_layout,
 | 
			
		||||
		server->seat.cursor->x, server->seat.cursor->y);
 | 
			
		||||
	return output_from_wlr_output(server, wlr_output);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue