mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Alternative to7bf08afwhich was reverted in the previous commit.7bf08affixed the problem that layer-shell clients are terminated when it's unmapped, by sending configure events in node-destroy handler rather than in unmap handler. But it caused a UAF bug when an output with layer-shell clients is destroyed. So this patch fixes the original issue by simply skipping the surface in arrange_one_layer() if it's being unmapped.
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* SPDX-License-Identifier: GPL-2.0-only */
 | 
						|
#ifndef LABWC_LAYERS_H
 | 
						|
#define LABWC_LAYERS_H
 | 
						|
#include <wayland-server.h>
 | 
						|
#include <wlr/types/wlr_layer_shell_v1.h>
 | 
						|
 | 
						|
struct server;
 | 
						|
struct output;
 | 
						|
struct seat;
 | 
						|
 | 
						|
struct lab_layer_surface {
 | 
						|
	struct wlr_layer_surface_v1 *layer_surface;
 | 
						|
	struct wlr_scene_layer_surface_v1 *scene_layer_surface;
 | 
						|
	struct server *server;
 | 
						|
 | 
						|
	bool mapped;
 | 
						|
	/* true only inside handle_unmap() */
 | 
						|
	bool being_unmapped;
 | 
						|
 | 
						|
	struct wl_listener map;
 | 
						|
	struct wl_listener unmap;
 | 
						|
	struct wl_listener surface_commit;
 | 
						|
	struct wl_listener output_destroy;
 | 
						|
	struct wl_listener node_destroy;
 | 
						|
	struct wl_listener new_popup;
 | 
						|
};
 | 
						|
 | 
						|
struct lab_layer_popup {
 | 
						|
	struct wlr_xdg_popup *wlr_popup;
 | 
						|
	struct wlr_scene_tree *scene_tree;
 | 
						|
	struct server *server;
 | 
						|
 | 
						|
	/* To simplify moving popup nodes from the bottom to the top layer */
 | 
						|
	struct wlr_box output_toplevel_sx_box;
 | 
						|
 | 
						|
	struct wl_listener commit;
 | 
						|
	struct wl_listener destroy;
 | 
						|
	struct wl_listener new_popup;
 | 
						|
	struct wl_listener reposition;
 | 
						|
};
 | 
						|
 | 
						|
void layers_init(struct server *server);
 | 
						|
void layers_finish(struct server *server);
 | 
						|
 | 
						|
void layers_arrange(struct output *output);
 | 
						|
void layer_try_set_focus(struct seat *seat,
 | 
						|
	struct wlr_layer_surface_v1 *layer_surface);
 | 
						|
 | 
						|
#endif /* LABWC_LAYERS_H */
 |