diff options
author | M Stoeckl <code@mstoeckl.com> | 2019-01-20 13:51:12 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-01-21 12:59:42 +0100 |
commit | 1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 (patch) | |
tree | 5c3f60e0219cb8b4a1b7cafb760a871661866e32 /sway/desktop | |
parent | Log libinput_config_status errors (diff) | |
download | sway-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')
-rw-r--r-- | sway/desktop/idle_inhibit_v1.c | 4 | ||||
-rw-r--r-- | sway/desktop/layer_shell.c | 9 | ||||
-rw-r--r-- | sway/desktop/output.c | 4 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 14 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 4 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 4 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 10 |
7 files changed, 24 insertions, 25 deletions
diff --git a/sway/desktop/idle_inhibit_v1.c b/sway/desktop/idle_inhibit_v1.c index 17d4242b..87b4ef43 100644 --- a/sway/desktop/idle_inhibit_v1.c +++ b/sway/desktop/idle_inhibit_v1.c | |||
@@ -9,7 +9,7 @@ | |||
9 | static void handle_destroy(struct wl_listener *listener, void *data) { | 9 | static void handle_destroy(struct wl_listener *listener, void *data) { |
10 | struct sway_idle_inhibitor_v1 *inhibitor = | 10 | struct sway_idle_inhibitor_v1 *inhibitor = |
11 | wl_container_of(listener, inhibitor, destroy); | 11 | wl_container_of(listener, inhibitor, destroy); |
12 | wlr_log(WLR_DEBUG, "Sway idle inhibitor destroyed"); | 12 | sway_log(SWAY_DEBUG, "Sway idle inhibitor destroyed"); |
13 | wl_list_remove(&inhibitor->link); | 13 | wl_list_remove(&inhibitor->link); |
14 | wl_list_remove(&inhibitor->destroy.link); | 14 | wl_list_remove(&inhibitor->destroy.link); |
15 | idle_inhibit_v1_check_active(inhibitor->manager); | 15 | idle_inhibit_v1_check_active(inhibitor->manager); |
@@ -20,7 +20,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data) { | |||
20 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data; | 20 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data; |
21 | struct sway_idle_inhibit_manager_v1 *manager = | 21 | struct sway_idle_inhibit_manager_v1 *manager = |
22 | wl_container_of(listener, manager, new_idle_inhibitor_v1); | 22 | wl_container_of(listener, manager, new_idle_inhibitor_v1); |
23 | wlr_log(WLR_DEBUG, "New sway idle inhibitor"); | 23 | sway_log(SWAY_DEBUG, "New sway idle inhibitor"); |
24 | 24 | ||
25 | struct sway_idle_inhibitor_v1 *inhibitor = | 25 | struct sway_idle_inhibitor_v1 *inhibitor = |
26 | calloc(1, sizeof(struct sway_idle_inhibitor_v1)); | 26 | calloc(1, sizeof(struct sway_idle_inhibitor_v1)); |
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index ab05778d..a870bb9a 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <wlr/types/wlr_layer_shell_v1.h> | 6 | #include <wlr/types/wlr_layer_shell_v1.h> |
7 | #include <wlr/types/wlr_output_damage.h> | 7 | #include <wlr/types/wlr_output_damage.h> |
8 | #include <wlr/types/wlr_output.h> | 8 | #include <wlr/types/wlr_output.h> |
9 | #include <wlr/util/log.h> | ||
10 | #include "sway/desktop/transaction.h" | 9 | #include "sway/desktop/transaction.h" |
11 | #include "sway/input/input-manager.h" | 10 | #include "sway/input/input-manager.h" |
12 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
@@ -175,7 +174,7 @@ void arrange_layers(struct sway_output *output) { | |||
175 | 174 | ||
176 | if (memcmp(&usable_area, &output->usable_area, | 175 | if (memcmp(&usable_area, &output->usable_area, |
177 | sizeof(struct wlr_box)) != 0) { | 176 | sizeof(struct wlr_box)) != 0) { |
178 | wlr_log(WLR_DEBUG, "Usable area changed, rearranging output"); | 177 | sway_log(SWAY_DEBUG, "Usable area changed, rearranging output"); |
179 | memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); | 178 | memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); |
180 | arrange_output(output); | 179 | arrange_output(output); |
181 | } | 180 | } |
@@ -308,7 +307,7 @@ static void unmap(struct sway_layer_surface *sway_layer) { | |||
308 | static void handle_destroy(struct wl_listener *listener, void *data) { | 307 | static void handle_destroy(struct wl_listener *listener, void *data) { |
309 | struct sway_layer_surface *sway_layer = | 308 | struct sway_layer_surface *sway_layer = |
310 | wl_container_of(listener, sway_layer, destroy); | 309 | wl_container_of(listener, sway_layer, destroy); |
311 | wlr_log(WLR_DEBUG, "Layer surface destroyed (%s)", | 310 | sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)", |
312 | sway_layer->layer_surface->namespace); | 311 | sway_layer->layer_surface->namespace); |
313 | if (sway_layer->layer_surface->mapped) { | 312 | if (sway_layer->layer_surface->mapped) { |
314 | unmap(sway_layer); | 313 | unmap(sway_layer); |
@@ -357,7 +356,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
357 | struct wlr_layer_surface_v1 *layer_surface = data; | 356 | struct wlr_layer_surface_v1 *layer_surface = data; |
358 | struct sway_server *server = | 357 | struct sway_server *server = |
359 | wl_container_of(listener, server, layer_shell_surface); | 358 | wl_container_of(listener, server, layer_shell_surface); |
360 | wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d " | 359 | sway_log(SWAY_DEBUG, "new layer surface: namespace %s layer %d anchor %d " |
361 | "size %dx%d margin %d,%d,%d,%d", | 360 | "size %dx%d margin %d,%d,%d,%d", |
362 | layer_surface->namespace, layer_surface->layer, layer_surface->layer, | 361 | layer_surface->namespace, layer_surface->layer, layer_surface->layer, |
363 | layer_surface->client_pending.desired_width, | 362 | layer_surface->client_pending.desired_width, |
@@ -380,7 +379,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
380 | } | 379 | } |
381 | if (!output) { | 380 | if (!output) { |
382 | if (!root->outputs->length) { | 381 | if (!root->outputs->length) { |
383 | wlr_log(WLR_ERROR, | 382 | sway_log(SWAY_ERROR, |
384 | "no output to auto-assign layer surface '%s' to", | 383 | "no output to auto-assign layer surface '%s' to", |
385 | layer_surface->namespace); | 384 | layer_surface->namespace); |
386 | wlr_layer_surface_v1_close(layer_surface); | 385 | wlr_layer_surface_v1_close(layer_surface); |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 646b6d70..edf77fbc 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -510,7 +510,7 @@ static void handle_mode(struct wl_listener *listener, void *data) { | |||
510 | // We want to enable this output, but it didn't work last time, | 510 | // We want to enable this output, but it didn't work last time, |
511 | // possibly because we hadn't enough CRTCs. Try again now that the | 511 | // possibly because we hadn't enough CRTCs. Try again now that the |
512 | // output has a mode. | 512 | // output has a mode. |
513 | wlr_log(WLR_DEBUG, "Output %s has gained a CRTC, " | 513 | sway_log(SWAY_DEBUG, "Output %s has gained a CRTC, " |
514 | "trying to enable it", output->wlr_output->name); | 514 | "trying to enable it", output->wlr_output->name); |
515 | apply_output_config(oc, output); | 515 | apply_output_config(oc, output); |
516 | } | 516 | } |
@@ -580,7 +580,7 @@ static void handle_present(struct wl_listener *listener, void *data) { | |||
580 | void handle_new_output(struct wl_listener *listener, void *data) { | 580 | void handle_new_output(struct wl_listener *listener, void *data) { |
581 | struct sway_server *server = wl_container_of(listener, server, new_output); | 581 | struct sway_server *server = wl_container_of(listener, server, new_output); |
582 | struct wlr_output *wlr_output = data; | 582 | struct wlr_output *wlr_output = data; |
583 | wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); | 583 | sway_log(SWAY_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); |
584 | 584 | ||
585 | struct sway_output *output = output_create(wlr_output); | 585 | struct sway_output *output = output_create(wlr_output); |
586 | if (!output) { | 586 | if (!output) { |
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 | */ |
262 | static void transaction_apply(struct sway_transaction *transaction) { | 262 | static 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 | ||
364 | static int handle_timeout(void *data) { | 364 | static 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 | ||
400 | static void transaction_commit(struct sway_transaction *transaction) { | 400 | static 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 | ||
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 7da86136..b4ac3a68 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -485,11 +485,11 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { | |||
485 | struct wlr_xdg_surface *xdg_surface = data; | 485 | struct wlr_xdg_surface *xdg_surface = data; |
486 | 486 | ||
487 | if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { | 487 | if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { |
488 | wlr_log(WLR_DEBUG, "New xdg_shell popup"); | 488 | sway_log(SWAY_DEBUG, "New xdg_shell popup"); |
489 | return; | 489 | return; |
490 | } | 490 | } |
491 | 491 | ||
492 | wlr_log(WLR_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", | 492 | sway_log(SWAY_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", |
493 | xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); | 493 | xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); |
494 | wlr_xdg_surface_ping(xdg_surface); | 494 | wlr_xdg_surface_ping(xdg_surface); |
495 | 495 | ||
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 9f6741c8..553d532d 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -469,11 +469,11 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
469 | struct wlr_xdg_surface_v6 *xdg_surface = data; | 469 | struct wlr_xdg_surface_v6 *xdg_surface = data; |
470 | 470 | ||
471 | if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { | 471 | if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { |
472 | wlr_log(WLR_DEBUG, "New xdg_shell_v6 popup"); | 472 | sway_log(SWAY_DEBUG, "New xdg_shell_v6 popup"); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | 475 | ||
476 | wlr_log(WLR_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", | 476 | sway_log(SWAY_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", |
477 | xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); | 477 | xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); |
478 | wlr_xdg_surface_v6_ping(xdg_surface); | 478 | wlr_xdg_surface_v6_ping(xdg_surface); |
479 | 479 | ||
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 080f6c41..8dcf4bd6 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -118,7 +118,7 @@ static struct sway_xwayland_unmanaged *create_unmanaged( | |||
118 | struct sway_xwayland_unmanaged *surface = | 118 | struct sway_xwayland_unmanaged *surface = |
119 | calloc(1, sizeof(struct sway_xwayland_unmanaged)); | 119 | calloc(1, sizeof(struct sway_xwayland_unmanaged)); |
120 | if (surface == NULL) { | 120 | if (surface == NULL) { |
121 | wlr_log(WLR_ERROR, "Allocation failed"); | 121 | sway_log(SWAY_ERROR, "Allocation failed"); |
122 | return NULL; | 122 | return NULL; |
123 | } | 123 | } |
124 | 124 | ||
@@ -578,12 +578,12 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { | |||
578 | struct wlr_xwayland_surface *xsurface = data; | 578 | struct wlr_xwayland_surface *xsurface = data; |
579 | 579 | ||
580 | if (xsurface->override_redirect) { | 580 | if (xsurface->override_redirect) { |
581 | wlr_log(WLR_DEBUG, "New xwayland unmanaged surface"); | 581 | sway_log(SWAY_DEBUG, "New xwayland unmanaged surface"); |
582 | create_unmanaged(xsurface); | 582 | create_unmanaged(xsurface); |
583 | return; | 583 | return; |
584 | } | 584 | } |
585 | 585 | ||
586 | wlr_log(WLR_DEBUG, "New xwayland surface title='%s' class='%s'", | 586 | sway_log(SWAY_DEBUG, "New xwayland surface title='%s' class='%s'", |
587 | xsurface->title, xsurface->class); | 587 | xsurface->title, xsurface->class); |
588 | 588 | ||
589 | struct sway_xwayland_view *xwayland_view = | 589 | struct sway_xwayland_view *xwayland_view = |
@@ -655,7 +655,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) { | |||
655 | xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL); | 655 | xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL); |
656 | int err = xcb_connection_has_error(xcb_conn); | 656 | int err = xcb_connection_has_error(xcb_conn); |
657 | if (err) { | 657 | if (err) { |
658 | wlr_log(WLR_ERROR, "XCB connect failed: %d", err); | 658 | sway_log(SWAY_ERROR, "XCB connect failed: %d", err); |
659 | return; | 659 | return; |
660 | } | 660 | } |
661 | 661 | ||
@@ -674,7 +674,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) { | |||
674 | free(reply); | 674 | free(reply); |
675 | 675 | ||
676 | if (error != NULL) { | 676 | if (error != NULL) { |
677 | wlr_log(WLR_ERROR, "could not resolve atom %s, X11 error code %d", | 677 | sway_log(SWAY_ERROR, "could not resolve atom %s, X11 error code %d", |
678 | atom_map[i], error->error_code); | 678 | atom_map[i], error->error_code); |
679 | free(error); | 679 | free(error); |
680 | break; | 680 | break; |