summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 73e3d445..8f044621 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -15,7 +15,6 @@ struct sway_view *view_create(enum sway_view_type type,
15 } 15 }
16 view->type = type; 16 view->type = type;
17 view->impl = impl; 17 view->impl = impl;
18 wl_list_init(&view->unmanaged_view_link);
19 return view; 18 return view;
20} 19}
21 20
@@ -27,10 +26,8 @@ void view_destroy(struct sway_view *view) {
27 if (view->surface != NULL) { 26 if (view->surface != NULL) {
28 view_unmap(view); 27 view_unmap(view);
29 } 28 }
30 if (view->swayc != NULL) {
31 container_view_destroy(view->swayc);
32 }
33 29
30 container_view_destroy(view->swayc);
34 free(view); 31 free(view);
35} 32}
36 33
@@ -106,15 +103,10 @@ void view_damage_from(struct sway_view *view) {
106} 103}
107 104
108static void view_get_layout_box(struct sway_view *view, struct wlr_box *box) { 105static void view_get_layout_box(struct sway_view *view, struct wlr_box *box) {
109 struct sway_container *cont = container_parent(view->swayc, C_OUTPUT); 106 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
110
111 struct wlr_output_layout *output_layout =
112 root_container.sway_root->output_layout;
113 struct wlr_box *output_box = wlr_output_layout_get_box(output_layout,
114 cont->sway_output->wlr_output);
115 107
116 box->x = output_box->x + view->swayc->x; 108 box->x = output->x + view->swayc->x;
117 box->y = output_box->y + view->swayc->y; 109 box->y = output->y + view->swayc->y;
118 box->width = view->width; 110 box->width = view->width;
119 box->height = view->height; 111 box->height = view->height;
120} 112}
@@ -161,23 +153,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
161 view_update_outputs(view, NULL); 153 view_update_outputs(view, NULL);
162} 154}
163 155
164void view_map_unmanaged(struct sway_view *view,
165 struct wlr_surface *wlr_surface) {
166 if (!sway_assert(view->surface == NULL, "cannot map mapped view")) {
167 return;
168 }
169
170 view->surface = wlr_surface;
171 view->swayc = NULL;
172
173 wl_list_insert(&root_container.sway_root->unmanaged_views,
174 &view->unmanaged_view_link);
175
176 view_damage_whole(view);
177 // TODO: make this work for unmanaged views
178 //view_update_outputs(view, NULL);
179}
180
181void view_unmap(struct sway_view *view) { 156void view_unmap(struct sway_view *view) {
182 if (!sway_assert(view->surface != NULL, "cannot unmap unmapped view")) { 157 if (!sway_assert(view->surface != NULL, "cannot unmap unmapped view")) {
183 return; 158 return;
@@ -185,9 +160,6 @@ void view_unmap(struct sway_view *view) {
185 160
186 view_damage_whole(view); 161 view_damage_whole(view);
187 162
188 wl_list_remove(&view->unmanaged_view_link);
189 wl_list_init(&view->unmanaged_view_link);
190
191 container_view_destroy(view->swayc); 163 container_view_destroy(view->swayc);
192 164
193 view->swayc = NULL; 165 view->swayc = NULL;