aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <orzechowski.alexander@gmail.com>2022-03-04 20:38:04 -0500
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2024-01-18 18:36:54 +0300
commit08c484f46f130aa7e590ef4bcb39d2ceed7160f6 (patch)
tree99e5ce939c0defaa53ead587545cb13559a518b0
parentscene_graph: Port container server side decorations (diff)
downloadsway-08c484f46f130aa7e590ef4bcb39d2ceed7160f6.tar.gz
sway-08c484f46f130aa7e590ef4bcb39d2ceed7160f6.tar.zst
sway-08c484f46f130aa7e590ef4bcb39d2ceed7160f6.zip
transaction: ready signals will return success bools
-rw-r--r--include/sway/desktop/transaction.h11
-rw-r--r--sway/desktop/transaction.c8
2 files changed, 15 insertions, 4 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h
index 7dd58ba8..17d41fa3 100644
--- a/include/sway/desktop/transaction.h
+++ b/include/sway/desktop/transaction.h
@@ -1,6 +1,7 @@
1#ifndef _SWAY_TRANSACTION_H 1#ifndef _SWAY_TRANSACTION_H
2#define _SWAY_TRANSACTION_H 2#define _SWAY_TRANSACTION_H
3#include <stdint.h> 3#include <stdint.h>
4#include <stdbool.h>
4 5
5/** 6/**
6 * Transactions enable us to perform atomic layout updates. 7 * Transactions enable us to perform atomic layout updates.
@@ -38,8 +39,11 @@ void transaction_commit_dirty_client(void);
38 * Notify the transaction system that a view is ready for the new layout. 39 * Notify the transaction system that a view is ready for the new layout.
39 * 40 *
40 * When all views in the transaction are ready, the layout will be applied. 41 * When all views in the transaction are ready, the layout will be applied.
42 *
43 * A success boolean is returned denoting that this part of the transaction is
44 * ready.
41 */ 45 */
42void transaction_notify_view_ready_by_serial(struct sway_view *view, 46bool transaction_notify_view_ready_by_serial(struct sway_view *view,
43 uint32_t serial); 47 uint32_t serial);
44 48
45/** 49/**
@@ -47,8 +51,11 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
47 * identifying the instruction by geometry rather than by serial. 51 * identifying the instruction by geometry rather than by serial.
48 * 52 *
49 * This is used by xwayland views, as they don't have serials. 53 * This is used by xwayland views, as they don't have serials.
54 *
55 * A success boolean is returned denoting that this part of the transaction is
56 * ready.
50 */ 57 */
51void transaction_notify_view_ready_by_geometry(struct sway_view *view, 58bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
52 double x, double y, int width, int height); 59 double x, double y, int width, int height);
53 60
54#endif 61#endif
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 6947e138..bb725795 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -499,16 +499,18 @@ static void set_instruction_ready(
499 transaction_progress(); 499 transaction_progress();
500} 500}
501 501
502void transaction_notify_view_ready_by_serial(struct sway_view *view, 502bool transaction_notify_view_ready_by_serial(struct sway_view *view,
503 uint32_t serial) { 503 uint32_t serial) {
504 struct sway_transaction_instruction *instruction = 504 struct sway_transaction_instruction *instruction =
505 view->container->node.instruction; 505 view->container->node.instruction;
506 if (instruction != NULL && instruction->serial == serial) { 506 if (instruction != NULL && instruction->serial == serial) {
507 set_instruction_ready(instruction); 507 set_instruction_ready(instruction);
508 return true;
508 } 509 }
510 return false;
509} 511}
510 512
511void transaction_notify_view_ready_by_geometry(struct sway_view *view, 513bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
512 double x, double y, int width, int height) { 514 double x, double y, int width, int height) {
513 struct sway_transaction_instruction *instruction = 515 struct sway_transaction_instruction *instruction =
514 view->container->node.instruction; 516 view->container->node.instruction;
@@ -518,7 +520,9 @@ void transaction_notify_view_ready_by_geometry(struct sway_view *view,
518 instruction->container_state.content_width == width && 520 instruction->container_state.content_width == width &&
519 instruction->container_state.content_height == height) { 521 instruction->container_state.content_height == height) {
520 set_instruction_ready(instruction); 522 set_instruction_ready(instruction);
523 return true;
521 } 524 }
525 return false;
522} 526}
523 527
524static void _transaction_commit_dirty(bool server_request) { 528static void _transaction_commit_dirty(bool server_request) {