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 | 5c834d36e14aaeca4ac1d22b869254d5722af4af (diff) |
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 @@ static void handle_destroy(struct wl_listener *listener, void *data) { struct sway_idle_inhibitor_v1 *inhibitor = wl_container_of(listener, inhibitor, destroy); - wlr_log(WLR_DEBUG, "Sway idle inhibitor destroyed"); + sway_log(SWAY_DEBUG, "Sway idle inhibitor destroyed"); wl_list_remove(&inhibitor->link); wl_list_remove(&inhibitor->destroy.link); idle_inhibit_v1_check_active(inhibitor->manager); @@ -20,7 +20,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data) { struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data; struct sway_idle_inhibit_manager_v1 *manager = wl_container_of(listener, manager, new_idle_inhibitor_v1); - wlr_log(WLR_DEBUG, "New sway idle inhibitor"); + sway_log(SWAY_DEBUG, "New sway idle inhibitor"); struct sway_idle_inhibitor_v1 *inhibitor = 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 @@ #include <wlr/types/wlr_layer_shell_v1.h> #include <wlr/types/wlr_output_damage.h> #include <wlr/types/wlr_output.h> -#include <wlr/util/log.h> #include "sway/desktop/transaction.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" @@ -175,7 +174,7 @@ void arrange_layers(struct sway_output *output) { if (memcmp(&usable_area, &output->usable_area, sizeof(struct wlr_box)) != 0) { - wlr_log(WLR_DEBUG, "Usable area changed, rearranging output"); + sway_log(SWAY_DEBUG, "Usable area changed, rearranging output"); memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); arrange_output(output); } @@ -308,7 +307,7 @@ static void unmap(struct sway_layer_surface *sway_layer) { static void handle_destroy(struct wl_listener *listener, void *data) { struct sway_layer_surface *sway_layer = wl_container_of(listener, sway_layer, destroy); - wlr_log(WLR_DEBUG, "Layer surface destroyed (%s)", + sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)", sway_layer->layer_surface->namespace); if (sway_layer->layer_surface->mapped) { unmap(sway_layer); @@ -357,7 +356,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { struct wlr_layer_surface_v1 *layer_surface = data; struct sway_server *server = wl_container_of(listener, server, layer_shell_surface); - wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d " + sway_log(SWAY_DEBUG, "new layer surface: namespace %s layer %d anchor %d " "size %dx%d margin %d,%d,%d,%d", layer_surface->namespace, layer_surface->layer, layer_surface->layer, layer_surface->client_pending.desired_width, @@ -380,7 +379,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { } if (!output) { if (!root->outputs->length) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "no output to auto-assign layer surface '%s' to", layer_surface->namespace); 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) { // We want to enable this output, but it didn't work last time, // possibly because we hadn't enough CRTCs. Try again now that the // output has a mode. - wlr_log(WLR_DEBUG, "Output %s has gained a CRTC, " + sway_log(SWAY_DEBUG, "Output %s has gained a CRTC, " "trying to enable it", output->wlr_output->name); apply_output_config(oc, output); } @@ -580,7 +580,7 @@ static void handle_present(struct wl_listener *listener, void *data) { void handle_new_output(struct wl_listener *listener, void *data) { struct sway_server *server = wl_container_of(listener, server, new_output); struct wlr_output *wlr_output = data; - wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); + sway_log(SWAY_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); struct sway_output *output = output_create(wlr_output); 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, * Apply a transaction to the "current" state of the tree. */ static void transaction_apply(struct sway_transaction *transaction) { - wlr_log(WLR_DEBUG, "Applying transaction %p", transaction); + sway_log(SWAY_DEBUG, "Applying transaction %p", transaction); if (debug.txn_timings) { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); struct timespec *commit = &transaction->commit_time; float ms = (now.tv_sec - commit->tv_sec) * 1000 + (now.tv_nsec - commit->tv_nsec) / 1000000.0; - wlr_log(WLR_DEBUG, "Transaction %p: %.1fms waiting " + sway_log(SWAY_DEBUG, "Transaction %p: %.1fms waiting " "(%.1f frames if 60Hz)", transaction, ms, ms / (1000.0f / 60)); } @@ -363,7 +363,7 @@ static void transaction_progress_queue(void) { static int handle_timeout(void *data) { struct sway_transaction *transaction = data; - wlr_log(WLR_DEBUG, "Transaction %p timed out (%zi waiting)", + sway_log(SWAY_DEBUG, "Transaction %p timed out (%zi waiting)", transaction, transaction->num_waiting); transaction->num_waiting = 0; transaction_progress_queue(); @@ -398,7 +398,7 @@ static bool should_configure(struct sway_node *node, } static void transaction_commit(struct sway_transaction *transaction) { - wlr_log(WLR_DEBUG, "Transaction %p committing with %i instructions", + sway_log(SWAY_DEBUG, "Transaction %p committing with %i instructions", transaction, transaction->instructions->length); transaction->num_waiting = 0; for (int i = 0; i < transaction->instructions->length; ++i) { @@ -449,7 +449,7 @@ static void transaction_commit(struct sway_transaction *transaction) { wl_event_source_timer_update(transaction->timer, server.txn_timeout_ms); } else { - wlr_log(WLR_ERROR, "Unable to create transaction timer (%s). " + sway_log(SWAY_ERROR, "Unable to create transaction timer (%s). " "Some imperfect frames might be rendered.", strerror(errno)); transaction->num_waiting = 0; @@ -472,7 +472,7 @@ static void set_instruction_ready( struct timespec *start = &transaction->commit_time; float ms = (now.tv_sec - start->tv_sec) * 1000 + (now.tv_nsec - start->tv_nsec) / 1000000.0; - wlr_log(WLR_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)", + sway_log(SWAY_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)", transaction, transaction->num_configures - transaction->num_waiting + 1, transaction->num_configures, ms, @@ -481,7 +481,7 @@ static void set_instruction_ready( // If the transaction has timed out then its num_waiting will be 0 already. if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { - wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction); + sway_log(SWAY_DEBUG, "Transaction %p is ready", transaction); wl_event_source_timer_update(transaction->timer, 0); } 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) { struct wlr_xdg_surface *xdg_surface = data; if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { - wlr_log(WLR_DEBUG, "New xdg_shell popup"); + sway_log(SWAY_DEBUG, "New xdg_shell popup"); return; } - wlr_log(WLR_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", + sway_log(SWAY_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); wlr_xdg_surface_ping(xdg_surface); 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) { struct wlr_xdg_surface_v6 *xdg_surface = data; if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { - wlr_log(WLR_DEBUG, "New xdg_shell_v6 popup"); + sway_log(SWAY_DEBUG, "New xdg_shell_v6 popup"); return; } - wlr_log(WLR_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", + sway_log(SWAY_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); wlr_xdg_surface_v6_ping(xdg_surface); 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( struct sway_xwayland_unmanaged *surface = calloc(1, sizeof(struct sway_xwayland_unmanaged)); if (surface == NULL) { - wlr_log(WLR_ERROR, "Allocation failed"); + sway_log(SWAY_ERROR, "Allocation failed"); return NULL; } @@ -578,12 +578,12 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { struct wlr_xwayland_surface *xsurface = data; if (xsurface->override_redirect) { - wlr_log(WLR_DEBUG, "New xwayland unmanaged surface"); + sway_log(SWAY_DEBUG, "New xwayland unmanaged surface"); create_unmanaged(xsurface); return; } - wlr_log(WLR_DEBUG, "New xwayland surface title='%s' class='%s'", + sway_log(SWAY_DEBUG, "New xwayland surface title='%s' class='%s'", xsurface->title, xsurface->class); struct sway_xwayland_view *xwayland_view = @@ -655,7 +655,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) { xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL); int err = xcb_connection_has_error(xcb_conn); if (err) { - wlr_log(WLR_ERROR, "XCB connect failed: %d", err); + sway_log(SWAY_ERROR, "XCB connect failed: %d", err); return; } @@ -674,7 +674,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) { free(reply); if (error != NULL) { - wlr_log(WLR_ERROR, "could not resolve atom %s, X11 error code %d", + sway_log(SWAY_ERROR, "could not resolve atom %s, X11 error code %d", atom_map[i], error->error_code); free(error); break; |