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

@ -7,7 +7,7 @@
struct seat_config *new_seat_config(const char* name) {
struct seat_config *seat = calloc(1, sizeof(struct seat_config));
if (!seat) {
wlr_log(WLR_DEBUG, "Unable to allocate seat config");
sway_log(SWAY_DEBUG, "Unable to allocate seat config");
return NULL;
}
@ -34,7 +34,7 @@ static void merge_wildcard_on_all(struct seat_config *wildcard) {
for (int i = 0; i < config->seat_configs->length; i++) {
struct seat_config *sc = config->seat_configs->items[i];
if (strcmp(wildcard->name, sc->name) != 0) {
wlr_log(WLR_DEBUG, "Merging seat * config on %s", sc->name);
sway_log(SWAY_DEBUG, "Merging seat * config on %s", sc->name);
merge_seat_config(sc, wildcard);
}
}
@ -48,16 +48,16 @@ struct seat_config *store_seat_config(struct seat_config *sc) {
int i = list_seq_find(config->seat_configs, seat_name_cmp, sc->name);
if (i >= 0) {
wlr_log(WLR_DEBUG, "Merging on top of existing seat config");
sway_log(SWAY_DEBUG, "Merging on top of existing seat config");
struct seat_config *current = config->seat_configs->items[i];
merge_seat_config(current, sc);
free_seat_config(sc);
sc = current;
} else if (!wildcard) {
wlr_log(WLR_DEBUG, "Adding non-wildcard seat config");
sway_log(SWAY_DEBUG, "Adding non-wildcard seat config");
i = list_seq_find(config->seat_configs, seat_name_cmp, "*");
if (i >= 0) {
wlr_log(WLR_DEBUG, "Merging on top of seat * config");
sway_log(SWAY_DEBUG, "Merging on top of seat * config");
struct seat_config *current = new_seat_config(sc->name);
merge_seat_config(current, config->seat_configs->items[i]);
merge_seat_config(current, sc);
@ -67,11 +67,11 @@ struct seat_config *store_seat_config(struct seat_config *sc) {
list_add(config->seat_configs, sc);
} else {
// New wildcard config. Just add it
wlr_log(WLR_DEBUG, "Adding seat * config");
sway_log(SWAY_DEBUG, "Adding seat * config");
list_add(config->seat_configs, sc);
}
wlr_log(WLR_DEBUG, "Config stored for seat %s", sc->name);
sway_log(SWAY_DEBUG, "Config stored for seat %s", sc->name);
return sc;
}
@ -80,7 +80,7 @@ struct seat_attachment_config *seat_attachment_config_new(void) {
struct seat_attachment_config *attachment =
calloc(1, sizeof(struct seat_attachment_config));
if (!attachment) {
wlr_log(WLR_DEBUG, "cannot allocate attachment config");
sway_log(SWAY_DEBUG, "cannot allocate attachment config");
return NULL;
}
return attachment;