aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-12 23:22:51 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56 /sway/tree/container.c
parentAdd missing transaction commits to seatop_default (diff)
downloadsway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.gz
sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.zst
sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.zip
container: Move pending state to state struct
Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c408
1 files changed, 204 insertions, 204 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 6a9ce1c4..8c8dfb3b 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -30,12 +30,12 @@ struct sway_container *container_create(struct sway_view *view) {
30 return NULL; 30 return NULL;
31 } 31 }
32 node_init(&c->node, N_CONTAINER, c); 32 node_init(&c->node, N_CONTAINER, c);
33 c->layout = L_NONE; 33 c->pending.layout = L_NONE;
34 c->view = view; 34 c->view = view;
35 c->alpha = 1.0f; 35 c->alpha = 1.0f;
36 36
37 if (!view) { 37 if (!view) {
38 c->children = create_list(); 38 c->pending.children = create_list();
39 c->current.children = create_list(); 39 c->current.children = create_list();
40 } 40 }
41 c->marks = create_list(); 41 c->marks = create_list();
@@ -62,7 +62,7 @@ void container_destroy(struct sway_container *con) {
62 wlr_texture_destroy(con->title_focused_inactive); 62 wlr_texture_destroy(con->title_focused_inactive);
63 wlr_texture_destroy(con->title_unfocused); 63 wlr_texture_destroy(con->title_unfocused);
64 wlr_texture_destroy(con->title_urgent); 64 wlr_texture_destroy(con->title_urgent);
65 list_free(con->children); 65 list_free(con->pending.children);
66 list_free(con->current.children); 66 list_free(con->current.children);
67 list_free(con->outputs); 67 list_free(con->outputs);
68 68
@@ -90,10 +90,10 @@ void container_begin_destroy(struct sway_container *con) {
90 } 90 }
91 // The workspace must have the fullscreen pointer cleared so that the 91 // The workspace must have the fullscreen pointer cleared so that the
92 // seat code can find an appropriate new focus. 92 // seat code can find an appropriate new focus.
93 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE && con->workspace) { 93 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE && con->pending.workspace) {
94 con->workspace->fullscreen = NULL; 94 con->pending.workspace->fullscreen = NULL;
95 } 95 }
96 if (con->scratchpad && con->fullscreen_mode == FULLSCREEN_GLOBAL) { 96 if (con->scratchpad && con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
97 container_fullscreen_disable(con); 97 container_fullscreen_disable(con);
98 } 98 }
99 99
@@ -108,11 +108,11 @@ void container_begin_destroy(struct sway_container *con) {
108 root_scratchpad_remove_container(con); 108 root_scratchpad_remove_container(con);
109 } 109 }
110 110
111 if (con->fullscreen_mode == FULLSCREEN_GLOBAL) { 111 if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
112 container_fullscreen_disable(con); 112 container_fullscreen_disable(con);
113 } 113 }
114 114
115 if (con->parent || con->workspace) { 115 if (con->pending.parent || con->pending.workspace) {
116 container_detach(con); 116 container_detach(con);
117 } 117 }
118} 118}
@@ -121,12 +121,12 @@ void container_reap_empty(struct sway_container *con) {
121 if (con->view) { 121 if (con->view) {
122 return; 122 return;
123 } 123 }
124 struct sway_workspace *ws = con->workspace; 124 struct sway_workspace *ws = con->pending.workspace;
125 while (con) { 125 while (con) {
126 if (con->children->length) { 126 if (con->pending.children->length) {
127 return; 127 return;
128 } 128 }
129 struct sway_container *parent = con->parent; 129 struct sway_container *parent = con->pending.parent;
130 container_begin_destroy(con); 130 container_begin_destroy(con);
131 con = parent; 131 con = parent;
132 } 132 }
@@ -139,9 +139,9 @@ struct sway_container *container_flatten(struct sway_container *container) {
139 if (container->view) { 139 if (container->view) {
140 return NULL; 140 return NULL;
141 } 141 }
142 while (container && container->children->length == 1) { 142 while (container && container->pending.children->length == 1) {
143 struct sway_container *child = container->children->items[0]; 143 struct sway_container *child = container->pending.children->items[0];
144 struct sway_container *parent = container->parent; 144 struct sway_container *parent = container->pending.parent;
145 container_replace(container, child); 145 container_replace(container, child);
146 container_begin_destroy(container); 146 container_begin_destroy(container);
147 container = parent; 147 container = parent;
@@ -151,11 +151,11 @@ struct sway_container *container_flatten(struct sway_container *container) {
151 151
152struct sway_container *container_find_child(struct sway_container *container, 152struct sway_container *container_find_child(struct sway_container *container,
153 bool (*test)(struct sway_container *con, void *data), void *data) { 153 bool (*test)(struct sway_container *con, void *data), void *data) {
154 if (!container->children) { 154 if (!container->pending.children) {
155 return NULL; 155 return NULL;
156 } 156 }
157 for (int i = 0; i < container->children->length; ++i) { 157 for (int i = 0; i < container->pending.children->length; ++i) {
158 struct sway_container *child = container->children->items[i]; 158 struct sway_container *child = container->pending.children->items[i];
159 if (test(child, data)) { 159 if (test(child, data)) {
160 return child; 160 return child;
161 } 161 }
@@ -319,10 +319,10 @@ struct sway_container *view_container_at(struct sway_node *parent,
319 319
320 struct sway_container *container = parent->sway_container; 320 struct sway_container *container = parent->sway_container;
321 struct wlr_box box = { 321 struct wlr_box box = {
322 .x = container->x, 322 .x = container->pending.x,
323 .y = container->y, 323 .y = container->pending.y,
324 .width = container->width, 324 .width = container->pending.width,
325 .height = container->height, 325 .height = container->pending.height,
326 }; 326 };
327 327
328 if (wlr_box_contains_point(&box, lx, ly)) { 328 if (wlr_box_contains_point(&box, lx, ly)) {
@@ -408,9 +408,9 @@ struct sway_container *container_at(struct sway_workspace *workspace,
408void container_for_each_child(struct sway_container *container, 408void container_for_each_child(struct sway_container *container,
409 void (*f)(struct sway_container *container, void *data), 409 void (*f)(struct sway_container *container, void *data),
410 void *data) { 410 void *data) {
411 if (container->children) { 411 if (container->pending.children) {
412 for (int i = 0; i < container->children->length; ++i) { 412 for (int i = 0; i < container->pending.children->length; ++i) {
413 struct sway_container *child = container->children->items[i]; 413 struct sway_container *child = container->pending.children->items[i];
414 f(child, data); 414 f(child, data);
415 container_for_each_child(child, f, data); 415 container_for_each_child(child, f, data);
416 } 416 }
@@ -420,7 +420,7 @@ void container_for_each_child(struct sway_container *container,
420bool container_has_ancestor(struct sway_container *descendant, 420bool container_has_ancestor(struct sway_container *descendant,
421 struct sway_container *ancestor) { 421 struct sway_container *ancestor) {
422 while (descendant) { 422 while (descendant) {
423 descendant = descendant->parent; 423 descendant = descendant->pending.parent;
424 if (descendant == ancestor) { 424 if (descendant == ancestor) {
425 return true; 425 return true;
426 } 426 }
@@ -596,23 +596,23 @@ size_t container_build_representation(enum sway_container_layout layout,
596 596
597void container_update_representation(struct sway_container *con) { 597void container_update_representation(struct sway_container *con) {
598 if (!con->view) { 598 if (!con->view) {
599 size_t len = container_build_representation(con->layout, 599 size_t len = container_build_representation(con->pending.layout,
600 con->children, NULL); 600 con->pending.children, NULL);
601 free(con->formatted_title); 601 free(con->formatted_title);
602 con->formatted_title = calloc(len + 1, sizeof(char)); 602 con->formatted_title = calloc(len + 1, sizeof(char));
603 if (!sway_assert(con->formatted_title, 603 if (!sway_assert(con->formatted_title,
604 "Unable to allocate title string")) { 604 "Unable to allocate title string")) {
605 return; 605 return;
606 } 606 }
607 container_build_representation(con->layout, con->children, 607 container_build_representation(con->pending.layout, con->pending.children,
608 con->formatted_title); 608 con->formatted_title);
609 container_calculate_title_height(con); 609 container_calculate_title_height(con);
610 container_update_title_textures(con); 610 container_update_title_textures(con);
611 } 611 }
612 if (con->parent) { 612 if (con->pending.parent) {
613 container_update_representation(con->parent); 613 container_update_representation(con->pending.parent);
614 } else if (con->workspace) { 614 } else if (con->pending.workspace) {
615 workspace_update_representation(con->workspace); 615 workspace_update_representation(con->pending.workspace);
616 } 616 }
617} 617}
618 618
@@ -663,20 +663,20 @@ static void floating_natural_resize(struct sway_container *con) {
663 floating_calculate_constraints(&min_width, &max_width, 663 floating_calculate_constraints(&min_width, &max_width,
664 &min_height, &max_height); 664 &min_height, &max_height);
665 if (!con->view) { 665 if (!con->view) {
666 con->width = fmax(min_width, fmin(con->width, max_width)); 666 con->pending.width = fmax(min_width, fmin(con->pending.width, max_width));
667 con->height = fmax(min_height, fmin(con->height, max_height)); 667 con->pending.height = fmax(min_height, fmin(con->pending.height, max_height));
668 } else { 668 } else {
669 struct sway_view *view = con->view; 669 struct sway_view *view = con->view;
670 con->content_width = 670 con->pending.content_width =
671 fmax(min_width, fmin(view->natural_width, max_width)); 671 fmax(min_width, fmin(view->natural_width, max_width));
672 con->content_height = 672 con->pending.content_height =
673 fmax(min_height, fmin(view->natural_height, max_height)); 673 fmax(min_height, fmin(view->natural_height, max_height));
674 container_set_geometry_from_content(con); 674 container_set_geometry_from_content(con);
675 } 675 }
676} 676}
677 677
678void container_floating_resize_and_center(struct sway_container *con) { 678void container_floating_resize_and_center(struct sway_container *con) {
679 struct sway_workspace *ws = con->workspace; 679 struct sway_workspace *ws = con->pending.workspace;
680 if (!ws) { 680 if (!ws) {
681 // On scratchpad, just resize 681 // On scratchpad, just resize
682 floating_natural_resize(con); 682 floating_natural_resize(con);
@@ -687,42 +687,42 @@ void container_floating_resize_and_center(struct sway_container *con) {
687 ws->output->wlr_output); 687 ws->output->wlr_output);
688 if (!ob) { 688 if (!ob) {
689 // On NOOP output. Will be called again when moved to an output 689 // On NOOP output. Will be called again when moved to an output
690 con->x = 0; 690 con->pending.x = 0;
691 con->y = 0; 691 con->pending.y = 0;
692 con->width = 0; 692 con->pending.width = 0;
693 con->height = 0; 693 con->pending.height = 0;
694 return; 694 return;
695 } 695 }
696 696
697 floating_natural_resize(con); 697 floating_natural_resize(con);
698 if (!con->view) { 698 if (!con->view) {
699 if (con->width > ws->width || con->height > ws->height) { 699 if (con->pending.width > ws->width || con->pending.height > ws->height) {
700 con->x = ob->x + (ob->width - con->width) / 2; 700 con->pending.x = ob->x + (ob->width - con->pending.width) / 2;
701 con->y = ob->y + (ob->height - con->height) / 2; 701 con->pending.y = ob->y + (ob->height - con->pending.height) / 2;
702 } else { 702 } else {
703 con->x = ws->x + (ws->width - con->width) / 2; 703 con->pending.x = ws->x + (ws->width - con->pending.width) / 2;
704 con->y = ws->y + (ws->height - con->height) / 2; 704 con->pending.y = ws->y + (ws->height - con->pending.height) / 2;
705 } 705 }
706 } else { 706 } else {
707 if (con->content_width > ws->width 707 if (con->pending.content_width > ws->width
708 || con->content_height > ws->height) { 708 || con->pending.content_height > ws->height) {
709 con->content_x = ob->x + (ob->width - con->content_width) / 2; 709 con->pending.content_x = ob->x + (ob->width - con->pending.content_width) / 2;
710 con->content_y = ob->y + (ob->height - con->content_height) / 2; 710 con->pending.content_y = ob->y + (ob->height - con->pending.content_height) / 2;
711 } else { 711 } else {
712 con->content_x = ws->x + (ws->width - con->content_width) / 2; 712 con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2;
713 con->content_y = ws->y + (ws->height - con->content_height) / 2; 713 con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2;
714 } 714 }
715 715
716 // If the view's border is B_NONE then these properties are ignored. 716 // If the view's border is B_NONE then these properties are ignored.
717 con->border_top = con->border_bottom = true; 717 con->pending.border_top = con->pending.border_bottom = true;
718 con->border_left = con->border_right = true; 718 con->pending.border_left = con->pending.border_right = true;
719 719
720 container_set_geometry_from_content(con); 720 container_set_geometry_from_content(con);
721 } 721 }
722} 722}
723 723
724void container_floating_set_default_size(struct sway_container *con) { 724void container_floating_set_default_size(struct sway_container *con) {
725 if (!sway_assert(con->workspace, "Expected a container on a workspace")) { 725 if (!sway_assert(con->pending.workspace, "Expected a container on a workspace")) {
726 return; 726 return;
727 } 727 }
728 728
@@ -730,16 +730,16 @@ void container_floating_set_default_size(struct sway_container *con) {
730 floating_calculate_constraints(&min_width, &max_width, 730 floating_calculate_constraints(&min_width, &max_width,
731 &min_height, &max_height); 731 &min_height, &max_height);
732 struct wlr_box *box = calloc(1, sizeof(struct wlr_box)); 732 struct wlr_box *box = calloc(1, sizeof(struct wlr_box));
733 workspace_get_box(con->workspace, box); 733 workspace_get_box(con->pending.workspace, box);
734 734
735 double width = fmax(min_width, fmin(box->width * 0.5, max_width)); 735 double width = fmax(min_width, fmin(box->width * 0.5, max_width));
736 double height = fmax(min_height, fmin(box->height * 0.75, max_height)); 736 double height = fmax(min_height, fmin(box->height * 0.75, max_height));
737 if (!con->view) { 737 if (!con->view) {
738 con->width = width; 738 con->pending.width = width;
739 con->height = height; 739 con->pending.height = height;
740 } else { 740 } else {
741 con->content_width = width; 741 con->pending.content_width = width;
742 con->content_height = height; 742 con->pending.content_height = height;
743 container_set_geometry_from_content(con); 743 container_set_geometry_from_content(con);
744 } 744 }
745 745
@@ -761,8 +761,8 @@ void container_set_resizing(struct sway_container *con, bool resizing) {
761 con->view->impl->set_resizing(con->view, resizing); 761 con->view->impl->set_resizing(con->view, resizing);
762 } 762 }
763 } else { 763 } else {
764 for (int i = 0; i < con->children->length; ++i ) { 764 for (int i = 0; i < con->pending.children->length; ++i ) {
765 struct sway_container *child = con->children->items[i]; 765 struct sway_container *child = con->pending.children->items[i];
766 container_set_resizing(child, resizing); 766 container_set_resizing(child, resizing);
767 } 767 }
768 } 768 }
@@ -774,16 +774,16 @@ void container_set_floating(struct sway_container *container, bool enable) {
774 } 774 }
775 775
776 struct sway_seat *seat = input_manager_current_seat(); 776 struct sway_seat *seat = input_manager_current_seat();
777 struct sway_workspace *workspace = container->workspace; 777 struct sway_workspace *workspace = container->pending.workspace;
778 778
779 if (enable) { 779 if (enable) {
780 struct sway_container *old_parent = container->parent; 780 struct sway_container *old_parent = container->pending.parent;
781 container_detach(container); 781 container_detach(container);
782 workspace_add_floating(workspace, container); 782 workspace_add_floating(workspace, container);
783 if (container->view) { 783 if (container->view) {
784 view_set_tiled(container->view, false); 784 view_set_tiled(container->view, false);
785 if (container->view->using_csd) { 785 if (container->view->using_csd) {
786 container->border = B_CSD; 786 container->pending.border = B_CSD;
787 } 787 }
788 } 788 }
789 container_floating_set_default_size(container); 789 container_floating_set_default_size(container);
@@ -801,18 +801,18 @@ void container_set_floating(struct sway_container *container, bool enable) {
801 seat_get_focus_inactive_tiling(seat, workspace); 801 seat_get_focus_inactive_tiling(seat, workspace);
802 if (reference) { 802 if (reference) {
803 container_add_sibling(reference, container, 1); 803 container_add_sibling(reference, container, 1);
804 container->width = reference->width; 804 container->pending.width = reference->pending.width;
805 container->height = reference->height; 805 container->pending.height = reference->pending.height;
806 } else { 806 } else {
807 struct sway_container *other = 807 struct sway_container *other =
808 workspace_add_tiling(workspace, container); 808 workspace_add_tiling(workspace, container);
809 other->width = workspace->width; 809 other->pending.width = workspace->width;
810 other->height = workspace->height; 810 other->pending.height = workspace->height;
811 } 811 }
812 if (container->view) { 812 if (container->view) {
813 view_set_tiled(container->view, true); 813 view_set_tiled(container->view, true);
814 if (container->view->using_csd) { 814 if (container->view->using_csd) {
815 container->border = container->saved_border; 815 container->pending.border = container->saved_border;
816 } 816 }
817 } 817 }
818 container->width_fraction = 0; 818 container->width_fraction = 0;
@@ -834,22 +834,22 @@ void container_set_geometry_from_content(struct sway_container *con) {
834 size_t border_width = 0; 834 size_t border_width = 0;
835 size_t top = 0; 835 size_t top = 0;
836 836
837 if (con->border != B_CSD) { 837 if (con->pending.border != B_CSD) {
838 border_width = con->border_thickness * (con->border != B_NONE); 838 border_width = con->pending.border_thickness * (con->pending.border != B_NONE);
839 top = con->border == B_NORMAL ? 839 top = con->pending.border == B_NORMAL ?
840 container_titlebar_height() : border_width; 840 container_titlebar_height() : border_width;
841 } 841 }
842 842
843 con->x = con->content_x - border_width; 843 con->pending.x = con->pending.content_x - border_width;
844 con->y = con->content_y - top; 844 con->pending.y = con->pending.content_y - top;
845 con->width = con->content_width + border_width * 2; 845 con->pending.width = con->pending.content_width + border_width * 2;
846 con->height = top + con->content_height + border_width; 846 con->pending.height = top + con->pending.content_height + border_width;
847 node_set_dirty(&con->node); 847 node_set_dirty(&con->node);
848} 848}
849 849
850bool container_is_floating(struct sway_container *container) { 850bool container_is_floating(struct sway_container *container) {
851 if (!container->parent && container->workspace && 851 if (!container->pending.parent && container->pending.workspace &&
852 list_find(container->workspace->floating, container) != -1) { 852 list_find(container->pending.workspace->floating, container) != -1) {
853 return true; 853 return true;
854 } 854 }
855 if (container->scratchpad) { 855 if (container->scratchpad) {
@@ -859,10 +859,10 @@ bool container_is_floating(struct sway_container *container) {
859} 859}
860 860
861void container_get_box(struct sway_container *container, struct wlr_box *box) { 861void container_get_box(struct sway_container *container, struct wlr_box *box) {
862 box->x = container->x; 862 box->x = container->pending.x;
863 box->y = container->y; 863 box->y = container->pending.y;
864 box->width = container->width; 864 box->width = container->pending.width;
865 box->height = container->height; 865 box->height = container->pending.height;
866} 866}
867 867
868/** 868/**
@@ -870,14 +870,14 @@ void container_get_box(struct sway_container *container, struct wlr_box *box) {
870 */ 870 */
871void container_floating_translate(struct sway_container *con, 871void container_floating_translate(struct sway_container *con,
872 double x_amount, double y_amount) { 872 double x_amount, double y_amount) {
873 con->x += x_amount; 873 con->pending.x += x_amount;
874 con->y += y_amount; 874 con->pending.y += y_amount;
875 con->content_x += x_amount; 875 con->pending.content_x += x_amount;
876 con->content_y += y_amount; 876 con->pending.content_y += y_amount;
877 877
878 if (con->children) { 878 if (con->pending.children) {
879 for (int i = 0; i < con->children->length; ++i) { 879 for (int i = 0; i < con->pending.children->length; ++i) {
880 struct sway_container *child = con->children->items[i]; 880 struct sway_container *child = con->pending.children->items[i];
881 container_floating_translate(child, x_amount, y_amount); 881 container_floating_translate(child, x_amount, y_amount);
882 } 882 }
883 } 883 }
@@ -893,8 +893,8 @@ void container_floating_translate(struct sway_container *con,
893 * center. 893 * center.
894 */ 894 */
895struct sway_output *container_floating_find_output(struct sway_container *con) { 895struct sway_output *container_floating_find_output(struct sway_container *con) {
896 double center_x = con->x + con->width / 2; 896 double center_x = con->pending.x + con->pending.width / 2;
897 double center_y = con->y + con->height / 2; 897 double center_y = con->pending.y + con->pending.height / 2;
898 struct sway_output *closest_output = NULL; 898 struct sway_output *closest_output = NULL;
899 double closest_distance = DBL_MAX; 899 double closest_distance = DBL_MAX;
900 for (int i = 0; i < root->outputs->length; ++i) { 900 for (int i = 0; i < root->outputs->length; ++i) {
@@ -925,11 +925,11 @@ void container_floating_move_to(struct sway_container *con,
925 "Expected a floating container")) { 925 "Expected a floating container")) {
926 return; 926 return;
927 } 927 }
928 container_floating_translate(con, lx - con->x, ly - con->y); 928 container_floating_translate(con, lx - con->pending.x, ly - con->pending.y);
929 if (container_is_scratchpad_hidden(con)) { 929 if (container_is_scratchpad_hidden(con)) {
930 return; 930 return;
931 } 931 }
932 struct sway_workspace *old_workspace = con->workspace; 932 struct sway_workspace *old_workspace = con->pending.workspace;
933 struct sway_output *new_output = container_floating_find_output(con); 933 struct sway_output *new_output = container_floating_find_output(con);
934 if (!sway_assert(new_output, "Unable to find any output")) { 934 if (!sway_assert(new_output, "Unable to find any output")) {
935 return; 935 return;
@@ -951,10 +951,10 @@ void container_floating_move_to_center(struct sway_container *con) {
951 "Expected a floating container")) { 951 "Expected a floating container")) {
952 return; 952 return;
953 } 953 }
954 struct sway_workspace *ws = con->workspace; 954 struct sway_workspace *ws = con->pending.workspace;
955 double new_lx = ws->x + (ws->width - con->width) / 2; 955 double new_lx = ws->x + (ws->width - con->pending.width) / 2;
956 double new_ly = ws->y + (ws->height - con->height) / 2; 956 double new_ly = ws->y + (ws->height - con->pending.height) / 2;
957 container_floating_translate(con, new_lx - con->x, new_ly - con->y); 957 container_floating_translate(con, new_lx - con->pending.x, new_ly - con->pending.y);
958} 958}
959 959
960static bool find_urgent_iterator(struct sway_container *con, void *data) { 960static bool find_urgent_iterator(struct sway_container *con, void *data) {
@@ -987,27 +987,27 @@ static void set_fullscreen_iterator(struct sway_container *con, void *data) {
987} 987}
988 988
989static void container_fullscreen_workspace(struct sway_container *con) { 989static void container_fullscreen_workspace(struct sway_container *con) {
990 if (!sway_assert(con->fullscreen_mode == FULLSCREEN_NONE, 990 if (!sway_assert(con->pending.fullscreen_mode == FULLSCREEN_NONE,
991 "Expected a non-fullscreen container")) { 991 "Expected a non-fullscreen container")) {
992 return; 992 return;
993 } 993 }
994 bool enable = true; 994 bool enable = true;
995 set_fullscreen_iterator(con, &enable); 995 set_fullscreen_iterator(con, &enable);
996 container_for_each_child(con, set_fullscreen_iterator, &enable); 996 container_for_each_child(con, set_fullscreen_iterator, &enable);
997 con->fullscreen_mode = FULLSCREEN_WORKSPACE; 997 con->pending.fullscreen_mode = FULLSCREEN_WORKSPACE;
998 998
999 con->saved_x = con->x; 999 con->saved_x = con->pending.x;
1000 con->saved_y = con->y; 1000 con->saved_y = con->pending.y;
1001 con->saved_width = con->width; 1001 con->saved_width = con->pending.width;
1002 con->saved_height = con->height; 1002 con->saved_height = con->pending.height;
1003 1003
1004 if (con->workspace) { 1004 if (con->pending.workspace) {
1005 con->workspace->fullscreen = con; 1005 con->pending.workspace->fullscreen = con;
1006 struct sway_seat *seat; 1006 struct sway_seat *seat;
1007 struct sway_workspace *focus_ws; 1007 struct sway_workspace *focus_ws;
1008 wl_list_for_each(seat, &server.input->seats, link) { 1008 wl_list_for_each(seat, &server.input->seats, link) {
1009 focus_ws = seat_get_focused_workspace(seat); 1009 focus_ws = seat_get_focused_workspace(seat);
1010 if (focus_ws == con->workspace) { 1010 if (focus_ws == con->pending.workspace) {
1011 seat_set_focus_container(seat, con); 1011 seat_set_focus_container(seat, con);
1012 } else { 1012 } else {
1013 struct sway_node *focus = 1013 struct sway_node *focus =
@@ -1023,7 +1023,7 @@ static void container_fullscreen_workspace(struct sway_container *con) {
1023} 1023}
1024 1024
1025static void container_fullscreen_global(struct sway_container *con) { 1025static void container_fullscreen_global(struct sway_container *con) {
1026 if (!sway_assert(con->fullscreen_mode == FULLSCREEN_NONE, 1026 if (!sway_assert(con->pending.fullscreen_mode == FULLSCREEN_NONE,
1027 "Expected a non-fullscreen container")) { 1027 "Expected a non-fullscreen container")) {
1028 return; 1028 return;
1029 } 1029 }
@@ -1032,10 +1032,10 @@ static void container_fullscreen_global(struct sway_container *con) {
1032 container_for_each_child(con, set_fullscreen_iterator, &enable); 1032 container_for_each_child(con, set_fullscreen_iterator, &enable);
1033 1033
1034 root->fullscreen_global = con; 1034 root->fullscreen_global = con;
1035 con->saved_x = con->x; 1035 con->saved_x = con->pending.x;
1036 con->saved_y = con->y; 1036 con->saved_y = con->pending.y;
1037 con->saved_width = con->width; 1037 con->saved_width = con->pending.width;
1038 con->saved_height = con->height; 1038 con->saved_height = con->pending.height;
1039 1039
1040 struct sway_seat *seat; 1040 struct sway_seat *seat;
1041 wl_list_for_each(seat, &server.input->seats, link) { 1041 wl_list_for_each(seat, &server.input->seats, link) {
@@ -1045,13 +1045,13 @@ static void container_fullscreen_global(struct sway_container *con) {
1045 } 1045 }
1046 } 1046 }
1047 1047
1048 con->fullscreen_mode = FULLSCREEN_GLOBAL; 1048 con->pending.fullscreen_mode = FULLSCREEN_GLOBAL;
1049 container_end_mouse_operation(con); 1049 container_end_mouse_operation(con);
1050 ipc_event_window(con, "fullscreen_mode"); 1050 ipc_event_window(con, "fullscreen_mode");
1051} 1051}
1052 1052
1053void container_fullscreen_disable(struct sway_container *con) { 1053void container_fullscreen_disable(struct sway_container *con) {
1054 if (!sway_assert(con->fullscreen_mode != FULLSCREEN_NONE, 1054 if (!sway_assert(con->pending.fullscreen_mode != FULLSCREEN_NONE,
1055 "Expected a fullscreen container")) { 1055 "Expected a fullscreen container")) {
1056 return; 1056 return;
1057 } 1057 }
@@ -1060,19 +1060,19 @@ void container_fullscreen_disable(struct sway_container *con) {
1060 container_for_each_child(con, set_fullscreen_iterator, &enable); 1060 container_for_each_child(con, set_fullscreen_iterator, &enable);
1061 1061
1062 if (container_is_floating(con)) { 1062 if (container_is_floating(con)) {
1063 con->x = con->saved_x; 1063 con->pending.x = con->saved_x;
1064 con->y = con->saved_y; 1064 con->pending.y = con->saved_y;
1065 con->width = con->saved_width; 1065 con->pending.width = con->saved_width;
1066 con->height = con->saved_height; 1066 con->pending.height = con->saved_height;
1067 } 1067 }
1068 1068
1069 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) { 1069 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
1070 if (con->workspace) { 1070 if (con->pending.workspace) {
1071 con->workspace->fullscreen = NULL; 1071 con->pending.workspace->fullscreen = NULL;
1072 if (container_is_floating(con)) { 1072 if (container_is_floating(con)) {
1073 struct sway_output *output = 1073 struct sway_output *output =
1074 container_floating_find_output(con); 1074 container_floating_find_output(con);
1075 if (con->workspace->output != output) { 1075 if (con->pending.workspace->output != output) {
1076 container_floating_move_to_center(con); 1076 container_floating_move_to_center(con);
1077 } 1077 }
1078 } 1078 }
@@ -1084,11 +1084,11 @@ void container_fullscreen_disable(struct sway_container *con) {
1084 // If the container was mapped as fullscreen and set as floating by 1084 // If the container was mapped as fullscreen and set as floating by
1085 // criteria, it needs to be reinitialized as floating to get the proper 1085 // criteria, it needs to be reinitialized as floating to get the proper
1086 // size and location 1086 // size and location
1087 if (container_is_floating(con) && (con->width == 0 || con->height == 0)) { 1087 if (container_is_floating(con) && (con->pending.width == 0 || con->pending.height == 0)) {
1088 container_floating_resize_and_center(con); 1088 container_floating_resize_and_center(con);
1089 } 1089 }
1090 1090
1091 con->fullscreen_mode = FULLSCREEN_NONE; 1091 con->pending.fullscreen_mode = FULLSCREEN_NONE;
1092 container_end_mouse_operation(con); 1092 container_end_mouse_operation(con);
1093 ipc_event_window(con, "fullscreen_mode"); 1093 ipc_event_window(con, "fullscreen_mode");
1094 1094
@@ -1106,7 +1106,7 @@ void container_fullscreen_disable(struct sway_container *con) {
1106 1106
1107void container_set_fullscreen(struct sway_container *con, 1107void container_set_fullscreen(struct sway_container *con,
1108 enum sway_fullscreen_mode mode) { 1108 enum sway_fullscreen_mode mode) {
1109 if (con->fullscreen_mode == mode) { 1109 if (con->pending.fullscreen_mode == mode) {
1110 return; 1110 return;
1111 } 1111 }
1112 1112
@@ -1118,8 +1118,8 @@ void container_set_fullscreen(struct sway_container *con,
1118 if (root->fullscreen_global) { 1118 if (root->fullscreen_global) {
1119 container_fullscreen_disable(root->fullscreen_global); 1119 container_fullscreen_disable(root->fullscreen_global);
1120 } 1120 }
1121 if (con->workspace && con->workspace->fullscreen) { 1121 if (con->pending.workspace && con->pending.workspace->fullscreen) {
1122 container_fullscreen_disable(con->workspace->fullscreen); 1122 container_fullscreen_disable(con->pending.workspace->fullscreen);
1123 } 1123 }
1124 container_fullscreen_workspace(con); 1124 container_fullscreen_workspace(con);
1125 break; 1125 break;
@@ -1127,7 +1127,7 @@ void container_set_fullscreen(struct sway_container *con,
1127 if (root->fullscreen_global) { 1127 if (root->fullscreen_global) {
1128 container_fullscreen_disable(root->fullscreen_global); 1128 container_fullscreen_disable(root->fullscreen_global);
1129 } 1129 }
1130 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) { 1130 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
1131 container_fullscreen_disable(con); 1131 container_fullscreen_disable(con);
1132 } 1132 }
1133 container_fullscreen_global(con); 1133 container_fullscreen_global(con);
@@ -1137,8 +1137,8 @@ void container_set_fullscreen(struct sway_container *con,
1137 1137
1138struct sway_container *container_toplevel_ancestor( 1138struct sway_container *container_toplevel_ancestor(
1139 struct sway_container *container) { 1139 struct sway_container *container) {
1140 while (container->parent) { 1140 while (container->pending.parent) {
1141 container = container->parent; 1141 container = container->pending.parent;
1142 } 1142 }
1143 1143
1144 return container; 1144 return container;
@@ -1150,10 +1150,10 @@ bool container_is_floating_or_child(struct sway_container *container) {
1150 1150
1151bool container_is_fullscreen_or_child(struct sway_container *container) { 1151bool container_is_fullscreen_or_child(struct sway_container *container) {
1152 do { 1152 do {
1153 if (container->fullscreen_mode) { 1153 if (container->pending.fullscreen_mode) {
1154 return true; 1154 return true;
1155 } 1155 }
1156 container = container->parent; 1156 container = container->pending.parent;
1157 } while (container); 1157 } while (container);
1158 1158
1159 return false; 1159 return false;
@@ -1226,11 +1226,11 @@ void container_discover_outputs(struct sway_container *con) {
1226} 1226}
1227 1227
1228enum sway_container_layout container_parent_layout(struct sway_container *con) { 1228enum sway_container_layout container_parent_layout(struct sway_container *con) {
1229 if (con->parent) { 1229 if (con->pending.parent) {
1230 return con->parent->layout; 1230 return con->pending.parent->pending.layout;
1231 } 1231 }
1232 if (con->workspace) { 1232 if (con->pending.workspace) {
1233 return con->workspace->layout; 1233 return con->pending.workspace->layout;
1234 } 1234 }
1235 return L_NONE; 1235 return L_NONE;
1236} 1236}
@@ -1244,16 +1244,16 @@ enum sway_container_layout container_current_parent_layout(
1244} 1244}
1245 1245
1246list_t *container_get_siblings(struct sway_container *container) { 1246list_t *container_get_siblings(struct sway_container *container) {
1247 if (container->parent) { 1247 if (container->pending.parent) {
1248 return container->parent->children; 1248 return container->pending.parent->pending.children;
1249 } 1249 }
1250 if (container_is_scratchpad_hidden(container)) { 1250 if (container_is_scratchpad_hidden(container)) {
1251 return NULL; 1251 return NULL;
1252 } 1252 }
1253 if (list_find(container->workspace->tiling, container) != -1) { 1253 if (list_find(container->pending.workspace->tiling, container) != -1) {
1254 return container->workspace->tiling; 1254 return container->pending.workspace->tiling;
1255 } 1255 }
1256 return container->workspace->floating; 1256 return container->pending.workspace->floating;
1257} 1257}
1258 1258
1259int container_sibling_index(struct sway_container *child) { 1259int container_sibling_index(struct sway_container *child) {
@@ -1268,30 +1268,30 @@ list_t *container_get_current_siblings(struct sway_container *container) {
1268} 1268}
1269 1269
1270void container_handle_fullscreen_reparent(struct sway_container *con) { 1270void container_handle_fullscreen_reparent(struct sway_container *con) {
1271 if (con->fullscreen_mode != FULLSCREEN_WORKSPACE || !con->workspace || 1271 if (con->pending.fullscreen_mode != FULLSCREEN_WORKSPACE || !con->pending.workspace ||
1272 con->workspace->fullscreen == con) { 1272 con->pending.workspace->fullscreen == con) {
1273 return; 1273 return;
1274 } 1274 }
1275 if (con->workspace->fullscreen) { 1275 if (con->pending.workspace->fullscreen) {
1276 container_fullscreen_disable(con->workspace->fullscreen); 1276 container_fullscreen_disable(con->pending.workspace->fullscreen);
1277 } 1277 }
1278 con->workspace->fullscreen = con; 1278 con->pending.workspace->fullscreen = con;
1279 1279
1280 arrange_workspace(con->workspace); 1280 arrange_workspace(con->pending.workspace);
1281} 1281}
1282 1282
1283static void set_workspace(struct sway_container *container, void *data) { 1283static void set_workspace(struct sway_container *container, void *data) {
1284 container->workspace = container->parent->workspace; 1284 container->pending.workspace = container->pending.parent->pending.workspace;
1285} 1285}
1286 1286
1287void container_insert_child(struct sway_container *parent, 1287void container_insert_child(struct sway_container *parent,
1288 struct sway_container *child, int i) { 1288 struct sway_container *child, int i) {
1289 if (child->workspace) { 1289 if (child->pending.workspace) {
1290 container_detach(child); 1290 container_detach(child);
1291 } 1291 }
1292 list_insert(parent->children, i, child); 1292 list_insert(parent->pending.children, i, child);
1293 child->parent = parent; 1293 child->pending.parent = parent;
1294 child->workspace = parent->workspace; 1294 child->pending.workspace = parent->pending.workspace;
1295 container_for_each_child(child, set_workspace, NULL); 1295 container_for_each_child(child, set_workspace, NULL);
1296 container_handle_fullscreen_reparent(child); 1296 container_handle_fullscreen_reparent(child);
1297 container_update_representation(parent); 1297 container_update_representation(parent);
@@ -1299,14 +1299,14 @@ void container_insert_child(struct sway_container *parent,
1299 1299
1300void container_add_sibling(struct sway_container *fixed, 1300void container_add_sibling(struct sway_container *fixed,
1301 struct sway_container *active, bool after) { 1301 struct sway_container *active, bool after) {
1302 if (active->workspace) { 1302 if (active->pending.workspace) {
1303 container_detach(active); 1303 container_detach(active);
1304 } 1304 }
1305 list_t *siblings = container_get_siblings(fixed); 1305 list_t *siblings = container_get_siblings(fixed);
1306 int index = list_find(siblings, fixed); 1306 int index = list_find(siblings, fixed);
1307 list_insert(siblings, index + after, active); 1307 list_insert(siblings, index + after, active);
1308 active->parent = fixed->parent; 1308 active->pending.parent = fixed->pending.parent;
1309 active->workspace = fixed->workspace; 1309 active->pending.workspace = fixed->pending.workspace;
1310 container_for_each_child(active, set_workspace, NULL); 1310 container_for_each_child(active, set_workspace, NULL);
1311 container_handle_fullscreen_reparent(active); 1311 container_handle_fullscreen_reparent(active);
1312 container_update_representation(active); 1312 container_update_representation(active);
@@ -1314,15 +1314,15 @@ void container_add_sibling(struct sway_container *fixed,
1314 1314
1315void container_add_child(struct sway_container *parent, 1315void container_add_child(struct sway_container *parent,
1316 struct sway_container *child) { 1316 struct sway_container *child) {
1317 if (child->workspace) { 1317 if (child->pending.workspace) {
1318 container_detach(child); 1318 container_detach(child);
1319 } 1319 }
1320 list_add(parent->children, child); 1320 list_add(parent->pending.children, child);
1321 child->parent = parent; 1321 child->pending.parent = parent;
1322 child->workspace = parent->workspace; 1322 child->pending.workspace = parent->pending.workspace;
1323 container_for_each_child(child, set_workspace, NULL); 1323 container_for_each_child(child, set_workspace, NULL);
1324 bool fullscreen = child->fullscreen_mode != FULLSCREEN_NONE || 1324 bool fullscreen = child->pending.fullscreen_mode != FULLSCREEN_NONE ||
1325 parent->fullscreen_mode != FULLSCREEN_NONE; 1325 parent->pending.fullscreen_mode != FULLSCREEN_NONE;
1326 set_fullscreen_iterator(child, &fullscreen); 1326 set_fullscreen_iterator(child, &fullscreen);
1327 container_for_each_child(child, set_fullscreen_iterator, &fullscreen); 1327 container_for_each_child(child, set_fullscreen_iterator, &fullscreen);
1328 container_handle_fullscreen_reparent(child); 1328 container_handle_fullscreen_reparent(child);
@@ -1332,15 +1332,15 @@ void container_add_child(struct sway_container *parent,
1332} 1332}
1333 1333
1334void container_detach(struct sway_container *child) { 1334void container_detach(struct sway_container *child) {
1335 if (child->fullscreen_mode == FULLSCREEN_WORKSPACE) { 1335 if (child->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
1336 child->workspace->fullscreen = NULL; 1336 child->pending.workspace->fullscreen = NULL;
1337 } 1337 }
1338 if (child->fullscreen_mode == FULLSCREEN_GLOBAL) { 1338 if (child->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
1339 root->fullscreen_global = NULL; 1339 root->fullscreen_global = NULL;
1340 } 1340 }
1341 1341
1342 struct sway_container *old_parent = child->parent; 1342 struct sway_container *old_parent = child->pending.parent;
1343 struct sway_workspace *old_workspace = child->workspace; 1343 struct sway_workspace *old_workspace = child->pending.workspace;
1344 list_t *siblings = container_get_siblings(child); 1344 list_t *siblings = container_get_siblings(child);
1345 if (siblings) { 1345 if (siblings) {
1346 int index = list_find(siblings, child); 1346 int index = list_find(siblings, child);
@@ -1348,8 +1348,8 @@ void container_detach(struct sway_container *child) {
1348 list_del(siblings, index); 1348 list_del(siblings, index);
1349 } 1349 }
1350 } 1350 }
1351 child->parent = NULL; 1351 child->pending.parent = NULL;
1352 child->workspace = NULL; 1352 child->pending.workspace = NULL;
1353 container_for_each_child(child, set_workspace, NULL); 1353 container_for_each_child(child, set_workspace, NULL);
1354 1354
1355 if (old_parent) { 1355 if (old_parent) {
@@ -1364,18 +1364,18 @@ void container_detach(struct sway_container *child) {
1364 1364
1365void container_replace(struct sway_container *container, 1365void container_replace(struct sway_container *container,
1366 struct sway_container *replacement) { 1366 struct sway_container *replacement) {
1367 enum sway_fullscreen_mode fullscreen = container->fullscreen_mode; 1367 enum sway_fullscreen_mode fullscreen = container->pending.fullscreen_mode;
1368 bool scratchpad = container->scratchpad; 1368 bool scratchpad = container->scratchpad;
1369 struct sway_workspace *ws = NULL; 1369 struct sway_workspace *ws = NULL;
1370 if (fullscreen != FULLSCREEN_NONE) { 1370 if (fullscreen != FULLSCREEN_NONE) {
1371 container_fullscreen_disable(container); 1371 container_fullscreen_disable(container);
1372 } 1372 }
1373 if (scratchpad) { 1373 if (scratchpad) {
1374 ws = container->workspace; 1374 ws = container->pending.workspace;
1375 root_scratchpad_show(container); 1375 root_scratchpad_show(container);
1376 root_scratchpad_remove_container(container); 1376 root_scratchpad_remove_container(container);
1377 } 1377 }
1378 if (container->parent || container->workspace) { 1378 if (container->pending.parent || container->pending.workspace) {
1379 float width_fraction = container->width_fraction; 1379 float width_fraction = container->width_fraction;
1380 float height_fraction = container->height_fraction; 1380 float height_fraction = container->height_fraction;
1381 container_add_sibling(container, replacement, 1); 1381 container_add_sibling(container, replacement, 1);
@@ -1403,7 +1403,7 @@ struct sway_container *container_split(struct sway_container *child,
1403 enum sway_container_layout layout) { 1403 enum sway_container_layout layout) {
1404 // i3 doesn't split singleton H/V containers 1404 // i3 doesn't split singleton H/V containers
1405 // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/tree.c#L354 1405 // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/tree.c#L354
1406 if (child->parent || child->workspace) { 1406 if (child->pending.parent || child->pending.workspace) {
1407 list_t *siblings = container_get_siblings(child); 1407 list_t *siblings = container_get_siblings(child);
1408 if (siblings->length == 1) { 1408 if (siblings->length == 1) {
1409 enum sway_container_layout current = container_parent_layout(child); 1409 enum sway_container_layout current = container_parent_layout(child);
@@ -1411,12 +1411,12 @@ struct sway_container *container_split(struct sway_container *child,
1411 current = L_NONE; 1411 current = L_NONE;
1412 } 1412 }
1413 if (current == L_HORIZ || current == L_VERT) { 1413 if (current == L_HORIZ || current == L_VERT) {
1414 if (child->parent) { 1414 if (child->pending.parent) {
1415 child->parent->layout = layout; 1415 child->pending.parent->pending.layout = layout;
1416 container_update_representation(child->parent); 1416 container_update_representation(child->pending.parent);
1417 } else { 1417 } else {
1418 child->workspace->layout = layout; 1418 child->pending.workspace->layout = layout;
1419 workspace_update_representation(child->workspace); 1419 workspace_update_representation(child->pending.workspace);
1420 } 1420 }
1421 return child; 1421 return child;
1422 } 1422 }
@@ -1429,25 +1429,25 @@ struct sway_container *container_split(struct sway_container *child,
1429 if (container_is_floating(child) && child->view) { 1429 if (container_is_floating(child) && child->view) {
1430 view_set_tiled(child->view, true); 1430 view_set_tiled(child->view, true);
1431 if (child->view->using_csd) { 1431 if (child->view->using_csd) {
1432 child->border = child->saved_border; 1432 child->pending.border = child->saved_border;
1433 } 1433 }
1434 } 1434 }
1435 1435
1436 struct sway_container *cont = container_create(NULL); 1436 struct sway_container *cont = container_create(NULL);
1437 cont->width = child->width; 1437 cont->pending.width = child->pending.width;
1438 cont->height = child->height; 1438 cont->pending.height = child->pending.height;
1439 cont->width_fraction = child->width_fraction; 1439 cont->width_fraction = child->width_fraction;
1440 cont->height_fraction = child->height_fraction; 1440 cont->height_fraction = child->height_fraction;
1441 cont->x = child->x; 1441 cont->pending.x = child->pending.x;
1442 cont->y = child->y; 1442 cont->pending.y = child->pending.y;
1443 cont->layout = layout; 1443 cont->pending.layout = layout;
1444 1444
1445 container_replace(child, cont); 1445 container_replace(child, cont);
1446 container_add_child(cont, child); 1446 container_add_child(cont, child);
1447 1447
1448 if (set_focus) { 1448 if (set_focus) {
1449 seat_set_raw_focus(seat, &cont->node); 1449 seat_set_raw_focus(seat, &cont->node);
1450 if (cont->fullscreen_mode == FULLSCREEN_GLOBAL) { 1450 if (cont->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
1451 seat_set_focus(seat, &child->node); 1451 seat_set_focus(seat, &child->node);
1452 } else { 1452 } else {
1453 seat_set_raw_focus(seat, &child->node); 1453 seat_set_raw_focus(seat, &child->node);
@@ -1608,19 +1608,19 @@ void container_update_marks_textures(struct sway_container *con) {
1608void container_raise_floating(struct sway_container *con) { 1608void container_raise_floating(struct sway_container *con) {
1609 // Bring container to front by putting it at the end of the floating list. 1609 // Bring container to front by putting it at the end of the floating list.
1610 struct sway_container *floater = container_toplevel_ancestor(con); 1610 struct sway_container *floater = container_toplevel_ancestor(con);
1611 if (container_is_floating(floater) && floater->workspace) { 1611 if (container_is_floating(floater) && floater->pending.workspace) {
1612 list_move_to_end(floater->workspace->floating, floater); 1612 list_move_to_end(floater->pending.workspace->floating, floater);
1613 node_set_dirty(&floater->workspace->node); 1613 node_set_dirty(&floater->pending.workspace->node);
1614 } 1614 }
1615} 1615}
1616 1616
1617bool container_is_scratchpad_hidden(struct sway_container *con) { 1617bool container_is_scratchpad_hidden(struct sway_container *con) {
1618 return con->scratchpad && !con->workspace; 1618 return con->scratchpad && !con->pending.workspace;
1619} 1619}
1620 1620
1621bool container_is_scratchpad_hidden_or_child(struct sway_container *con) { 1621bool container_is_scratchpad_hidden_or_child(struct sway_container *con) {
1622 con = container_toplevel_ancestor(con); 1622 con = container_toplevel_ancestor(con);
1623 return con->scratchpad && !con->workspace; 1623 return con->scratchpad && !con->pending.workspace;
1624} 1624}
1625 1625
1626bool container_is_sticky(struct sway_container *con) { 1626bool container_is_sticky(struct sway_container *con) {
@@ -1648,39 +1648,39 @@ static bool is_parallel(enum sway_container_layout first,
1648static bool container_is_squashable(struct sway_container *con, 1648static bool container_is_squashable(struct sway_container *con,
1649 struct sway_container *child) { 1649 struct sway_container *child) {
1650 enum sway_container_layout gp_layout = container_parent_layout(con); 1650 enum sway_container_layout gp_layout = container_parent_layout(con);
1651 return (con->layout == L_HORIZ || con->layout == L_VERT) && 1651 return (con->pending.layout == L_HORIZ || con->pending.layout == L_VERT) &&
1652 (child->layout == L_HORIZ || child->layout == L_VERT) && 1652 (child->pending.layout == L_HORIZ || child->pending.layout == L_VERT) &&
1653 !is_parallel(con->layout, child->layout) && 1653 !is_parallel(con->pending.layout, child->pending.layout) &&
1654 is_parallel(gp_layout, child->layout); 1654 is_parallel(gp_layout, child->pending.layout);
1655} 1655}
1656 1656
1657static void container_squash_children(struct sway_container *con) { 1657static void container_squash_children(struct sway_container *con) {
1658 for (int i = 0; i < con->children->length; i++) { 1658 for (int i = 0; i < con->pending.children->length; i++) {
1659 struct sway_container *child = con->children->items[i]; 1659 struct sway_container *child = con->pending.children->items[i];
1660 i += container_squash(child); 1660 i += container_squash(child);
1661 } 1661 }
1662} 1662}
1663 1663
1664int container_squash(struct sway_container *con) { 1664int container_squash(struct sway_container *con) {
1665 if (!con->children) { 1665 if (!con->pending.children) {
1666 return 0; 1666 return 0;
1667 } 1667 }
1668 if (con->children->length != 1) { 1668 if (con->pending.children->length != 1) {
1669 container_squash_children(con); 1669 container_squash_children(con);
1670 return 0; 1670 return 0;
1671 } 1671 }
1672 struct sway_container *child = con->children->items[0]; 1672 struct sway_container *child = con->pending.children->items[0];
1673 int idx = container_sibling_index(con); 1673 int idx = container_sibling_index(con);
1674 int change = 0; 1674 int change = 0;
1675 if (container_is_squashable(con, child)) { 1675 if (container_is_squashable(con, child)) {
1676 // con and child are a redundant H/V pair. Destroy them. 1676 // con and child are a redundant H/V pair. Destroy them.
1677 while (child->children->length) { 1677 while (child->pending.children->length) {
1678 struct sway_container *current = child->children->items[0]; 1678 struct sway_container *current = child->pending.children->items[0];
1679 container_detach(current); 1679 container_detach(current);
1680 if (con->parent) { 1680 if (con->pending.parent) {
1681 container_insert_child(con->parent, current, idx); 1681 container_insert_child(con->pending.parent, current, idx);
1682 } else { 1682 } else {
1683 workspace_insert_tiling_direct(con->workspace, current, idx); 1683 workspace_insert_tiling_direct(con->pending.workspace, current, idx);
1684 } 1684 }
1685 change++; 1685 change++;
1686 } 1686 }