mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Track the fullscreen view on a workspace swayc_t
This commit is contained in:
		
							parent
							
								
									6655534feb
								
							
						
					
					
						commit
						d361ce656d
					
				
					 2 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -97,6 +97,10 @@ struct sway_container {
 | 
				
			||||||
	 * Which of this container's children has focus.
 | 
						 * Which of this container's children has focus.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	struct sway_container *focused;
 | 
						struct sway_container *focused;
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * If this container's children include a fullscreen view, this is that view.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						struct sway_container *fullscreen;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum visibility_mask {
 | 
					enum visibility_mask {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1349,15 +1349,18 @@ static struct cmd_results *cmd_fullscreen(int argc, char **argv) {
 | 
				
			||||||
		return error;
 | 
							return error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	swayc_t *container = get_focused_view(&root_container);
 | 
						swayc_t *container = get_focused_view(&root_container);
 | 
				
			||||||
 | 
						swayc_t *workspace = swayc_parent_by_type(container, C_WORKSPACE);
 | 
				
			||||||
	bool current = swayc_is_fullscreen(container);
 | 
						bool current = swayc_is_fullscreen(container);
 | 
				
			||||||
	wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current);
 | 
						wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current);
 | 
				
			||||||
	// Resize workspace if going from  fullscreen -> notfullscreen
 | 
						// Resize workspace if going from  fullscreen -> notfullscreen
 | 
				
			||||||
	// otherwise just resize container
 | 
						// otherwise just resize container
 | 
				
			||||||
	if (current) {
 | 
						if (current) {
 | 
				
			||||||
		container = swayc_parent_by_type(container, C_WORKSPACE);
 | 
							arrange_windows(workspace, -1, -1);
 | 
				
			||||||
 | 
							workspace->fullscreen = container;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							arrange_windows(container, -1, -1);
 | 
				
			||||||
 | 
							workspace->fullscreen = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Only resize container when going into fullscreen
 | 
					 | 
				
			||||||
	arrange_windows(container, -1, -1);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
						return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue