mirror of
https://github.com/NickHu/sway
synced 2024-12-26 21:58:30 +01:00
transaction: ready signals will return success bools
This commit is contained in:
parent
6d7b1321db
commit
08c484f46f
2 changed files with 15 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
#ifndef _SWAY_TRANSACTION_H
|
#ifndef _SWAY_TRANSACTION_H
|
||||||
#define _SWAY_TRANSACTION_H
|
#define _SWAY_TRANSACTION_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transactions enable us to perform atomic layout updates.
|
* Transactions enable us to perform atomic layout updates.
|
||||||
|
@ -38,8 +39,11 @@ void transaction_commit_dirty_client(void);
|
||||||
* Notify the transaction system that a view is ready for the new layout.
|
* Notify the transaction system that a view is ready for the new layout.
|
||||||
*
|
*
|
||||||
* When all views in the transaction are ready, the layout will be applied.
|
* When all views in the transaction are ready, the layout will be applied.
|
||||||
|
*
|
||||||
|
* A success boolean is returned denoting that this part of the transaction is
|
||||||
|
* ready.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
bool transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
uint32_t serial);
|
uint32_t serial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,8 +51,11 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
* identifying the instruction by geometry rather than by serial.
|
* identifying the instruction by geometry rather than by serial.
|
||||||
*
|
*
|
||||||
* This is used by xwayland views, as they don't have serials.
|
* This is used by xwayland views, as they don't have serials.
|
||||||
|
*
|
||||||
|
* A success boolean is returned denoting that this part of the transaction is
|
||||||
|
* ready.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
double x, double y, int width, int height);
|
double x, double y, int width, int height);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -499,16 +499,18 @@ static void set_instruction_ready(
|
||||||
transaction_progress();
|
transaction_progress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
bool transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
uint32_t serial) {
|
uint32_t serial) {
|
||||||
struct sway_transaction_instruction *instruction =
|
struct sway_transaction_instruction *instruction =
|
||||||
view->container->node.instruction;
|
view->container->node.instruction;
|
||||||
if (instruction != NULL && instruction->serial == serial) {
|
if (instruction != NULL && instruction->serial == serial) {
|
||||||
set_instruction_ready(instruction);
|
set_instruction_ready(instruction);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
double x, double y, int width, int height) {
|
double x, double y, int width, int height) {
|
||||||
struct sway_transaction_instruction *instruction =
|
struct sway_transaction_instruction *instruction =
|
||||||
view->container->node.instruction;
|
view->container->node.instruction;
|
||||||
|
@ -518,7 +520,9 @@ void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
instruction->container_state.content_width == width &&
|
instruction->container_state.content_width == width &&
|
||||||
instruction->container_state.content_height == height) {
|
instruction->container_state.content_height == height) {
|
||||||
set_instruction_ready(instruction);
|
set_instruction_ready(instruction);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _transaction_commit_dirty(bool server_request) {
|
static void _transaction_commit_dirty(bool server_request) {
|
||||||
|
|
Loading…
Reference in a new issue