mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fix focusing on non-visible workspace
My previous attempt was not quite right. Changing the focus stack on a non-visible workspace should only be blocked if the focus would be set to the workspace itself
This commit is contained in:
		
							parent
							
								
									1897edabba
								
							
						
					
					
						commit
						c2499772b9
					
				
					 1 changed files with 6 additions and 8 deletions
				
			
		| 
						 | 
					@ -159,14 +159,6 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (node->type == N_CONTAINER &&
 | 
					 | 
				
			||||||
			!workspace_is_visible(node->sway_container->workspace)) {
 | 
					 | 
				
			||||||
		// Do not change the focus stack on a non-visible workspace. The focus
 | 
					 | 
				
			||||||
		// will either be set when the workspace becomes visible or the
 | 
					 | 
				
			||||||
		// workspace is now empty and will be destroyed
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Find new focus_inactive (ie. sibling, or workspace if no siblings left)
 | 
						// Find new focus_inactive (ie. sibling, or workspace if no siblings left)
 | 
				
			||||||
	struct sway_node *next_focus = NULL;
 | 
						struct sway_node *next_focus = NULL;
 | 
				
			||||||
	while (next_focus == NULL) {
 | 
						while (next_focus == NULL) {
 | 
				
			||||||
| 
						 | 
					@ -182,6 +174,12 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		parent = node_get_parent(parent);
 | 
							parent = node_get_parent(parent);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (next_focus->type == N_WORKSPACE &&
 | 
				
			||||||
 | 
								!workspace_is_visible(next_focus->sway_workspace)) {
 | 
				
			||||||
 | 
							// Do not change focus to a non-visible workspace
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (needs_new_focus) {
 | 
						if (needs_new_focus) {
 | 
				
			||||||
		// The structure change might have caused it to move up to the top of
 | 
							// The structure change might have caused it to move up to the top of
 | 
				
			||||||
		// the focus stack without sending focus notifications to the view
 | 
							// the focus stack without sending focus notifications to the view
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue