aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-04-05 12:32:42 -0400
committerGitHub <noreply@github.com>2018-04-05 12:32:42 -0400
commitb3a1cf10735572bf0a13e66bbc6c2a1d452c5385 (patch)
treed3fb74ee77369ad52edeba7bac1f3ada907d3099 /sway/tree
parent9939d98454db32635dd9d0887ac930d7a24440bc (diff)
parentdcd15a2d3dd93e057fe702238eb21dd70331b44f (diff)
Merge pull request #1742 from emersion/shell-views
Implement shell views
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/view.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index aa010a40..3927c195 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -7,15 +7,10 @@
#include "sway/tree/layout.h"
#include "sway/tree/view.h"
-struct sway_view *view_create(enum sway_view_type type,
+void view_init(struct sway_view *view, enum sway_view_type type,
const struct sway_view_impl *impl) {
- struct sway_view *view = calloc(1, sizeof(struct sway_view));
- if (view == NULL) {
- return NULL;
- }
view->type = type;
view->impl = impl;
- return view;
}
void view_destroy(struct sway_view *view) {
@@ -28,6 +23,12 @@ void view_destroy(struct sway_view *view) {
}
container_destroy(view->swayc);
+
+ if (view->impl->destroy) {
+ view->impl->destroy(view);
+ } else {
+ free(view);
+ }
}
const char *view_get_title(struct sway_view *view) {