|  |  |  | @ -20,60 +20,43 @@ struct sway_seat; | 
			
		
	
		
			
				
					|  |  |  |  |  * it on this list. | 
			
		
	
		
			
				
					|  |  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  |  | enum swayc_types { | 
			
		
	
		
			
				
					|  |  |  |  | 	C_ROOT,      /**< The root container. Only one of these ever exists. */ | 
			
		
	
		
			
				
					|  |  |  |  | 	C_OUTPUT,    /**< An output (aka monitor, head, etc). */ | 
			
		
	
		
			
				
					|  |  |  |  | 	C_WORKSPACE, /**< A workspace. */ | 
			
		
	
		
			
				
					|  |  |  |  | 	C_CONTAINER, /**< A manually created container. */ | 
			
		
	
		
			
				
					|  |  |  |  | 	C_VIEW,      /**< A view (aka window). */ | 
			
		
	
		
			
				
					|  |  |  |  | 	C_ROOT, | 
			
		
	
		
			
				
					|  |  |  |  | 	C_OUTPUT, | 
			
		
	
		
			
				
					|  |  |  |  | 	C_WORKSPACE, | 
			
		
	
		
			
				
					|  |  |  |  | 	C_CONTAINER, | 
			
		
	
		
			
				
					|  |  |  |  | 	C_VIEW, | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	C_TYPES, | 
			
		
	
		
			
				
					|  |  |  |  | }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | /**
 | 
			
		
	
		
			
				
					|  |  |  |  |  * Different ways to arrange a container. | 
			
		
	
		
			
				
					|  |  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  |  | enum swayc_layouts { | 
			
		
	
		
			
				
					|  |  |  |  | 	L_NONE,     /**< Used for containers that have no layout (views, root) */ | 
			
		
	
		
			
				
					|  |  |  |  | 	L_NONE, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_HORIZ, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_VERT, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_STACKED, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_TABBED, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_FLOATING, /**< A psuedo-container, removed from the tree, to hold floating windows */ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/* Awesome/Monad style auto layouts */ | 
			
		
	
		
			
				
					|  |  |  |  | 	L_AUTO_LEFT, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_AUTO_RIGHT, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_AUTO_TOP, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_AUTO_BOTTOM, | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	L_AUTO_FIRST = L_AUTO_LEFT, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_AUTO_LAST = L_AUTO_BOTTOM, | 
			
		
	
		
			
				
					|  |  |  |  | 	L_FLOATING, | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	// Keep last
 | 
			
		
	
		
			
				
					|  |  |  |  | 	L_LAYOUTS, | 
			
		
	
		
			
				
					|  |  |  |  | }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | enum swayc_border_types { | 
			
		
	
		
			
				
					|  |  |  |  | 	B_NONE,   /**< No border */ | 
			
		
	
		
			
				
					|  |  |  |  | 	B_PIXEL,  /**< 1px border */ | 
			
		
	
		
			
				
					|  |  |  |  | 	B_NORMAL, /**< Normal border with title bar */ | 
			
		
	
		
			
				
					|  |  |  |  | 	B_NONE, | 
			
		
	
		
			
				
					|  |  |  |  | 	B_PIXEL, | 
			
		
	
		
			
				
					|  |  |  |  | 	B_NORMAL, | 
			
		
	
		
			
				
					|  |  |  |  | }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | struct sway_root; | 
			
		
	
		
			
				
					|  |  |  |  | struct sway_output; | 
			
		
	
		
			
				
					|  |  |  |  | struct sway_view; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | /**
 | 
			
		
	
		
			
				
					|  |  |  |  |  * Stores information about a container. | 
			
		
	
		
			
				
					|  |  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  |  * The tree is made of these. Views are containers that cannot have children. | 
			
		
	
		
			
				
					|  |  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  |  | struct sway_container { | 
			
		
	
		
			
				
					|  |  |  |  | 	union { | 
			
		
	
		
			
				
					|  |  |  |  | 		// TODO: Encapsulate state for other node types as well like C_CONTAINER
 | 
			
		
	
		
			
				
					|  |  |  |  | 		struct sway_root *sway_root;             // C_ROOT
 | 
			
		
	
		
			
				
					|  |  |  |  | 		struct sway_output *sway_output;         // C_OUTPUT
 | 
			
		
	
		
			
				
					|  |  |  |  | 		struct sway_view *sway_view;             // C_VIEW
 | 
			
		
	
		
			
				
					|  |  |  |  | 		struct sway_root *sway_root; | 
			
		
	
		
			
				
					|  |  |  |  | 		struct sway_output *sway_output; | 
			
		
	
		
			
				
					|  |  |  |  | 		struct sway_view *sway_view; | 
			
		
	
		
			
				
					|  |  |  |  | 	}; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -89,38 +72,17 @@ struct sway_container { | 
			
		
	
		
			
				
					|  |  |  |  | 	enum swayc_layouts prev_layout; | 
			
		
	
		
			
				
					|  |  |  |  | 	enum swayc_layouts workspace_layout; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * The coordinates that this view appear at, relative to the output they | 
			
		
	
		
			
				
					|  |  |  |  | 	 * are located on (output containers have absolute coordinates). | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  |     // TODO convert to layout coordinates
 | 
			
		
	
		
			
				
					|  |  |  |  | 	double x, y; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * Width and height of this container, without borders or gaps. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  |     // does not include borders or gaps.
 | 
			
		
	
		
			
				
					|  |  |  |  | 	double width, height; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	list_t *children; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * The parent of this container. NULL for the root container. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	struct sway_container *parent; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * Number of master views in auto layouts. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	size_t nb_master; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * Number of slave groups (e.g. columns) in auto layouts. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	size_t nb_slave_groups; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/**
 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * Marks applied to the container, list_t of char*. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	list_t *marks; | 
			
		
	
		
			
				
					|  |  |  |  | 	list_t *marks; // list of char*
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	struct { | 
			
		
	
		
			
				
					|  |  |  |  | 		struct wl_signal destroy; | 
			
		
	
	
		
			
				
					|  |  |  | @ -130,8 +92,11 @@ struct sway_container { | 
			
		
	
		
			
				
					|  |  |  |  | void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, | 
			
		
	
		
			
				
					|  |  |  |  | 		void (*func)(swayc_t *item, void *data), void *data); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | // TODO only one container create function and pass the type?
 | 
			
		
	
		
			
				
					|  |  |  |  | swayc_t *new_output(struct sway_output *sway_output); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | swayc_t *new_workspace(swayc_t *output, const char *name); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | swayc_t *destroy_output(swayc_t *output); | 
			
		
	
	
		
			
				
					|  |  |  | @ -145,10 +110,12 @@ swayc_t *next_view_sibling(struct sway_seat *seat); | 
			
		
	
		
			
				
					|  |  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  |  | swayc_t *swayc_by_test(swayc_t *container, | 
			
		
	
		
			
				
					|  |  |  |  | 		bool (*test)(swayc_t *view, void *data), void *data); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | /**
 | 
			
		
	
		
			
				
					|  |  |  |  |  * Finds a parent container with the given swayc_type. | 
			
		
	
		
			
				
					|  |  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  |  | swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | /**
 | 
			
		
	
		
			
				
					|  |  |  |  |  * Maps a container's children over a function. | 
			
		
	
		
			
				
					|  |  |  |  |  */ |