mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Introduce container_is_transient_for
This commit is contained in:
		
							parent
							
								
									832ebc8966
								
							
						
					
					
						commit
						f23588de3c
					
				
					 7 changed files with 30 additions and 37 deletions
				
			
		| 
						 | 
				
			
			@ -292,4 +292,7 @@ bool sway_dir_to_wlr(enum movement_direction dir, enum wlr_direction *out);
 | 
			
		|||
struct sway_container *container_split(struct sway_container *child,
 | 
			
		||||
		enum sway_container_layout layout);
 | 
			
		||||
 | 
			
		||||
bool container_is_transient_for(struct sway_container *child,
 | 
			
		||||
		struct sway_container *ancestor);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -329,17 +329,14 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
 | 
			
		|||
				workspace->current.fullscreen, &data);
 | 
			
		||||
		container_for_each_child(workspace->current.fullscreen,
 | 
			
		||||
				send_frame_done_container_iterator, &data);
 | 
			
		||||
		if (config->popup_during_fullscreen == POPUP_SMART &&
 | 
			
		||||
				workspace->current.fullscreen->view) {
 | 
			
		||||
		for (int i = 0; i < workspace->current.floating->length; ++i) {
 | 
			
		||||
			struct sway_container *floater =
 | 
			
		||||
				workspace->current.floating->items[i];
 | 
			
		||||
				if (floater->view && view_is_transient_for(floater->view,
 | 
			
		||||
							workspace->current.fullscreen->view)) {
 | 
			
		||||
			if (container_is_transient_for(floater,
 | 
			
		||||
						workspace->current.fullscreen)) {
 | 
			
		||||
				send_frame_done_container_iterator(floater, &data);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		}
 | 
			
		||||
#ifdef HAVE_XWAYLAND
 | 
			
		||||
		send_frame_done_unmanaged(output, &root->xwayland_unmanaged, when);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -962,16 +962,12 @@ void output_render(struct sway_output *output, struct timespec *when,
 | 
			
		|||
					fullscreen_con->current.focused);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (config->popup_during_fullscreen == POPUP_SMART &&
 | 
			
		||||
				fullscreen_con->view) {
 | 
			
		||||
		for (int i = 0; i < workspace->floating->length; ++i) {
 | 
			
		||||
			struct sway_container *floater = workspace->floating->items[i];
 | 
			
		||||
				if (floater->view && view_is_transient_for(
 | 
			
		||||
							floater->view, fullscreen_con->view)) {
 | 
			
		||||
			if (container_is_transient_for(floater, fullscreen_con)) {
 | 
			
		||||
				render_floating_container(output, damage, floater);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		}
 | 
			
		||||
#ifdef HAVE_XWAYLAND
 | 
			
		||||
		render_unmanaged(output, damage, &root->xwayland_unmanaged);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,12 +99,9 @@ static struct sway_node *node_at_coords(
 | 
			
		|||
	}
 | 
			
		||||
	if (ws->fullscreen) {
 | 
			
		||||
		// Try transient containers
 | 
			
		||||
		if (config->popup_during_fullscreen == POPUP_SMART &&
 | 
			
		||||
				ws->fullscreen->view) {
 | 
			
		||||
		for (int i = 0; i < ws->floating->length; ++i) {
 | 
			
		||||
			struct sway_container *floater = ws->floating->items[i];
 | 
			
		||||
				if (floater->view && view_is_transient_for(
 | 
			
		||||
							floater->view, ws->fullscreen->view)) {
 | 
			
		||||
			if (container_is_transient_for(floater, ws->fullscreen)) {
 | 
			
		||||
				struct sway_container *con = tiling_container_at(
 | 
			
		||||
						&floater->node, lx, ly, surface, sx, sy);
 | 
			
		||||
				if (con) {
 | 
			
		||||
| 
						 | 
				
			
			@ -112,7 +109,6 @@ static struct sway_node *node_at_coords(
 | 
			
		|||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		}
 | 
			
		||||
		// Try fullscreen container
 | 
			
		||||
		struct sway_container *con =
 | 
			
		||||
			tiling_container_at(&ws->fullscreen->node, lx, ly, surface, sx, sy);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -656,11 +656,7 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
 | 
			
		|||
	if (new_workspace && new_workspace->fullscreen && container &&
 | 
			
		||||
			!container_is_fullscreen_or_child(container)) {
 | 
			
		||||
		// Unless it's a transient container
 | 
			
		||||
		bool is_transient = new_workspace->fullscreen->view &&
 | 
			
		||||
			config->popup_during_fullscreen == POPUP_SMART &&
 | 
			
		||||
			container->view && view_is_transient_for(
 | 
			
		||||
					container->view, new_workspace->fullscreen->view);
 | 
			
		||||
		if (!is_transient) {
 | 
			
		||||
		if (!container_is_transient_for(container, new_workspace->fullscreen)) {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1212,3 +1212,10 @@ struct sway_container *container_split(struct sway_container *child,
 | 
			
		|||
 | 
			
		||||
	return cont;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool container_is_transient_for(struct sway_container *child,
 | 
			
		||||
		struct sway_container *ancestor) {
 | 
			
		||||
	return config->popup_during_fullscreen == POPUP_SMART &&
 | 
			
		||||
		child->view && ancestor->view &&
 | 
			
		||||
		view_is_transient_for(child->view, ancestor->view);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1044,10 +1044,8 @@ bool view_is_visible(struct sway_view *view) {
 | 
			
		|||
			!container_is_fullscreen_or_child(view->container)) {
 | 
			
		||||
		// However, if we're transient for the fullscreen view and we allow
 | 
			
		||||
		// "popups" during fullscreen then it might be visible
 | 
			
		||||
		bool is_transient = config->popup_during_fullscreen == POPUP_SMART &&
 | 
			
		||||
				workspace->fullscreen->view &&
 | 
			
		||||
				view_is_transient_for(view, workspace->fullscreen->view);
 | 
			
		||||
		if (!is_transient) {
 | 
			
		||||
		if (!container_is_transient_for(view->container,
 | 
			
		||||
					workspace->fullscreen)) {
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue