aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-14 20:56:57 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-15 16:58:19 -0500
commit37d7bc69986f0c22eef629d5e0446f22800fa515 (patch)
tree7afe6b36cf64aa53c98f7dc739ead84c2892ece7
parenttext_input: Only send surrounding_text and content_type if supported (diff)
downloadsway-37d7bc69986f0c22eef629d5e0446f22800fa515.tar.gz
sway-37d7bc69986f0c22eef629d5e0446f22800fa515.tar.zst
sway-37d7bc69986f0c22eef629d5e0446f22800fa515.zip
transaction: Only wait for ack from visible views
Transactions currently wait for all configures to be acked, regardless fo what they were sent to. This includes views that are hidden in tabbed or stacked containers. If these views do not ack the configure in response to a single frame callback, they can cause transaction timeouts. Check if a container is hidden before registering the configure serial and saving any view buffers. Closes: https://github.com/swaywm/sway/issues/6023
-rw-r--r--sway/desktop/transaction.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index ead662f9..bea9d539 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -35,6 +35,7 @@ struct sway_transaction_instruction {
35 struct sway_container_state container_state; 35 struct sway_container_state container_state;
36 }; 36 };
37 uint32_t serial; 37 uint32_t serial;
38 bool waiting;
38}; 39};
39 40
40static struct sway_transaction *transaction_create(void) { 41static struct sway_transaction *transaction_create(void) {
@@ -420,13 +421,18 @@ static void transaction_commit(struct sway_transaction *transaction) {
420 struct sway_transaction_instruction *instruction = 421 struct sway_transaction_instruction *instruction =
421 transaction->instructions->items[i]; 422 transaction->instructions->items[i];
422 struct sway_node *node = instruction->node; 423 struct sway_node *node = instruction->node;
424 bool hidden = node_is_view(node) &&
425 !view_is_visible(node->sway_container->view);
423 if (should_configure(node, instruction)) { 426 if (should_configure(node, instruction)) {
424 instruction->serial = view_configure(node->sway_container->view, 427 instruction->serial = view_configure(node->sway_container->view,
425 instruction->container_state.content_x, 428 instruction->container_state.content_x,
426 instruction->container_state.content_y, 429 instruction->container_state.content_y,
427 instruction->container_state.content_width, 430 instruction->container_state.content_width,
428 instruction->container_state.content_height); 431 instruction->container_state.content_height);
429 ++transaction->num_waiting; 432 if (!hidden) {
433 instruction->waiting = true;
434 ++transaction->num_waiting;
435 }
430 436
431 // From here on we are rendering a saved buffer of the view, which 437 // From here on we are rendering a saved buffer of the view, which
432 // means we can send a frame done event to make the client redraw it 438 // means we can send a frame done event to make the client redraw it
@@ -437,7 +443,8 @@ static void transaction_commit(struct sway_transaction *transaction) {
437 wlr_surface_send_frame_done( 443 wlr_surface_send_frame_done(
438 node->sway_container->view->surface, &now); 444 node->sway_container->view->surface, &now);
439 } 445 }
440 if (node_is_view(node) && wl_list_empty(&node->sway_container->view->saved_buffers)) { 446 if (!hidden && node_is_view(node) &&
447 wl_list_empty(&node->sway_container->view->saved_buffers)) {
441 view_save_buffer(node->sway_container->view); 448 view_save_buffer(node->sway_container->view);
442 memcpy(&node->sway_container->view->saved_geometry, 449 memcpy(&node->sway_container->view->saved_geometry,
443 &node->sway_container->view->geometry, 450 &node->sway_container->view->geometry,
@@ -490,7 +497,8 @@ static void set_instruction_ready(
490 } 497 }
491 498
492 // If the transaction has timed out then its num_waiting will be 0 already. 499 // If the transaction has timed out then its num_waiting will be 0 already.
493 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { 500 if (instruction->waiting && transaction->num_waiting > 0 &&
501 --transaction->num_waiting == 0) {
494 sway_log(SWAY_DEBUG, "Transaction %p is ready", transaction); 502 sway_log(SWAY_DEBUG, "Transaction %p is ready", transaction);
495 wl_event_source_timer_update(transaction->timer, 0); 503 wl_event_source_timer_update(transaction->timer, 0);
496 } 504 }