mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Set and check cursor surface role
This commit is contained in:
		
							parent
							
								
									8a77d1b6a2
								
							
						
					
					
						commit
						cebb202f7d
					
				
					 2 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
					@ -198,6 +198,10 @@ static void handle_cursor_surface_destroy(struct wl_listener *listener,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_output_set_cursor_surface(struct wlr_output *output,
 | 
					void wlr_output_set_cursor_surface(struct wlr_output *output,
 | 
				
			||||||
		struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y) {
 | 
							struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y) {
 | 
				
			||||||
 | 
						if (strcmp(surface->role, "cursor") != 0) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output->cursor.hotspot_x = hotspot_x;
 | 
						output->cursor.hotspot_x = hotspot_x;
 | 
				
			||||||
	output->cursor.hotspot_y = hotspot_y;
 | 
						output->cursor.hotspot_y = hotspot_y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,11 @@ static void wl_pointer_set_cursor(struct wl_client *client,
 | 
				
			||||||
	struct wlr_surface *surface = NULL;
 | 
						struct wlr_surface *surface = NULL;
 | 
				
			||||||
	if (surface_resource != NULL) {
 | 
						if (surface_resource != NULL) {
 | 
				
			||||||
		surface = wl_resource_get_user_data(surface_resource);
 | 
							surface = wl_resource_get_user_data(surface_resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (wlr_surface_set_role(surface, "cursor", resource,
 | 
				
			||||||
 | 
									WL_POINTER_ERROR_ROLE) < 0) {
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_seat_pointer_request_set_cursor_event *event =
 | 
						struct wlr_seat_pointer_request_set_cursor_event *event =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue