diff options
author | emersion <contact@emersion.fr> | 2018-04-05 11:38:14 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-05 11:40:39 -0400 |
commit | dcd15a2d3dd93e057fe702238eb21dd70331b44f (patch) | |
tree | d3fb74ee77369ad52edeba7bac1f3ada907d3099 /sway/tree/view.c | |
parent | Error handling in swaylock daemonize() (diff) | |
download | sway-dcd15a2d3dd93e057fe702238eb21dd70331b44f.tar.gz sway-dcd15a2d3dd93e057fe702238eb21dd70331b44f.tar.zst sway-dcd15a2d3dd93e057fe702238eb21dd70331b44f.zip |
Implement shell views
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 13 |
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 @@ | |||
7 | #include "sway/tree/layout.h" | 7 | #include "sway/tree/layout.h" |
8 | #include "sway/tree/view.h" | 8 | #include "sway/tree/view.h" |
9 | 9 | ||
10 | struct sway_view *view_create(enum sway_view_type type, | 10 | void view_init(struct sway_view *view, enum sway_view_type type, |
11 | const struct sway_view_impl *impl) { | 11 | const struct sway_view_impl *impl) { |
12 | struct sway_view *view = calloc(1, sizeof(struct sway_view)); | ||
13 | if (view == NULL) { | ||
14 | return NULL; | ||
15 | } | ||
16 | view->type = type; | 12 | view->type = type; |
17 | view->impl = impl; | 13 | view->impl = impl; |
18 | return view; | ||
19 | } | 14 | } |
20 | 15 | ||
21 | void view_destroy(struct sway_view *view) { | 16 | void view_destroy(struct sway_view *view) { |
@@ -28,6 +23,12 @@ void view_destroy(struct sway_view *view) { | |||
28 | } | 23 | } |
29 | 24 | ||
30 | container_destroy(view->swayc); | 25 | container_destroy(view->swayc); |
26 | |||
27 | if (view->impl->destroy) { | ||
28 | view->impl->destroy(view); | ||
29 | } else { | ||
30 | free(view); | ||
31 | } | ||
31 | } | 32 | } |
32 | 33 | ||
33 | const char *view_get_title(struct sway_view *view) { | 34 | const char *view_get_title(struct sway_view *view) { |