mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Better handling of hidden cursors in wayland backend, add TODOs
This commit is contained in:
		
							parent
							
								
									92daa790bb
								
							
						
					
					
						commit
						19860c03f7
					
				
					 3 changed files with 12 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -66,8 +66,12 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
 | 
			
		|||
	}
 | 
			
		||||
	if (!buf) {
 | 
			
		||||
		// Hide cursor
 | 
			
		||||
		wl_pointer_set_cursor(output->backend->pointer, output->enter_serial,
 | 
			
		||||
			NULL, 0, 0);
 | 
			
		||||
		wl_surface_destroy(output->cursor_surface);
 | 
			
		||||
		munmap(output->cursor_data, output->cursor_buf_size);
 | 
			
		||||
		output->cursor_surface = NULL;
 | 
			
		||||
		output->cursor_buf_size = 0;
 | 
			
		||||
		wlr_wl_output_update_cursor(output, output->enter_serial, hotspot_x,
 | 
			
		||||
			hotspot_y);
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +164,7 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
 | 
			
		|||
 | 
			
		||||
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output,
 | 
			
		||||
			uint32_t serial, int32_t hotspot_x, int32_t hotspot_y) {
 | 
			
		||||
	if (output->cursor_surface && output->backend->pointer && serial) {
 | 
			
		||||
	if (output->backend->pointer && serial) {
 | 
			
		||||
		wl_pointer_set_cursor(output->backend->pointer, serial,
 | 
			
		||||
			output->cursor_surface, hotspot_x, hotspot_y);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -259,7 +259,9 @@ void wlr_output_set_cursor_surface(struct wlr_output *output,
 | 
			
		|||
		wl_signal_add(&surface->events.commit, &output->cursor.surface_commit);
 | 
			
		||||
		wl_signal_add(&surface->events.destroy,
 | 
			
		||||
			&output->cursor.surface_destroy);
 | 
			
		||||
		commit_cursor_surface(output, surface);
 | 
			
		||||
		// TODO: doing it breaks GTK apps
 | 
			
		||||
		// TODO: not doing it breaks weston-subsurfaces
 | 
			
		||||
		//commit_cursor_surface(output, surface);
 | 
			
		||||
	} else {
 | 
			
		||||
		set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -429,7 +429,8 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
 | 
			
		|||
 | 
			
		||||
	// Release the buffer after calling commit, because some listeners
 | 
			
		||||
	// might need it (e.g. for cursor surfaces)
 | 
			
		||||
	wlr_surface_state_release_buffer(surface->current);
 | 
			
		||||
	// TODO: breaks weston-subsurfaces
 | 
			
		||||
	//wlr_surface_state_release_buffer(surface->current);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue