aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-06 19:19:30 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-09 10:08:43 +1000
commitf9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb (patch)
tree8c8ffd879e368aff3d749a637aabfa784800db5c /sway/desktop/transaction.c
parentWIP: Atomic layout updates ground work (diff)
downloadsway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.tar.gz
sway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.tar.zst
sway-f9e6d703d298dbdee0770fd9e0c64ab2d7ac7deb.zip
Make main properties be the pending state
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 69f97e3d..313e707b 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -67,8 +67,30 @@ void transaction_add_container(struct sway_transaction *transaction,
67 calloc(1, sizeof(struct sway_transaction_instruction)); 67 calloc(1, sizeof(struct sway_transaction_instruction));
68 instruction->transaction = transaction; 68 instruction->transaction = transaction;
69 instruction->container = container; 69 instruction->container = container;
70 memcpy(&instruction->state, &container->pending, 70
71 sizeof(struct sway_container_state)); 71 // Copy the container's main (pending) properties into the instruction state
72 struct sway_container_state *state = &instruction->state;
73 state->layout = container->layout;
74 state->swayc_x = container->x;
75 state->swayc_y = container->y;
76 state->swayc_width = container->width;
77 state->swayc_height = container->height;
78
79 if (container->type == C_VIEW) {
80 struct sway_view *view = container->sway_view;
81 state->view_x = view->x;
82 state->view_y = view->y;
83 state->view_width = view->width;
84 state->view_height = view->height;
85 state->is_fullscreen = view->is_fullscreen;
86 state->border = view->border;
87 state->border_thickness = view->border_thickness;
88 state->border_top = view->border_top;
89 state->border_left = view->border_left;
90 state->border_right = view->border_right;
91 state->border_bottom = view->border_bottom;
92 }
93
72 list_add(transaction->instructions, instruction); 94 list_add(transaction->instructions, instruction);
73} 95}
74 96
@@ -102,30 +124,13 @@ static void transaction_apply(struct sway_transaction *transaction) {
102 for (i = 0; i < transaction->instructions->length; ++i) { 124 for (i = 0; i < transaction->instructions->length; ++i) {
103 struct sway_transaction_instruction *instruction = 125 struct sway_transaction_instruction *instruction =
104 transaction->instructions->items[i]; 126 transaction->instructions->items[i];
105 struct sway_container_state *state = &instruction->state;
106 struct sway_container *container = instruction->container; 127 struct sway_container *container = instruction->container;
107 128
108 container->layout = state->layout; 129 memcpy(&instruction->container->current, &instruction->state,
109 container->x = state->swayc_x; 130 sizeof(struct sway_container_state));
110 container->y = state->swayc_y;
111 container->width = state->swayc_width;
112 container->height = state->swayc_height;
113 131
114 if (container->type == C_VIEW) { 132 if (container->type == C_VIEW) {
115 struct sway_view *view = container->sway_view; 133 remove_saved_view_texture(container->sway_view);
116 view->x = state->view_x;
117 view->y = state->view_y;
118 view->width = state->view_width;
119 view->height = state->view_height;
120 view->is_fullscreen = state->is_fullscreen;
121 view->border = state->border;
122 view->border_thickness = state->border_thickness;
123 view->border_top = state->border_top;
124 view->border_left = state->border_left;
125 view->border_right = state->border_right;
126 view->border_bottom = state->border_bottom;
127
128 remove_saved_view_texture(view);
129 } 134 }
130 } 135 }
131 136