diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-10-18 16:26:01 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-10-18 22:37:42 +0200 |
commit | 8355884fbd4ea04203614172424b27c5b74018ab (patch) | |
tree | c7decf05e32202d1230924a7ddb5af6dd903016c /sway/desktop/transaction.c | |
parent | transaction: don't reconfigure X views unless integral coords changed (diff) | |
download | sway-8355884fbd4ea04203614172424b27c5b74018ab.tar.gz sway-8355884fbd4ea04203614172424b27c5b74018ab.tar.zst sway-8355884fbd4ea04203614172424b27c5b74018ab.zip |
transaction: validate X transaction completions by geometry, not size
Xwayland views are aware of their coordinates, so validating transaction
completions should take into account the reported coordinates of the
view. Prior to this commit they didn't, and matching dimensions would
suffice to validate the transaction.
Also introduced `transaction_notify_view_ready_immediately` to support
the fix from d0f7e0f without jumping through hoops to figure out the
geometry of an `xdg_shell` view.
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r-- | sway/desktop/transaction.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 0d0e0635..e186bf89 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -510,17 +510,27 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view, | |||
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | void transaction_notify_view_ready_by_size(struct sway_view *view, | 513 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, |
514 | int width, int height) { | 514 | double x, double y, int width, int height) { |
515 | struct sway_transaction_instruction *instruction = | 515 | struct sway_transaction_instruction *instruction = |
516 | view->container->node.instruction; | 516 | view->container->node.instruction; |
517 | if (instruction != NULL && | 517 | if (instruction != NULL && |
518 | (int)instruction->container_state.content_x == (int)x && | ||
519 | (int)instruction->container_state.content_y == (int)y && | ||
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); |
521 | } | 523 | } |
522 | } | 524 | } |
523 | 525 | ||
526 | void transaction_notify_view_ready_immediately(struct sway_view *view) { | ||
527 | struct sway_transaction_instruction *instruction = | ||
528 | view->container->node.instruction; | ||
529 | if (instruction != NULL) { | ||
530 | set_instruction_ready(instruction); | ||
531 | } | ||
532 | } | ||
533 | |||
524 | void transaction_commit_dirty(void) { | 534 | void transaction_commit_dirty(void) { |
525 | if (!server.dirty_nodes->length) { | 535 | if (!server.dirty_nodes->length) { |
526 | return; | 536 | return; |