From 3e1f78ab26e8bc6b6cefd53ee137e97533c2695e Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Wed, 20 Apr 2016 00:22:15 +0200 Subject: Add support for nested tabbed/stacked containers --- include/border.h | 5 +++++ include/container.h | 19 +++++++++++++++++-- include/layout.h | 6 ++++-- 3 files changed, 26 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/border.h b/include/border.h index 85c656e0..c99c02ea 100644 --- a/include/border.h +++ b/include/border.h @@ -3,6 +3,11 @@ #include #include "container.h" +struct border { + unsigned char *buffer; + struct wlc_geometry geometry; +}; + void render_view_borders(wlc_handle view); void update_view_border(swayc_t *view); void map_update_view_border(swayc_t *view, void *data); diff --git a/include/container.h b/include/container.h index 29d4ea12..ae57d1e3 100644 --- a/include/container.h +++ b/include/container.h @@ -2,9 +2,12 @@ #define _SWAY_CONTAINER_H #include #include + +#include "list.h" + typedef struct sway_container swayc_t; -#include "layout.h" +extern swayc_t root_container; /** * Different kinds of containers. @@ -75,6 +78,12 @@ struct sway_container { */ double x, y; + /** + * Cached geometry used to store view/container geometry when switching + * between tabbed/stacked and horizontal/vertical layouts. + */ + struct wlc_geometry cached_geometry; + /** * False if this view is invisible. It could be in the scratchpad or on a * workspace that is not shown. @@ -120,7 +129,7 @@ struct sway_container { * If this container is a view, this may be set to the window's decoration * buffer (or NULL). */ - unsigned char *border; + struct border *border; enum swayc_border_types border_type; struct wlc_geometry border_geometry; struct wlc_geometry title_bar_geometry; @@ -247,6 +256,12 @@ bool swayc_is_child_of(swayc_t *child, swayc_t *parent); */ bool swayc_is_tabbed_stacked(swayc_t *view); +/** + * Returns the top most tabbed or stacked parent container. Returns NULL if + * view is not in a tabbed/stacked layout. + */ +swayc_t *swayc_tabbed_stacked_parent(swayc_t *view); + /** * Returns the gap (padding) of the container. * diff --git a/include/layout.h b/include/layout.h index 84552754..c05e9e69 100644 --- a/include/layout.h +++ b/include/layout.h @@ -7,8 +7,6 @@ #include "container.h" #include "focus.h" -extern swayc_t root_container; - extern list_t *scratchpad; extern int min_sane_w; @@ -55,6 +53,10 @@ void move_container_to(swayc_t* container, swayc_t* destination); void move_workspace_to(swayc_t* workspace, swayc_t* destination); // Layout +/** + * Update child container geometries when switching between layouts. + */ +void update_layout_geometry(swayc_t *parent, enum swayc_layouts prev_layout); void update_geometry(swayc_t *view); void arrange_windows(swayc_t *container, double width, double height); -- cgit v1.2.3