aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 04142bcc..08678b5b 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -267,9 +267,7 @@ void transaction_commit(struct sway_transaction *transaction) {
instruction->state.view_y,
instruction->state.view_width,
instruction->state.view_height);
- if (instruction->serial) {
- ++transaction->num_waiting;
- }
+ ++transaction->num_waiting;
}
list_add(con->instructions, instruction);
}
@@ -307,20 +305,8 @@ void transaction_commit(struct sway_transaction *transaction) {
update_debug_tree();
}
-void transaction_notify_view_ready(struct sway_view *view, uint32_t serial) {
- // Find the instruction
- struct sway_transaction_instruction *instruction = NULL;
- for (int i = 0; i < view->swayc->instructions->length; ++i) {
- struct sway_transaction_instruction *tmp_instruction =
- view->swayc->instructions->items[i];
- if (tmp_instruction->serial == serial && !tmp_instruction->ready) {
- instruction = tmp_instruction;
- break;
- }
- }
- if (!instruction) {
- return;
- }
+static void set_instruction_ready(
+ struct sway_transaction_instruction *instruction) {
instruction->ready = true;
// If all views are ready, apply the transaction.
@@ -335,6 +321,30 @@ void transaction_notify_view_ready(struct sway_view *view, uint32_t serial) {
}
}
+void transaction_notify_view_ready(struct sway_view *view, uint32_t serial) {
+ for (int i = 0; i < view->swayc->instructions->length; ++i) {
+ struct sway_transaction_instruction *instruction =
+ view->swayc->instructions->items[i];
+ if (instruction->serial == serial && !instruction->ready) {
+ set_instruction_ready(instruction);
+ return;
+ }
+ }
+}
+
+void transaction_notify_view_ready_by_size(struct sway_view *view,
+ int width, int height) {
+ for (int i = 0; i < view->swayc->instructions->length; ++i) {
+ struct sway_transaction_instruction *instruction =
+ view->swayc->instructions->items[i];
+ if (!instruction->ready && instruction->state.view_width == width &&
+ instruction->state.view_height == height) {
+ set_instruction_ready(instruction);
+ return;
+ }
+ }
+}
+
struct wlr_texture *transaction_get_texture(struct sway_view *view) {
if (!view->swayc || !view->swayc->instructions->length) {
return view->surface->buffer->texture;