mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	xwayland: call foreign-toplevel-destroy on unmap
Some xwayland clients leave unmapped child views around, typically when a dialog window is closed. Although handle_destroy() is not called for these, we have to call foreign-toplevel-destroy to avoid panels and the like incorrecly showing them.
This commit is contained in:
		
							parent
							
								
									1e29d0606d
								
							
						
					
					
						commit
						62ae87bbd9
					
				
					 1 changed files with 22 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -90,6 +90,18 @@ handle_unmap(struct wl_listener *listener, void *data)
 | 
			
		|||
{
 | 
			
		||||
	struct view *view = wl_container_of(listener, view, unmap);
 | 
			
		||||
	view->impl->unmap(view);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Some xwayland clients leave unmapped child views around, typically
 | 
			
		||||
	 * when a dialog window is closed. Although handle_destroy() is not
 | 
			
		||||
	 * called for these, we have to deal with them as such in terms of the
 | 
			
		||||
	 * foreign-toplevel protocol to avoid panels and the like still showing
 | 
			
		||||
	 * them.
 | 
			
		||||
	 */
 | 
			
		||||
	if (view->toplevel_handle) {
 | 
			
		||||
		wlr_foreign_toplevel_handle_v1_destroy(view->toplevel_handle);
 | 
			
		||||
		view->toplevel_handle = NULL;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			@ -308,15 +320,16 @@ map(struct view *view)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!view->been_mapped) {
 | 
			
		||||
	if (!view->toplevel_handle) {
 | 
			
		||||
		foreign_toplevel_handle_create(view);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!view->been_mapped) {
 | 
			
		||||
		view->ssd.enabled = want_deco(view);
 | 
			
		||||
		if (view->ssd.enabled) {
 | 
			
		||||
			view->margin = ssd_thickness(view);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		foreign_toplevel_handle_create(view);
 | 
			
		||||
 | 
			
		||||
		if (!view->maximized && !view->fullscreen) {
 | 
			
		||||
			struct wlr_box box =
 | 
			
		||||
				output_usable_area_from_cursor_coords(view->server);
 | 
			
		||||
| 
						 | 
				
			
			@ -349,12 +362,13 @@ map(struct view *view)
 | 
			
		|||
static void
 | 
			
		||||
unmap(struct view *view)
 | 
			
		||||
{
 | 
			
		||||
	if (view->mapped) {
 | 
			
		||||
		view->mapped = false;
 | 
			
		||||
		wlr_scene_node_set_enabled(&view->scene_tree->node, false);
 | 
			
		||||
		wl_list_remove(&view->commit.link);
 | 
			
		||||
		desktop_focus_topmost_mapped_view(view->server);
 | 
			
		||||
	if (!view->mapped) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	view->mapped = false;
 | 
			
		||||
	wl_list_remove(&view->commit.link);
 | 
			
		||||
	wlr_scene_node_set_enabled(&view->scene_tree->node, false);
 | 
			
		||||
	desktop_focus_topmost_mapped_view(view->server);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue