aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-16 22:41:10 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-18 10:39:38 +1000
commit982a2d0c99f4128a7cf2236ca190dd9b4e6d7828 (patch)
tree3106f8f05af455924abfadb2893e0c3599b465c9 /sway/desktop/transaction.c
parentAdd view_get_geometry (diff)
downloadsway-982a2d0c99f4128a7cf2236ca190dd9b4e6d7828.tar.gz
sway-982a2d0c99f4128a7cf2236ca190dd9b4e6d7828.tar.zst
sway-982a2d0c99f4128a7cf2236ca190dd9b4e6d7828.zip
Fix geometry
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index e89f01d8..7383c455 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -170,23 +170,49 @@ static void transaction_apply(struct sway_transaction *transaction) {
170 struct sway_container *container = instruction->container; 170 struct sway_container *container = instruction->container;
171 171
172 // Damage the old and new locations 172 // Damage the old and new locations
173 struct wlr_box old_box = { 173 struct wlr_box old_con_box = {
174 .x = container->current.swayc_x, 174 .x = container->current.swayc_x,
175 .y = container->current.swayc_y, 175 .y = container->current.swayc_y,
176 .width = container->current.swayc_width, 176 .width = container->current.swayc_width,
177 .height = container->current.swayc_height, 177 .height = container->current.swayc_height,
178 }; 178 };
179 struct wlr_box new_box = { 179 struct wlr_box new_con_box = {
180 .x = instruction->state.swayc_x, 180 .x = instruction->state.swayc_x,
181 .y = instruction->state.swayc_y, 181 .y = instruction->state.swayc_y,
182 .width = instruction->state.swayc_width, 182 .width = instruction->state.swayc_width,
183 .height = instruction->state.swayc_height, 183 .height = instruction->state.swayc_height,
184 }; 184 };
185 // Handle geometry, which may overflow the bounds of the container
186 struct wlr_box old_surface_box = {0,0,0,0};
187 struct wlr_box new_surface_box = {0,0,0,0};
188 if (container->type == C_VIEW) {
189 struct sway_view *view = container->sway_view;
190 if (container->sway_view->saved_buffer) {
191 old_surface_box.x =
192 container->current.view_x - view->saved_geometry.x;
193 old_surface_box.y =
194 container->current.view_y - view->saved_geometry.y;
195 old_surface_box.width = view->saved_buffer_width;
196 old_surface_box.height = view->saved_buffer_height;
197 }
198 struct wlr_surface *surface = container->sway_view->surface;
199 if (surface) {
200 struct wlr_box geometry;
201 view_get_geometry(view, &geometry);
202 new_surface_box.x = instruction->state.view_x - geometry.x;
203 new_surface_box.y = instruction->state.view_y - geometry.y;
204 new_surface_box.width = surface->current.width;
205 new_surface_box.height = surface->current.height;
206 }
207 }
185 for (int j = 0; j < root_container.current.children->length; ++j) { 208 for (int j = 0; j < root_container.current.children->length; ++j) {
186 struct sway_container *output = root_container.current.children->items[j]; 209 struct sway_container *output =
210 root_container.current.children->items[j];
187 if (output->sway_output) { 211 if (output->sway_output) {
188 output_damage_box(output->sway_output, &old_box); 212 output_damage_box(output->sway_output, &old_con_box);
189 output_damage_box(output->sway_output, &new_box); 213 output_damage_box(output->sway_output, &new_con_box);
214 output_damage_box(output->sway_output, &old_surface_box);
215 output_damage_box(output->sway_output, &new_surface_box);
190 } 216 }
191 } 217 }
192 218
@@ -297,6 +323,7 @@ static void transaction_commit(struct sway_transaction *transaction) {
297 } 323 }
298 if (con->type == C_VIEW) { 324 if (con->type == C_VIEW) {
299 view_save_buffer(con->sway_view); 325 view_save_buffer(con->sway_view);
326 view_get_geometry(con->sway_view, &con->sway_view->saved_geometry);
300 } 327 }
301 con->instruction = instruction; 328 con->instruction = instruction;
302 } 329 }
@@ -355,7 +382,9 @@ static void set_instruction_ready(
355 } 382 }
356 383
357 instruction->container->instruction = NULL; 384 instruction->container->instruction = NULL;
358 transaction_progress_queue(); 385 if (!txn_debug) {
386 transaction_progress_queue();
387 }
359} 388}
360 389
361void transaction_notify_view_ready_by_serial(struct sway_view *view, 390void transaction_notify_view_ready_by_serial(struct sway_view *view,