aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index af55a54e..f8620b72 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -116,6 +116,7 @@ struct sway_container *container_create(enum sway_container_type type) {
116 116
117 if (type != C_VIEW) { 117 if (type != C_VIEW) {
118 c->children = create_list(); 118 c->children = create_list();
119 //c->pending.children = create_list();
119 } 120 }
120 121
121 wl_signal_init(&c->events.destroy); 122 wl_signal_init(&c->events.destroy);
@@ -167,6 +168,7 @@ static void _container_destroy(struct sway_container *cont) {
167 wlr_texture_destroy(cont->title_urgent); 168 wlr_texture_destroy(cont->title_urgent);
168 169
169 list_free(cont->children); 170 list_free(cont->children);
171 //list_free(cont->pending.children);
170 cont->children = NULL; 172 cont->children = NULL;
171 free(cont); 173 free(cont);
172} 174}
@@ -207,6 +209,7 @@ static struct sway_container *container_workspace_destroy(
207 container_move_to(floating->children->items[i], 209 container_move_to(floating->children->items[i],
208 new_workspace->sway_workspace->floating); 210 new_workspace->sway_workspace->floating);
209 } 211 }
212 arrange_and_commit(new_workspace);
210 } 213 }
211 214
212 struct sway_workspace *sway_workspace = workspace->sway_workspace; 215 struct sway_workspace *sway_workspace = workspace->sway_workspace;
@@ -267,10 +270,10 @@ static struct sway_container *container_output_destroy(
267 } 270 }
268 271
269 container_sort_workspaces(new_output); 272 container_sort_workspaces(new_output);
270 arrange_output(new_output);
271 } 273 }
272 } 274 }
273 } 275 }
276 arrange_and_commit(&root_container);
274 277
275 wl_list_remove(&output->sway_output->mode.link); 278 wl_list_remove(&output->sway_output->mode.link);
276 wl_list_remove(&output->sway_output->transform.link); 279 wl_list_remove(&output->sway_output->transform.link);
@@ -927,13 +930,12 @@ void container_set_floating(struct sway_container *container, bool enable) {
927 930
928 struct sway_container *workspace = container_parent(container, C_WORKSPACE); 931 struct sway_container *workspace = container_parent(container, C_WORKSPACE);
929 struct sway_seat *seat = input_manager_current_seat(input_manager); 932 struct sway_seat *seat = input_manager_current_seat(input_manager);
930 container_damage_whole(container);
931 933
932 if (enable) { 934 if (enable) {
933 container_remove_child(container); 935 container_remove_child(container);
934 container_add_child(workspace->sway_workspace->floating, container); 936 container_add_child(workspace->sway_workspace->floating, container);
935 if (container->type == C_VIEW) { 937 if (container->type == C_VIEW) {
936 view_autoconfigure(container->sway_view); 938 view_init_floating(container->sway_view);
937 } 939 }
938 seat_set_focus(seat, seat_get_focus_inactive(seat, container)); 940 seat_set_focus(seat, seat_get_focus_inactive(seat, container));
939 container_reap_empty_recursive(workspace); 941 container_reap_empty_recursive(workspace);
@@ -946,8 +948,8 @@ void container_set_floating(struct sway_container *container, bool enable) {
946 container->is_sticky = false; 948 container->is_sticky = false;
947 container_reap_empty_recursive(workspace->sway_workspace->floating); 949 container_reap_empty_recursive(workspace->sway_workspace->floating);
948 } 950 }
949 arrange_workspace(workspace); 951
950 container_damage_whole(container); 952 ipc_event_window(container, "floating");
951} 953}
952 954
953void container_set_geometry_from_floating_view(struct sway_container *con) { 955void container_set_geometry_from_floating_view(struct sway_container *con) {
@@ -976,3 +978,12 @@ bool container_is_floating(struct sway_container *container) {
976 } 978 }
977 return container->parent == workspace->sway_workspace->floating; 979 return container->parent == workspace->sway_workspace->floating;
978} 980}
981
982struct wlr_box *container_get_box(struct sway_container *container) {
983 struct wlr_box *box = calloc(1, sizeof(struct wlr_box));
984 box->x = container->x;
985 box->y = container->y;
986 box->width = container->width;
987 box->height = container->height;
988 return box;
989}