mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-10-29 05:40:12 -04:00 
			
		
		
		
	backend/wayland: scale tablet tool position into [0, 1] range
Fixes #2233.
This commit is contained in:
		
							parent
							
								
									b03eebf7d4
								
							
						
					
					
						commit
						47a30957d1
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -28,6 +28,7 @@ struct wlr_wl_tablet_tool { | ||||||
| 	struct wlr_tablet_tool wlr_tool; | 	struct wlr_tablet_tool wlr_tool; | ||||||
| 
 | 
 | ||||||
| 	/* semi-static */ | 	/* semi-static */ | ||||||
|  | 	struct wlr_wl_output *output; | ||||||
| 	struct wlr_wl_input_device *tablet; | 	struct wlr_wl_input_device *tablet; | ||||||
| 	double pre_x, pre_y; | 	double pre_x, pre_y; | ||||||
| 
 | 
 | ||||||
|  | @ -551,12 +552,14 @@ static void handle_tablet_tool_proximity_in(void *data, | ||||||
| 	struct wlr_wl_tablet_tool *tool = data; | 	struct wlr_wl_tablet_tool *tool = data; | ||||||
| 	tool->is_in = true; | 	tool->is_in = true; | ||||||
| 	tool->tablet = zwp_tablet_v2_get_user_data(tablet_id); | 	tool->tablet = zwp_tablet_v2_get_user_data(tablet_id); | ||||||
|  | 	tool->output = wl_surface_get_user_data(surface); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void handle_tablet_tool_proximity_out(void *data, | static void handle_tablet_tool_proximity_out(void *data, | ||||||
| 		struct zwp_tablet_tool_v2 *id) { | 		struct zwp_tablet_tool_v2 *id) { | ||||||
| 	struct wlr_wl_tablet_tool *tool = data; | 	struct wlr_wl_tablet_tool *tool = data; | ||||||
| 	tool->is_out = true; | 	tool->is_out = true; | ||||||
|  | 	tool->output = NULL; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void handle_tablet_tool_down(void *data, | static void handle_tablet_tool_down(void *data, | ||||||
|  | @ -576,8 +579,11 @@ static void handle_tablet_tool_motion(void *data, | ||||||
| 		struct zwp_tablet_tool_v2 *id, | 		struct zwp_tablet_tool_v2 *id, | ||||||
| 		wl_fixed_t x, wl_fixed_t y) { | 		wl_fixed_t x, wl_fixed_t y) { | ||||||
| 	struct wlr_wl_tablet_tool *tool = data; | 	struct wlr_wl_tablet_tool *tool = data; | ||||||
| 	tool->x = wl_fixed_to_double(x); | 	struct wlr_wl_output *output = tool->output; | ||||||
| 	tool->y = wl_fixed_to_double(y); | 	assert(output); | ||||||
|  | 
 | ||||||
|  | 	tool->x = wl_fixed_to_double(x) / output->wlr_output.width; | ||||||
|  | 	tool->y = wl_fixed_to_double(y) / output->wlr_output.height; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void handle_tablet_tool_pressure(void *data, | static void handle_tablet_tool_pressure(void *data, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tudor Brindus
						Tudor Brindus