mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	layer: update pointer focus on popup destruction
Same as previous commit
This commit is contained in:
		
							parent
							
								
									49c23b8948
								
							
						
					
					
						commit
						e707e16130
					
				
					 2 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -25,6 +25,7 @@ struct lab_layer_surface {
 | 
				
			||||||
struct lab_layer_popup {
 | 
					struct lab_layer_popup {
 | 
				
			||||||
	struct wlr_xdg_popup *wlr_popup;
 | 
						struct wlr_xdg_popup *wlr_popup;
 | 
				
			||||||
	struct wlr_scene_tree *scene_tree;
 | 
						struct wlr_scene_tree *scene_tree;
 | 
				
			||||||
 | 
						struct server *server;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* To simplify moving popup nodes from the bottom to the top layer */
 | 
						/* To simplify moving popup nodes from the bottom to the top layer */
 | 
				
			||||||
	struct wlr_box output_toplevel_sx_box;
 | 
						struct wlr_box output_toplevel_sx_box;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								src/layers.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/layers.c
									
										
									
									
									
								
							| 
						 | 
					@ -363,6 +363,8 @@ popup_handle_destroy(struct wl_listener *listener, void *data)
 | 
				
			||||||
		wl_list_remove(&popup->commit.link);
 | 
							wl_list_remove(&popup->commit.link);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						cursor_update_focus(popup->server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(popup);
 | 
						free(popup);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -394,9 +396,11 @@ popup_handle_reposition(struct wl_listener *listener, void *data)
 | 
				
			||||||
static void popup_handle_new_popup(struct wl_listener *listener, void *data);
 | 
					static void popup_handle_new_popup(struct wl_listener *listener, void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct lab_layer_popup *
 | 
					static struct lab_layer_popup *
 | 
				
			||||||
create_popup(struct wlr_xdg_popup *wlr_popup, struct wlr_scene_tree *parent)
 | 
					create_popup(struct server *server, struct wlr_xdg_popup *wlr_popup,
 | 
				
			||||||
 | 
							struct wlr_scene_tree *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct lab_layer_popup *popup = znew(*popup);
 | 
						struct lab_layer_popup *popup = znew(*popup);
 | 
				
			||||||
 | 
						popup->server = server;
 | 
				
			||||||
	popup->wlr_popup = wlr_popup;
 | 
						popup->wlr_popup = wlr_popup;
 | 
				
			||||||
	popup->scene_tree =
 | 
						popup->scene_tree =
 | 
				
			||||||
		wlr_scene_xdg_surface_create(parent, wlr_popup->base);
 | 
							wlr_scene_xdg_surface_create(parent, wlr_popup->base);
 | 
				
			||||||
| 
						 | 
					@ -433,7 +437,8 @@ popup_handle_new_popup(struct wl_listener *listener, void *data)
 | 
				
			||||||
	struct lab_layer_popup *lab_layer_popup =
 | 
						struct lab_layer_popup *lab_layer_popup =
 | 
				
			||||||
		wl_container_of(listener, lab_layer_popup, new_popup);
 | 
							wl_container_of(listener, lab_layer_popup, new_popup);
 | 
				
			||||||
	struct wlr_xdg_popup *wlr_popup = data;
 | 
						struct wlr_xdg_popup *wlr_popup = data;
 | 
				
			||||||
	struct lab_layer_popup *new_popup = create_popup(wlr_popup,
 | 
						struct lab_layer_popup *new_popup = create_popup(
 | 
				
			||||||
 | 
							lab_layer_popup->server, wlr_popup,
 | 
				
			||||||
		lab_layer_popup->scene_tree);
 | 
							lab_layer_popup->scene_tree);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!new_popup) {
 | 
						if (!new_popup) {
 | 
				
			||||||
| 
						 | 
					@ -500,7 +505,8 @@ handle_new_popup(struct wl_listener *listener, void *data)
 | 
				
			||||||
		.width = output_box.width,
 | 
							.width = output_box.width,
 | 
				
			||||||
		.height = output_box.height,
 | 
							.height = output_box.height,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	struct lab_layer_popup *popup = create_popup(wlr_popup, surface->tree);
 | 
						struct lab_layer_popup *popup =
 | 
				
			||||||
 | 
							create_popup(server, wlr_popup, surface->tree);
 | 
				
			||||||
	if (!popup) {
 | 
						if (!popup) {
 | 
				
			||||||
		wl_resource_post_no_memory(wlr_popup->resource);
 | 
							wl_resource_post_no_memory(wlr_popup->resource);
 | 
				
			||||||
		wlr_xdg_popup_destroy(wlr_popup);
 | 
							wlr_xdg_popup_destroy(wlr_popup);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue