mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	input_method_v2: improve mapping detection
Detect NULL commits before the surface is actually committed, allowing
the surface to be properly damaged on unmap.
(cherry picked from commit 5091118bed)
			
			
This commit is contained in:
		
							parent
							
								
									7dde2b66d6
								
							
						
					
					
						commit
						b0fee56974
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
					@ -157,9 +157,22 @@ static void popup_surface_surface_role_commit(struct wlr_surface *surface) {
 | 
				
			||||||
		&& popup_surface->input_method->client_active);
 | 
							&& popup_surface->input_method->client_active);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void popup_surface_surface_role_precommit(struct wlr_surface *surface) {
 | 
				
			||||||
 | 
						struct wlr_input_popup_surface_v2 *popup_surface = surface->role_data;
 | 
				
			||||||
 | 
						if (popup_surface == NULL) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (surface->pending.committed & WLR_SURFACE_STATE_BUFFER &&
 | 
				
			||||||
 | 
								surface->pending.buffer == NULL) {
 | 
				
			||||||
 | 
							// This is a NULL commit
 | 
				
			||||||
 | 
							popup_surface_set_mapped(popup_surface, false);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_surface_role input_popup_surface_v2_role = {
 | 
					static const struct wlr_surface_role input_popup_surface_v2_role = {
 | 
				
			||||||
	.name = "zwp_input_popup_surface_v2",
 | 
						.name = "zwp_input_popup_surface_v2",
 | 
				
			||||||
	.commit = popup_surface_surface_role_commit,
 | 
						.commit = popup_surface_surface_role_commit,
 | 
				
			||||||
 | 
						.precommit = popup_surface_surface_role_precommit,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface) {
 | 
					bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue