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.
This commit is contained in:
M Stoeckl 2019-01-20 13:51:12 -05:00 committed by emersion
parent 5c834d36e1
commit 1211a81aad
108 changed files with 613 additions and 504 deletions

View file

@ -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);