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

@ -19,9 +19,9 @@
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/util/log.h>
#include "config.h"
#include "list.h"
#include "log.h"
#include "sway/config.h"
#include "sway/desktop/idle_inhibit_v1.h"
#include "sway/input/input-manager.h"
@ -32,20 +32,20 @@
#endif
bool server_privileged_prepare(struct sway_server *server) {
wlr_log(WLR_DEBUG, "Preparing Wayland server initialization");
sway_log(SWAY_DEBUG, "Preparing Wayland server initialization");
server->wl_display = wl_display_create();
server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
if (!server->backend) {
wlr_log(WLR_ERROR, "Unable to create backend");
sway_log(SWAY_ERROR, "Unable to create backend");
return false;
}
return true;
}
bool server_init(struct sway_server *server) {
wlr_log(WLR_DEBUG, "Initializing Wayland server");
sway_log(SWAY_DEBUG, "Initializing Wayland server");
struct wlr_renderer *renderer = wlr_backend_get_renderer(server->backend);
assert(renderer);
@ -111,7 +111,7 @@ bool server_init(struct sway_server *server) {
server->socket = wl_display_add_socket_auto(server->wl_display);
if (!server->socket) {
wlr_log(WLR_ERROR, "Unable to open wayland socket");
sway_log(SWAY_ERROR, "Unable to open wayland socket");
wlr_backend_destroy(server->backend);
return false;
}
@ -155,7 +155,7 @@ bool server_start(struct sway_server *server) {
#if HAVE_XWAYLAND
if (config->xwayland) {
wlr_log(WLR_DEBUG, "Initializing Xwayland");
sway_log(SWAY_DEBUG, "Initializing Xwayland");
server->xwayland.wlr_xwayland =
wlr_xwayland_create(server->wl_display, server->compositor, true);
wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface,
@ -179,10 +179,10 @@ bool server_start(struct sway_server *server) {
}
#endif
wlr_log(WLR_INFO, "Starting backend on wayland display '%s'",
sway_log(SWAY_INFO, "Starting backend on wayland display '%s'",
server->socket);
if (!wlr_backend_start(server->backend)) {
wlr_log(WLR_ERROR, "Failed to start backend");
sway_log(SWAY_ERROR, "Failed to start backend");
wlr_backend_destroy(server->backend);
return false;
}
@ -190,7 +190,7 @@ bool server_start(struct sway_server *server) {
}
void server_run(struct sway_server *server) {
wlr_log(WLR_INFO, "Running compositor on wayland display '%s'",
sway_log(SWAY_INFO, "Running compositor on wayland display '%s'",
server->socket);
wl_display_run(server->wl_display);
}