mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	cursor: only reset the cursor when the surface changes
If the set_cursor request is used with the same surface, don't call cursor_output_cursor_reset_image(). That function sends wl_surface.leave and can cause an infinite feedback loop with some clients (submitting a LoDPI cursor when the surface leaves an HiDPI output). Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3669
This commit is contained in:
		
							parent
							
								
									05dd08afe5
								
							
						
					
					
						commit
						6e8fb5509f
					
				
					 1 changed files with 20 additions and 16 deletions
				
			
		| 
						 | 
					@ -469,26 +469,30 @@ void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		cursor_output_cursor_reset_image(output_cursor);
 | 
							if (surface != output_cursor->surface) {
 | 
				
			||||||
 | 
								// Only send wl_surface.leave if the surface changes
 | 
				
			||||||
 | 
								cursor_output_cursor_reset_image(output_cursor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								output_cursor->surface = surface;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								wl_signal_add(&surface->events.destroy,
 | 
				
			||||||
 | 
									&output_cursor->surface_destroy);
 | 
				
			||||||
 | 
								output_cursor->surface_destroy.notify =
 | 
				
			||||||
 | 
									output_cursor_output_handle_surface_destroy;
 | 
				
			||||||
 | 
								wl_signal_add(&surface->events.commit,
 | 
				
			||||||
 | 
									&output_cursor->surface_commit);
 | 
				
			||||||
 | 
								output_cursor->surface_commit.notify =
 | 
				
			||||||
 | 
									output_cursor_output_handle_surface_commit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								wl_signal_add(&output_cursor->output_cursor->output->events.commit,
 | 
				
			||||||
 | 
									&output_cursor->output_commit);
 | 
				
			||||||
 | 
								output_cursor->output_commit.notify =
 | 
				
			||||||
 | 
									output_cursor_output_handle_output_commit;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		output_cursor->surface = surface;
 | 
					 | 
				
			||||||
		output_cursor->surface_hotspot.x = hotspot_x;
 | 
							output_cursor->surface_hotspot.x = hotspot_x;
 | 
				
			||||||
		output_cursor->surface_hotspot.y = hotspot_y;
 | 
							output_cursor->surface_hotspot.y = hotspot_y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wl_signal_add(&surface->events.destroy,
 | 
					 | 
				
			||||||
			&output_cursor->surface_destroy);
 | 
					 | 
				
			||||||
		output_cursor->surface_destroy.notify =
 | 
					 | 
				
			||||||
			output_cursor_output_handle_surface_destroy;
 | 
					 | 
				
			||||||
		wl_signal_add(&surface->events.commit,
 | 
					 | 
				
			||||||
			&output_cursor->surface_commit);
 | 
					 | 
				
			||||||
		output_cursor->surface_commit.notify =
 | 
					 | 
				
			||||||
			output_cursor_output_handle_surface_commit;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		wl_signal_add(&output_cursor->output_cursor->output->events.commit,
 | 
					 | 
				
			||||||
			&output_cursor->output_commit);
 | 
					 | 
				
			||||||
		output_cursor->output_commit.notify =
 | 
					 | 
				
			||||||
			output_cursor_output_handle_output_commit;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		output_cursor_output_commit_surface(output_cursor);
 | 
							output_cursor_output_commit_surface(output_cursor);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue