diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-04-25 11:34:27 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-04-25 11:34:27 -0400 |
commit | dba1195b4452dd7497d780b5d8c0b43f361f5aab (patch) | |
tree | 0b329d72536a75e5d960b25b4414b9d1fe4a5018 /include | |
parent | 7efa9ab34ae1dabcc7c87d22bfba0b1312c8c662 (diff) | |
parent | 05b4965a99417b74df13e9138b14347e7dc47685 (diff) | |
download | sway-dba1195b4452dd7497d780b5d8c0b43f361f5aab.tar.xz |
Merge pull request #566 from mikkeloscar/tabbed-stacking-layout
Tabbed and stacked layout
Diffstat (limited to 'include')
-rw-r--r-- | include/border.h | 5 | ||||
-rw-r--r-- | include/container.h | 21 | ||||
-rw-r--r-- | include/layout.h | 11 |
3 files changed, 33 insertions, 4 deletions
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 <wlc/wlc.h> #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 26da851e..d1905720 100644 --- a/include/container.h +++ b/include/container.h @@ -2,9 +2,12 @@ #define _SWAY_CONTAINER_H #include <sys/types.h> #include <wlc/wlc.h> + +#include "list.h" + typedef struct sway_container swayc_t; -#include "layout.h" +extern swayc_t root_container; /** * Different kinds of containers. @@ -56,6 +59,7 @@ struct sway_container { enum swayc_types type; enum swayc_layouts layout; + enum swayc_layouts prev_layout; /** * Width and height of this container, without borders or gaps. @@ -75,6 +79,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. */ @@ -119,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; @@ -240,6 +250,13 @@ bool swayc_is_parent_of(swayc_t *parent, swayc_t *child); * Returns true if the child is a desecendant of the parent. */ bool swayc_is_child_of(swayc_t *child, swayc_t *parent); + +/** + * 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 b7731031..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); @@ -67,4 +69,9 @@ void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge ed void layout_log(const swayc_t *c, int depth); void swayc_log(log_importance_t verbosity, swayc_t *cont, const char* format, ...) __attribute__((format(printf,3,4))); +/** + * Get default layout. + */ +enum swayc_layouts default_layout(swayc_t *output); + #endif |