aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-20 13:51:12 -0500
committerLibravatar emersion <contact@emersion.fr>2019-01-21 12:59:42 +0100
commit1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 (patch)
tree5c3f60e0219cb8b4a1b7cafb760a871661866e32 /sway/desktop/transaction.c
parentLog libinput_config_status errors (diff)
downloadsway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.gz
sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.zst
sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.zip
Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 1cdd7c6d..55cf1c5e 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -260,14 +260,14 @@ static void apply_container_state(struct sway_container *container,
260 * Apply a transaction to the "current" state of the tree. 260 * Apply a transaction to the "current" state of the tree.
261 */ 261 */
262static void transaction_apply(struct sway_transaction *transaction) { 262static void transaction_apply(struct sway_transaction *transaction) {
263 wlr_log(WLR_DEBUG, "Applying transaction %p", transaction); 263 sway_log(SWAY_DEBUG, "Applying transaction %p", transaction);
264 if (debug.txn_timings) { 264 if (debug.txn_timings) {
265 struct timespec now; 265 struct timespec now;
266 clock_gettime(CLOCK_MONOTONIC, &now); 266 clock_gettime(CLOCK_MONOTONIC, &now);
267 struct timespec *commit = &transaction->commit_time; 267 struct timespec *commit = &transaction->commit_time;
268 float ms = (now.tv_sec - commit->tv_sec) * 1000 + 268 float ms = (now.tv_sec - commit->tv_sec) * 1000 +
269 (now.tv_nsec - commit->tv_nsec) / 1000000.0; 269 (now.tv_nsec - commit->tv_nsec) / 1000000.0;
270 wlr_log(WLR_DEBUG, "Transaction %p: %.1fms waiting " 270 sway_log(SWAY_DEBUG, "Transaction %p: %.1fms waiting "
271 "(%.1f frames if 60Hz)", transaction, ms, ms / (1000.0f / 60)); 271 "(%.1f frames if 60Hz)", transaction, ms, ms / (1000.0f / 60));
272 } 272 }
273 273
@@ -363,7 +363,7 @@ static void transaction_progress_queue(void) {
363 363
364static int handle_timeout(void *data) { 364static int handle_timeout(void *data) {
365 struct sway_transaction *transaction = data; 365 struct sway_transaction *transaction = data;
366 wlr_log(WLR_DEBUG, "Transaction %p timed out (%zi waiting)", 366 sway_log(SWAY_DEBUG, "Transaction %p timed out (%zi waiting)",
367 transaction, transaction->num_waiting); 367 transaction, transaction->num_waiting);
368 transaction->num_waiting = 0; 368 transaction->num_waiting = 0;
369 transaction_progress_queue(); 369 transaction_progress_queue();
@@ -398,7 +398,7 @@ static bool should_configure(struct sway_node *node,
398} 398}
399 399
400static void transaction_commit(struct sway_transaction *transaction) { 400static void transaction_commit(struct sway_transaction *transaction) {
401 wlr_log(WLR_DEBUG, "Transaction %p committing with %i instructions", 401 sway_log(SWAY_DEBUG, "Transaction %p committing with %i instructions",
402 transaction, transaction->instructions->length); 402 transaction, transaction->instructions->length);
403 transaction->num_waiting = 0; 403 transaction->num_waiting = 0;
404 for (int i = 0; i < transaction->instructions->length; ++i) { 404 for (int i = 0; i < transaction->instructions->length; ++i) {
@@ -449,7 +449,7 @@ static void transaction_commit(struct sway_transaction *transaction) {
449 wl_event_source_timer_update(transaction->timer, 449 wl_event_source_timer_update(transaction->timer,
450 server.txn_timeout_ms); 450 server.txn_timeout_ms);
451 } else { 451 } else {
452 wlr_log(WLR_ERROR, "Unable to create transaction timer (%s). " 452 sway_log(SWAY_ERROR, "Unable to create transaction timer (%s). "
453 "Some imperfect frames might be rendered.", 453 "Some imperfect frames might be rendered.",
454 strerror(errno)); 454 strerror(errno));
455 transaction->num_waiting = 0; 455 transaction->num_waiting = 0;
@@ -472,7 +472,7 @@ static void set_instruction_ready(
472 struct timespec *start = &transaction->commit_time; 472 struct timespec *start = &transaction->commit_time;
473 float ms = (now.tv_sec - start->tv_sec) * 1000 + 473 float ms = (now.tv_sec - start->tv_sec) * 1000 +
474 (now.tv_nsec - start->tv_nsec) / 1000000.0; 474 (now.tv_nsec - start->tv_nsec) / 1000000.0;
475 wlr_log(WLR_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)", 475 sway_log(SWAY_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)",
476 transaction, 476 transaction,
477 transaction->num_configures - transaction->num_waiting + 1, 477 transaction->num_configures - transaction->num_waiting + 1,
478 transaction->num_configures, ms, 478 transaction->num_configures, ms,
@@ -481,7 +481,7 @@ static void set_instruction_ready(
481 481
482 // If the transaction has timed out then its num_waiting will be 0 already. 482 // If the transaction has timed out then its num_waiting will be 0 already.
483 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { 483 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
484 wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction); 484 sway_log(SWAY_DEBUG, "Transaction %p is ready", transaction);
485 wl_event_source_timer_update(transaction->timer, 0); 485 wl_event_source_timer_update(transaction->timer, 0);
486 } 486 }
487 487