aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-10-25 16:12:46 +0200
committerGitHub <noreply@github.com>2018-10-25 16:12:46 +0200
commit2507a5e44719134b4bb417913217850ce694dd5f (patch)
tree821502ef188985ee023df3f24b9e4e468eb96aef /sway/desktop/transaction.c
parentea2497d35cc1a7357d69b8e09ce0104c82a7be39 (diff)
parent60a1d79de71660949f7a6fc83e242d9d95c75187 (diff)
Merge pull request #2974 from RyanDwyer/cursor-rebase-after-txn-apply
Rebase the cursor after applying transactions
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index b2f7f922..955b05d6 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -11,6 +11,8 @@
#include "sway/desktop.h"
#include "sway/desktop/idle_inhibit_v1.h"
#include "sway/desktop/transaction.h"
+#include "sway/input/cursor.h"
+#include "sway/input/input-manager.h"
#include "sway/output.h"
#include "sway/tree/container.h"
#include "sway/tree/node.h"
@@ -25,8 +27,6 @@ struct sway_transaction {
size_t num_waiting;
size_t num_configures;
struct timespec commit_time;
- void (*callback)(void *data);
- void *callback_data;
};
struct sway_transaction_instruction {
@@ -298,8 +298,11 @@ static void transaction_apply(struct sway_transaction *transaction) {
node->instruction = NULL;
}
- if (transaction->callback) {
- transaction->callback(transaction->callback_data);
+ if (root->outputs->length) {
+ struct sway_seat *seat;
+ wl_list_for_each(seat, &server.input->seats, link) {
+ cursor_rebase(seat->cursor);
+ }
}
}
@@ -505,7 +508,14 @@ void transaction_notify_view_ready_by_size(struct sway_view *view,
}
}
-static void do_commit_dirty(struct sway_transaction *transaction) {
+void transaction_commit_dirty(void) {
+ if (!server.dirty_nodes->length) {
+ return;
+ }
+ struct sway_transaction *transaction = transaction_create();
+ if (!transaction) {
+ return;
+ }
for (int i = 0; i < server.dirty_nodes->length; ++i) {
struct sway_node *node = server.dirty_nodes->items[i];
transaction_add_node(transaction, node);
@@ -524,28 +534,3 @@ static void do_commit_dirty(struct sway_transaction *transaction) {
transaction_progress_queue();
}
}
-
-void transaction_commit_dirty(void) {
- if (!server.dirty_nodes->length) {
- return;
- }
- struct sway_transaction *transaction = transaction_create();
- if (!transaction) {
- return;
- }
- do_commit_dirty(transaction);
-}
-
-void transaction_commit_dirty_with_callback(
- void (*callback)(void *data), void *data) {
- if (!server.dirty_nodes->length) {
- return;
- }
- struct sway_transaction *transaction = transaction_create();
- if (!transaction) {
- return;
- }
- transaction->callback = callback;
- transaction->callback_data = data;
- do_commit_dirty(transaction);
-}