|  |  |  | @ -25,6 +25,35 @@ | 
			
		
	
		
			
				
					|  |  |  |  | #include "log.h" | 
			
		
	
		
			
				
					|  |  |  |  | #include "stringop.h" | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static void handle_output_enter( | 
			
		
	
		
			
				
					|  |  |  |  | 		struct wl_listener *listener, void *data) { | 
			
		
	
		
			
				
					|  |  |  |  | 	struct sway_container *con = wl_container_of( | 
			
		
	
		
			
				
					|  |  |  |  | 			listener, con, output_enter); | 
			
		
	
		
			
				
					|  |  |  |  | 	struct wlr_scene_output *output = data; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	if (con->view->foreign_toplevel) { | 
			
		
	
		
			
				
					|  |  |  |  | 		wlr_foreign_toplevel_handle_v1_output_enter( | 
			
		
	
		
			
				
					|  |  |  |  | 			con->view->foreign_toplevel, output->output); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static void handle_output_leave( | 
			
		
	
		
			
				
					|  |  |  |  | 		struct wl_listener *listener, void *data) { | 
			
		
	
		
			
				
					|  |  |  |  | 	struct sway_container *con = wl_container_of( | 
			
		
	
		
			
				
					|  |  |  |  | 			listener, con, output_leave); | 
			
		
	
		
			
				
					|  |  |  |  | 	struct wlr_scene_output *output = data; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	if (con->view->foreign_toplevel) { | 
			
		
	
		
			
				
					|  |  |  |  | 		wlr_foreign_toplevel_handle_v1_output_leave( | 
			
		
	
		
			
				
					|  |  |  |  | 			con->view->foreign_toplevel, output->output); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static bool handle_point_accepts_input( | 
			
		
	
		
			
				
					|  |  |  |  | 		struct wlr_scene_buffer *buffer, double *x, double *y) { | 
			
		
	
		
			
				
					|  |  |  |  | 	return false; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static struct wlr_scene_rect *alloc_rect_node(struct wlr_scene_tree *parent, | 
			
		
	
		
			
				
					|  |  |  |  | 		bool *failed) { | 
			
		
	
		
			
				
					|  |  |  |  | 	if (*failed) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -63,6 +92,7 @@ struct sway_container *container_create(struct sway_view *view) { | 
			
		
	
		
			
				
					|  |  |  |  | 	//     - content_tree (we put the content node here so when we disable the
 | 
			
		
	
		
			
				
					|  |  |  |  | 	//       border everything gets disabled. We only render the content iff there
 | 
			
		
	
		
			
				
					|  |  |  |  | 	//       is a border as well)
 | 
			
		
	
		
			
				
					|  |  |  |  | 	//     - buffer used for output enter/leave events for foreign_toplevel
 | 
			
		
	
		
			
				
					|  |  |  |  | 	bool failed = false; | 
			
		
	
		
			
				
					|  |  |  |  | 	c->scene_tree = alloc_scene_tree(root->staging, &failed); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -90,6 +120,22 @@ struct sway_container *container_create(struct sway_view *view) { | 
			
		
	
		
			
				
					|  |  |  |  | 		c->border.bottom = alloc_rect_node(c->border.tree, &failed); | 
			
		
	
		
			
				
					|  |  |  |  | 		c->border.left = alloc_rect_node(c->border.tree, &failed); | 
			
		
	
		
			
				
					|  |  |  |  | 		c->border.right = alloc_rect_node(c->border.tree, &failed); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		c->output_handler = wlr_scene_buffer_create(c->border.tree, NULL); | 
			
		
	
		
			
				
					|  |  |  |  | 		if (!c->output_handler) { | 
			
		
	
		
			
				
					|  |  |  |  | 			sway_log(SWAY_ERROR, "Failed to allocate a scene node"); | 
			
		
	
		
			
				
					|  |  |  |  | 			failed = true; | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		if (!failed) { | 
			
		
	
		
			
				
					|  |  |  |  | 			c->output_enter.notify = handle_output_enter; | 
			
		
	
		
			
				
					|  |  |  |  | 			wl_signal_add(&c->output_handler->events.output_enter, | 
			
		
	
		
			
				
					|  |  |  |  | 					&c->output_enter); | 
			
		
	
		
			
				
					|  |  |  |  | 			c->output_leave.notify = handle_output_leave; | 
			
		
	
		
			
				
					|  |  |  |  | 			wl_signal_add(&c->output_handler->events.output_leave, | 
			
		
	
		
			
				
					|  |  |  |  | 					&c->output_leave); | 
			
		
	
		
			
				
					|  |  |  |  | 			c->output_handler->point_accepts_input = handle_point_accepts_input; | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	if (!failed && !scene_descriptor_assign(&c->scene_tree->node, | 
			
		
	
	
		
			
				
					|  |  |  | @ -456,6 +502,7 @@ void container_destroy(struct sway_container *con) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	if (con->view && con->view->container == con) { | 
			
		
	
		
			
				
					|  |  |  |  | 		con->view->container = NULL; | 
			
		
	
		
			
				
					|  |  |  |  | 		wlr_scene_node_destroy(&con->output_handler->node); | 
			
		
	
		
			
				
					|  |  |  |  | 		if (con->view->destroying) { | 
			
		
	
		
			
				
					|  |  |  |  | 			view_destroy(con->view); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
	
		
			
				
					|  |  |  | 
 |