mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fix focus bug when moving between outputs
When moving focus left or right to an adjacent output, only select the first or last child in the new workspace if the workspace's layout is horizontalish. If it's a verticalish layout, use the last focused container.
This commit is contained in:
		
							parent
							
								
									3c77f066a5
								
							
						
					
					
						commit
						e496cc99f8
					
				
					 1 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
					@ -586,11 +586,19 @@ static struct sway_container *get_swayc_in_output_direction(
 | 
				
			||||||
	if (ws->children->length > 0) {
 | 
						if (ws->children->length > 0) {
 | 
				
			||||||
		switch (dir) {
 | 
							switch (dir) {
 | 
				
			||||||
		case MOVE_LEFT:
 | 
							case MOVE_LEFT:
 | 
				
			||||||
			// get most right child of new output
 | 
								if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
 | 
				
			||||||
			return ws->children->items[ws->children->length-1];
 | 
									// get most right child of new output
 | 
				
			||||||
 | 
									return ws->children->items[ws->children->length-1];
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									return seat_get_focus_inactive(seat, ws);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		case MOVE_RIGHT:
 | 
							case MOVE_RIGHT:
 | 
				
			||||||
			// get most left child of new output
 | 
								if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
 | 
				
			||||||
			return ws->children->items[0];
 | 
									// get most left child of new output
 | 
				
			||||||
 | 
									return ws->children->items[0];
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									return seat_get_focus_inactive(seat, ws);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		case MOVE_UP:
 | 
							case MOVE_UP:
 | 
				
			||||||
		case MOVE_DOWN: {
 | 
							case MOVE_DOWN: {
 | 
				
			||||||
			struct sway_container *focused =
 | 
								struct sway_container *focused =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue