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

@ -8,13 +8,13 @@
struct input_config *new_input_config(const char* identifier) {
struct input_config *input = calloc(1, sizeof(struct input_config));
if (!input) {
wlr_log(WLR_DEBUG, "Unable to allocate input config");
sway_log(SWAY_DEBUG, "Unable to allocate input config");
return NULL;
}
wlr_log(WLR_DEBUG, "new_input_config(%s)", identifier);
sway_log(SWAY_DEBUG, "new_input_config(%s)", identifier);
if (!(input->identifier = strdup(identifier))) {
free(input);
wlr_log(WLR_DEBUG, "Unable to allocate input config");
sway_log(SWAY_DEBUG, "Unable to allocate input config");
return NULL;
}
@ -136,7 +136,7 @@ static void merge_wildcard_on_all(struct input_config *wildcard) {
for (int i = 0; i < config->input_configs->length; i++) {
struct input_config *ic = config->input_configs->items[i];
if (strcmp(wildcard->identifier, ic->identifier) != 0) {
wlr_log(WLR_DEBUG, "Merging input * config on %s", ic->identifier);
sway_log(SWAY_DEBUG, "Merging input * config on %s", ic->identifier);
merge_input_config(ic, wildcard);
}
}
@ -151,16 +151,16 @@ struct input_config *store_input_config(struct input_config *ic) {
int i = list_seq_find(config->input_configs, input_identifier_cmp,
ic->identifier);
if (i >= 0) {
wlr_log(WLR_DEBUG, "Merging on top of existing input config");
sway_log(SWAY_DEBUG, "Merging on top of existing input config");
struct input_config *current = config->input_configs->items[i];
merge_input_config(current, ic);
free_input_config(ic);
ic = current;
} else if (!wildcard) {
wlr_log(WLR_DEBUG, "Adding non-wildcard input config");
sway_log(SWAY_DEBUG, "Adding non-wildcard input config");
i = list_seq_find(config->input_configs, input_identifier_cmp, "*");
if (i >= 0) {
wlr_log(WLR_DEBUG, "Merging on top of input * config");
sway_log(SWAY_DEBUG, "Merging on top of input * config");
struct input_config *current = new_input_config(ic->identifier);
merge_input_config(current, config->input_configs->items[i]);
merge_input_config(current, ic);
@ -170,11 +170,11 @@ struct input_config *store_input_config(struct input_config *ic) {
list_add(config->input_configs, ic);
} else {
// New wildcard config. Just add it
wlr_log(WLR_DEBUG, "Adding input * config");
sway_log(SWAY_DEBUG, "Adding input * config");
list_add(config->input_configs, ic);
}
wlr_log(WLR_DEBUG, "Config stored for input %s", ic->identifier);
sway_log(SWAY_DEBUG, "Config stored for input %s", ic->identifier);
return ic;
}