mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Fix cursor role name, fix segfault when surface->resource is NULL
This commit is contained in:
		
							parent
							
								
									29abf93bb6
								
							
						
					
					
						commit
						8fd4ae5de8
					
				
					 3 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -306,8 +306,8 @@ static void handle_request_set_cursor(struct wl_listener *listener,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_surface *focused_surface =
 | 
						struct wlr_surface *focused_surface =
 | 
				
			||||||
		event->seat_handle->wlr_seat->pointer_state.focused_surface;
 | 
							event->seat_handle->wlr_seat->pointer_state.focused_surface;
 | 
				
			||||||
	bool ok = focused_surface != NULL;
 | 
						bool ok = focused_surface != NULL && focused_surface->resource != NULL;
 | 
				
			||||||
	if (focused_surface != NULL) {
 | 
						if (ok) {
 | 
				
			||||||
		struct wl_client *focused_client =
 | 
							struct wl_client *focused_client =
 | 
				
			||||||
			wl_resource_get_client(focused_surface->resource);
 | 
								wl_resource_get_client(focused_surface->resource);
 | 
				
			||||||
		ok = event->client == focused_client;
 | 
							ok = event->client == focused_client;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,7 +231,7 @@ 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 (surface && strcmp(surface->role, "cursor") != 0) {
 | 
						if (surface && strcmp(surface->role, "wl_pointer-cursor") != 0) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ static void wl_pointer_set_cursor(struct wl_client *client,
 | 
				
			||||||
	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,
 | 
							if (wlr_surface_set_role(surface, "wl_pointer-cursor", resource,
 | 
				
			||||||
				WL_POINTER_ERROR_ROLE) < 0) {
 | 
									WL_POINTER_ERROR_ROLE) < 0) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue