summaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index e89f01d8..c300558a 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -6,6 +6,7 @@
6#include <time.h> 6#include <time.h>
7#include <wlr/types/wlr_buffer.h> 7#include <wlr/types/wlr_buffer.h>
8#include "sway/debug.h" 8#include "sway/debug.h"
9#include "sway/desktop.h"
9#include "sway/desktop/idle_inhibit_v1.h" 10#include "sway/desktop/idle_inhibit_v1.h"
10#include "sway/desktop/transaction.h" 11#include "sway/desktop/transaction.h"
11#include "sway/output.h" 12#include "sway/output.h"
@@ -169,25 +170,17 @@ static void transaction_apply(struct sway_transaction *transaction) {
169 transaction->instructions->items[i]; 170 transaction->instructions->items[i];
170 struct sway_container *container = instruction->container; 171 struct sway_container *container = instruction->container;
171 172
172 // Damage the old and new locations 173 // Damage the old location
173 struct wlr_box old_box = { 174 desktop_damage_whole_container(container);
174 .x = container->current.swayc_x, 175 if (container->type == C_VIEW && container->sway_view->saved_buffer) {
175 .y = container->current.swayc_y, 176 struct sway_view *view = container->sway_view;
176 .width = container->current.swayc_width, 177 struct wlr_box box = {
177 .height = container->current.swayc_height, 178 .x = container->current.view_x - view->saved_geometry.x,
178 }; 179 .y = container->current.view_y - view->saved_geometry.y,
179 struct wlr_box new_box = { 180 .width = view->saved_buffer_width,
180 .x = instruction->state.swayc_x, 181 .height = view->saved_buffer_height,
181 .y = instruction->state.swayc_y, 182 };
182 .width = instruction->state.swayc_width, 183 desktop_damage_box(&box);
183 .height = instruction->state.swayc_height,
184 };
185 for (int j = 0; j < root_container.current.children->length; ++j) {
186 struct sway_container *output = root_container.current.children->items[j];
187 if (output->sway_output) {
188 output_damage_box(output->sway_output, &old_box);
189 output_damage_box(output->sway_output, &new_box);
190 }
191 } 184 }
192 185
193 // There are separate children lists for each instruction state, the 186 // There are separate children lists for each instruction state, the
@@ -204,6 +197,20 @@ static void transaction_apply(struct sway_transaction *transaction) {
204 view_remove_saved_buffer(container->sway_view); 197 view_remove_saved_buffer(container->sway_view);
205 } 198 }
206 199
200 // Damage the new location
201 desktop_damage_whole_container(container);
202 if (container->type == C_VIEW && container->sway_view->surface) {
203 struct sway_view *view = container->sway_view;
204 struct wlr_surface *surface = view->surface;
205 struct wlr_box box = {
206 .x = container->current.view_x - view->geometry.x,
207 .y = container->current.view_y - view->geometry.y,
208 .width = surface->current.width,
209 .height = surface->current.height,
210 };
211 desktop_damage_box(&box);
212 }
213
207 container->instruction = NULL; 214 container->instruction = NULL;
208 } 215 }
209} 216}
@@ -297,6 +304,8 @@ static void transaction_commit(struct sway_transaction *transaction) {
297 } 304 }
298 if (con->type == C_VIEW) { 305 if (con->type == C_VIEW) {
299 view_save_buffer(con->sway_view); 306 view_save_buffer(con->sway_view);
307 memcpy(&con->sway_view->saved_geometry, &con->sway_view->geometry,
308 sizeof(struct wlr_box));
300 } 309 }
301 con->instruction = instruction; 310 con->instruction = instruction;
302 } 311 }
@@ -355,7 +364,9 @@ static void set_instruction_ready(
355 } 364 }
356 365
357 instruction->container->instruction = NULL; 366 instruction->container->instruction = NULL;
358 transaction_progress_queue(); 367 if (!txn_debug) {
368 transaction_progress_queue();
369 }
359} 370}
360 371
361void transaction_notify_view_ready_by_serial(struct sway_view *view, 372void transaction_notify_view_ready_by_serial(struct sway_view *view,