aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sway/desktop/transaction.h7
-rw-r--r--sway/desktop/transaction.c42
-rw-r--r--sway/desktop/xdg_shell.c5
-rw-r--r--sway/desktop/xdg_shell_v6.c5
-rw-r--r--sway/desktop/xwayland.c5
-rw-r--r--sway/tree/arrange.c9
-rw-r--r--sway/tree/view.c6
7 files changed, 24 insertions, 55 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h
index b1da86f1..fcfed297 100644
--- a/include/sway/desktop/transaction.h
+++ b/include/sway/desktop/transaction.h
@@ -31,13 +31,6 @@ void transaction_add_container(struct sway_transaction *transaction,
struct sway_container *container);
/**
- * Add a box to be damaged when the transaction is applied.
- * The box should be in layout coordinates.
- */
-void transaction_add_damage(struct sway_transaction *transaction,
- struct wlr_box *box);
-
-/**
* Submit a transaction to the client views for configuration.
*/
void transaction_commit(struct sway_transaction *transaction);
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 98cde889..c29b6661 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -30,7 +30,6 @@
struct sway_transaction {
struct wl_event_source *timer;
list_t *instructions; // struct sway_transaction_instruction *
- list_t *damage; // struct wlr_box *
size_t num_waiting;
size_t num_configures;
struct sway_transaction *next;
@@ -51,7 +50,6 @@ struct sway_transaction *transaction_create() {
struct sway_transaction *transaction =
calloc(1, sizeof(struct sway_transaction));
transaction->instructions = create_list();
- transaction->damage = create_list();
if (server.debug_txn_timings) {
clock_gettime(CLOCK_MONOTONIC, &transaction->create_time);
}
@@ -97,10 +95,6 @@ static void transaction_destroy(struct sway_transaction *transaction) {
}
list_free(transaction->instructions);
- // Free damage
- list_foreach(transaction->damage, free);
- list_free(transaction->damage);
-
if (transaction->timer) {
wl_event_source_remove(transaction->timer);
}
@@ -174,13 +168,6 @@ void transaction_add_container(struct sway_transaction *transaction,
list_add(transaction->instructions, instruction);
}
-void transaction_add_damage(struct sway_transaction *transaction,
- struct wlr_box *_box) {
- struct wlr_box *box = calloc(1, sizeof(struct wlr_box));
- memcpy(box, _box, sizeof(struct wlr_box));
- list_add(transaction->damage, box);
-}
-
/**
* Apply a transaction to the "current" state of the tree.
*/
@@ -200,12 +187,32 @@ static void transaction_apply(struct sway_transaction *transaction) {
"%.1fms total (%.1f frames if 60Hz)", transaction,
ms_arranging, ms_waiting, ms_total, ms_total / (1000 / 60));
}
+
// Apply the instruction state to the container's current state
for (int i = 0; i < transaction->instructions->length; ++i) {
struct sway_transaction_instruction *instruction =
transaction->instructions->items[i];
struct sway_container *container = instruction->container;
+ // Damage the old and new locations
+ struct wlr_box old_box = {
+ .x = container->current.swayc_x,
+ .y = container->current.swayc_y,
+ .width = container->current.swayc_width,
+ .height = container->current.swayc_height,
+ };
+ struct wlr_box new_box = {
+ .x = instruction->state.swayc_x,
+ .y = instruction->state.swayc_y,
+ .width = instruction->state.swayc_width,
+ .height = instruction->state.swayc_height,
+ };
+ for (int j = 0; j < root_container.children->length; ++j) {
+ struct sway_container *output = root_container.children->items[j];
+ output_damage_box(output->sway_output, &old_box);
+ output_damage_box(output->sway_output, &new_box);
+ }
+
// There are separate children lists for each instruction state, the
// container's current state and the container's pending state
// (ie. con->children). The list itself needs to be freed here.
@@ -216,15 +223,6 @@ static void transaction_apply(struct sway_transaction *transaction) {
memcpy(&container->current, &instruction->state,
sizeof(struct sway_container_state));
}
-
- // Apply damage
- for (int i = 0; i < transaction->damage->length; ++i) {
- struct wlr_box *box = transaction->damage->items[i];
- for (int j = 0; j < root_container.children->length; ++j) {
- struct sway_container *output = root_container.children->items[j];
- output_damage_box(output->sway_output, box);
- }
- }
}
static void transaction_progress_queue() {
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 484afd0c..b6fa9525 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -272,10 +272,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
view_set_fullscreen(view, e->fullscreen);
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
- struct sway_transaction *transaction = transaction_create();
- arrange_windows(ws, transaction);
- transaction_add_damage(transaction, container_get_box(ws->parent));
- transaction_commit(transaction);
+ arrange_and_commit(ws);
}
void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index da2eda7a..6042a806 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -267,10 +267,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
view_set_fullscreen(view, e->fullscreen);
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
- struct sway_transaction *transaction = transaction_create();
- arrange_windows(ws, transaction);
- transaction_add_damage(transaction, container_get_box(ws->parent));
- transaction_commit(transaction);
+ arrange_and_commit(ws);
}
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 720ea2fd..1d5dab70 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -342,10 +342,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
view_set_fullscreen(view, xsurface->fullscreen);
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
- struct sway_transaction *transaction = transaction_create();
- arrange_windows(ws, transaction);
- transaction_add_damage(transaction, container_get_box(ws->parent));
- transaction_commit(transaction);
+ arrange_and_commit(ws);
}
static void handle_set_title(struct wl_listener *listener, void *data) {
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index cb3f8ba2..582b2891 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -304,15 +304,6 @@ void arrange_windows(struct sway_container *container,
case C_TYPES:
break;
}
- // Add damage for whatever container arrange_windows() was called with,
- // unless it was called with the special floating container, in which case
- // we'll damage the entire output.
- if (container->type == C_CONTAINER && container->layout == L_FLOATING) {
- struct sway_container *output = container_parent(container, C_OUTPUT);
- transaction_add_damage(transaction, container_get_box(output));
- } else {
- transaction_add_damage(transaction, container_get_box(container));
- }
add_deleted_containers(transaction);
}
diff --git a/sway/tree/view.c b/sway/tree/view.c
index a616af03..68d2a029 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -550,11 +550,7 @@ void view_unmap(struct sway_view *view) {
ws->sway_workspace->fullscreen = NULL;
container_destroy(view->swayc);
- struct sway_container *output = ws->parent;
- struct sway_transaction *transaction = transaction_create();
- arrange_windows(output, transaction);
- transaction_add_damage(transaction, container_get_box(output));
- transaction_commit(transaction);
+ arrange_and_commit(ws->parent);
} else {
struct sway_container *parent = container_destroy(view->swayc);
arrange_and_commit(parent);