summaryrefslogtreecommitdiffstats
path: root/sway/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sway/container.c b/sway/container.c
index 42f6a69a..f4258c84 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -8,6 +8,7 @@
8#include "container.h" 8#include "container.h"
9#include "workspace.h" 9#include "workspace.h"
10#include "focus.h" 10#include "focus.h"
11#include "border.h"
11#include "layout.h" 12#include "layout.h"
12#include "input_state.h" 13#include "input_state.h"
13#include "log.h" 14#include "log.h"
@@ -64,7 +65,12 @@ static void free_swayc(swayc_t *cont) {
64 if (cont->bg_pid != 0) { 65 if (cont->bg_pid != 0) {
65 terminate_swaybg(cont->bg_pid); 66 terminate_swaybg(cont->bg_pid);
66 } 67 }
67 free(cont->border); 68 if (cont->border) {
69 if (cont->border->buffer) {
70 free(cont->border->buffer);
71 }
72 free(cont->border);
73 }
68 free(cont); 74 free(cont);
69} 75}
70 76
@@ -211,6 +217,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
211 cont->x = child->x; 217 cont->x = child->x;
212 cont->y = child->y; 218 cont->y = child->y;
213 cont->visible = child->visible; 219 cont->visible = child->visible;
220 cont->cached_geometry = child->cached_geometry;
214 221
215 /* Container inherits all of workspaces children, layout and whatnot */ 222 /* Container inherits all of workspaces children, layout and whatnot */
216 if (child->type == C_WORKSPACE) { 223 if (child->type == C_WORKSPACE) {
@@ -812,3 +819,18 @@ bool swayc_is_tabbed_stacked(swayc_t *view) {
812 return (view->parent->layout == L_TABBED 819 return (view->parent->layout == L_TABBED
813 || view->parent->layout == L_STACKED); 820 || view->parent->layout == L_STACKED);
814} 821}
822
823swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) {
824 swayc_t *parent = NULL;
825 if (!ASSERT_NONNULL(view)) {
826 return NULL;
827 }
828 do {
829 view = view->parent;
830 if (view->layout == L_TABBED || view->layout == L_STACKED) {
831 parent = view;
832 }
833 } while (view && view->type != C_WORKSPACE);
834
835 return parent;
836}