diff options
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 @@ | |||
3 | #include <wlc/wlc.h> | 3 | #include <wlc/wlc.h> |
4 | #include "container.h" | 4 | #include "container.h" |
5 | 5 | ||
6 | struct border { | ||
7 | unsigned char *buffer; | ||
8 | struct wlc_geometry geometry; | ||
9 | }; | ||
10 | |||
6 | void render_view_borders(wlc_handle view); | 11 | void render_view_borders(wlc_handle view); |
7 | void update_view_border(swayc_t *view); | 12 | void update_view_border(swayc_t *view); |
8 | void map_update_view_border(swayc_t *view, void *data); | 13 | 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 @@ | |||
2 | #define _SWAY_CONTAINER_H | 2 | #define _SWAY_CONTAINER_H |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <wlc/wlc.h> | 4 | #include <wlc/wlc.h> |
5 | |||
6 | #include "list.h" | ||
7 | |||
5 | typedef struct sway_container swayc_t; | 8 | typedef struct sway_container swayc_t; |
6 | 9 | ||
7 | #include "layout.h" | 10 | extern swayc_t root_container; |
8 | 11 | ||
9 | /** | 12 | /** |
10 | * Different kinds of containers. | 13 | * Different kinds of containers. |
@@ -56,6 +59,7 @@ struct sway_container { | |||
56 | 59 | ||
57 | enum swayc_types type; | 60 | enum swayc_types type; |
58 | enum swayc_layouts layout; | 61 | enum swayc_layouts layout; |
62 | enum swayc_layouts prev_layout; | ||
59 | 63 | ||
60 | /** | 64 | /** |
61 | * Width and height of this container, without borders or gaps. | 65 | * Width and height of this container, without borders or gaps. |
@@ -75,6 +79,12 @@ struct sway_container { | |||
75 | double x, y; | 79 | double x, y; |
76 | 80 | ||
77 | /** | 81 | /** |
82 | * Cached geometry used to store view/container geometry when switching | ||
83 | * between tabbed/stacked and horizontal/vertical layouts. | ||
84 | */ | ||
85 | struct wlc_geometry cached_geometry; | ||
86 | |||
87 | /** | ||
78 | * False if this view is invisible. It could be in the scratchpad or on a | 88 | * False if this view is invisible. It could be in the scratchpad or on a |
79 | * workspace that is not shown. | 89 | * workspace that is not shown. |
80 | */ | 90 | */ |
@@ -119,7 +129,7 @@ struct sway_container { | |||
119 | * If this container is a view, this may be set to the window's decoration | 129 | * If this container is a view, this may be set to the window's decoration |
120 | * buffer (or NULL). | 130 | * buffer (or NULL). |
121 | */ | 131 | */ |
122 | unsigned char *border; | 132 | struct border *border; |
123 | enum swayc_border_types border_type; | 133 | enum swayc_border_types border_type; |
124 | struct wlc_geometry border_geometry; | 134 | struct wlc_geometry border_geometry; |
125 | struct wlc_geometry title_bar_geometry; | 135 | struct wlc_geometry title_bar_geometry; |
@@ -240,6 +250,13 @@ bool swayc_is_parent_of(swayc_t *parent, swayc_t *child); | |||
240 | * Returns true if the child is a desecendant of the parent. | 250 | * Returns true if the child is a desecendant of the parent. |
241 | */ | 251 | */ |
242 | bool swayc_is_child_of(swayc_t *child, swayc_t *parent); | 252 | bool swayc_is_child_of(swayc_t *child, swayc_t *parent); |
253 | |||
254 | /** | ||
255 | * Returns the top most tabbed or stacked parent container. Returns NULL if | ||
256 | * view is not in a tabbed/stacked layout. | ||
257 | */ | ||
258 | swayc_t *swayc_tabbed_stacked_parent(swayc_t *view); | ||
259 | |||
243 | /** | 260 | /** |
244 | * Returns the gap (padding) of the container. | 261 | * Returns the gap (padding) of the container. |
245 | * | 262 | * |
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 @@ | |||
7 | #include "container.h" | 7 | #include "container.h" |
8 | #include "focus.h" | 8 | #include "focus.h" |
9 | 9 | ||
10 | extern swayc_t root_container; | ||
11 | |||
12 | extern list_t *scratchpad; | 10 | extern list_t *scratchpad; |
13 | 11 | ||
14 | extern int min_sane_w; | 12 | extern int min_sane_w; |
@@ -55,6 +53,10 @@ void move_container_to(swayc_t* container, swayc_t* destination); | |||
55 | void move_workspace_to(swayc_t* workspace, swayc_t* destination); | 53 | void move_workspace_to(swayc_t* workspace, swayc_t* destination); |
56 | 54 | ||
57 | // Layout | 55 | // Layout |
56 | /** | ||
57 | * Update child container geometries when switching between layouts. | ||
58 | */ | ||
59 | void update_layout_geometry(swayc_t *parent, enum swayc_layouts prev_layout); | ||
58 | void update_geometry(swayc_t *view); | 60 | void update_geometry(swayc_t *view); |
59 | void arrange_windows(swayc_t *container, double width, double height); | 61 | void arrange_windows(swayc_t *container, double width, double height); |
60 | 62 | ||
@@ -67,4 +69,9 @@ void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge ed | |||
67 | void layout_log(const swayc_t *c, int depth); | 69 | void layout_log(const swayc_t *c, int depth); |
68 | void swayc_log(log_importance_t verbosity, swayc_t *cont, const char* format, ...) __attribute__((format(printf,3,4))); | 70 | void swayc_log(log_importance_t verbosity, swayc_t *cont, const char* format, ...) __attribute__((format(printf,3,4))); |
69 | 71 | ||
72 | /** | ||
73 | * Get default layout. | ||
74 | */ | ||
75 | enum swayc_layouts default_layout(swayc_t *output); | ||
76 | |||
70 | #endif | 77 | #endif |