mirror of
https://github.com/swaywm/sway.git
synced 2025-11-25 06:59:48 -05:00
Implement atomic layout updates for xwayland views
This commit is contained in:
parent
b6a238c7b7
commit
1549fb719a
3 changed files with 40 additions and 27 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue