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

@ -56,7 +56,7 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
criteria->target = join_args(argv, argc);
list_add(config->criteria, criteria);
wlr_log(WLR_DEBUG, "assign: '%s' -> '%s' added", criteria->raw,
sway_log(SWAY_DEBUG, "assign: '%s' -> '%s' added", criteria->raw,
criteria->target);
return cmd_results_new(CMD_SUCCESS, NULL);

View file

@ -1,9 +1,9 @@
#define _POSIX_C_SOURCE 200809
#include <string.h>
#include <strings.h>
#include <wlr/util/log.h>
#include "sway/commands.h"
#include "sway/config.h"
#include "log.h"
#include "util.h"
// Must be in alphabetical order for bsearch
@ -60,14 +60,14 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
for (int i = 0; i < config->bars->length; ++i) {
struct bar_config *item = config->bars->items[i];
if (strcmp(item->id, argv[0]) == 0) {
wlr_log(WLR_DEBUG, "Selecting bar: %s", argv[0]);
sway_log(SWAY_DEBUG, "Selecting bar: %s", argv[0]);
bar = item;
break;
}
}
if (!bar) {
spawn = !config->reading;
wlr_log(WLR_DEBUG, "Creating bar: %s", argv[0]);
sway_log(SWAY_DEBUG, "Creating bar: %s", argv[0]);
bar = default_bar_config();
if (!bar) {
return cmd_results_new(CMD_FAILURE,
@ -99,7 +99,7 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
// Set current bar
config->current_bar = bar;
wlr_log(WLR_DEBUG, "Creating bar %s", bar->id);
sway_log(SWAY_DEBUG, "Creating bar %s", bar->id);
}
if (find_handler(argv[0], bar_config_handlers,

View file

@ -59,7 +59,7 @@ static struct cmd_results *bar_cmd_bind(int argc, char **argv, bool code) {
overwritten = true;
bindings->items[i] = binding;
free_bar_binding(other);
wlr_log(WLR_DEBUG, "[bar %s] Updated binding for %u (%s)%s",
sway_log(SWAY_DEBUG, "[bar %s] Updated binding for %u (%s)%s",
config->current_bar->id, binding->button, name,
binding->release ? " - release" : "");
break;
@ -67,7 +67,7 @@ static struct cmd_results *bar_cmd_bind(int argc, char **argv, bool code) {
}
if (!overwritten) {
list_add(bindings, binding);
wlr_log(WLR_DEBUG, "[bar %s] Added binding for %u (%s)%s",
sway_log(SWAY_DEBUG, "[bar %s] Added binding for %u (%s)%s",
config->current_bar->id, binding->button, name,
binding->release ? " - release" : "");
}

View file

@ -16,10 +16,10 @@ struct cmd_results *bar_cmd_binding_mode_indicator(int argc, char **argv) {
config->current_bar->binding_mode_indicator =
parse_boolean(argv[0], config->current_bar->binding_mode_indicator);
if (config->current_bar->binding_mode_indicator) {
wlr_log(WLR_DEBUG, "Enabling binding mode indicator on bar: %s",
sway_log(SWAY_DEBUG, "Enabling binding mode indicator on bar: %s",
config->current_bar->id);
} else {
wlr_log(WLR_DEBUG, "Disabling binding mode indicator on bar: %s",
sway_log(SWAY_DEBUG, "Disabling binding mode indicator on bar: %s",
config->current_bar->id);
}
return cmd_results_new(CMD_SUCCESS, NULL);

View file

@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_font(int argc, char **argv) {
char *font = join_args(argv, argc);
free(config->current_bar->font);
config->current_bar->font = font;
wlr_log(WLR_DEBUG, "Settings font '%s' for bar: %s",
sway_log(SWAY_DEBUG, "Settings font '%s' for bar: %s",
config->current_bar->font, config->current_bar->id);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -47,7 +47,7 @@ struct cmd_results *bar_cmd_gaps(int argc, char **argv) {
config->current_bar->gaps.bottom = bottom;
config->current_bar->gaps.left = left;
wlr_log(WLR_DEBUG, "Setting bar gaps to %d %d %d %d on bar: %s",
sway_log(SWAY_DEBUG, "Setting bar gaps to %d %d %d %d on bar: %s",
config->current_bar->gaps.top, config->current_bar->gaps.right,
config->current_bar->gaps.bottom, config->current_bar->gaps.left,
config->current_bar->id);

View file

@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_height(int argc, char **argv) {
"Invalid height value: %s", argv[0]);
}
config->current_bar->height = height;
wlr_log(WLR_DEBUG, "Setting bar height to %d on bar: %s",
sway_log(SWAY_DEBUG, "Setting bar height to %d on bar: %s",
height, config->current_bar->id);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -26,7 +26,7 @@ static struct cmd_results *bar_set_hidden_state(struct bar_config *bar,
if (!config->reading) {
ipc_event_barconfig_update(bar);
}
wlr_log(WLR_DEBUG, "Setting hidden_state: '%s' for bar: %s",
sway_log(SWAY_DEBUG, "Setting hidden_state: '%s' for bar: %s",
bar->hidden_state, bar->id);
}
// free old mode

View file

@ -16,7 +16,7 @@ struct cmd_results *bar_cmd_icon_theme(int argc, char **argv) {
return cmd_results_new(CMD_FAILURE, "No bar defined.");
}
wlr_log(WLR_DEBUG, "[Bar %s] Setting icon theme to %s",
sway_log(SWAY_DEBUG, "[Bar %s] Setting icon theme to %s",
config->current_bar->id, argv[0]);
free(config->current_bar->icon_theme);
config->current_bar->icon_theme = strdup(argv[0]);

View file

@ -26,7 +26,7 @@ struct cmd_results *bar_cmd_id(int argc, char **argv) {
}
}
wlr_log(WLR_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
sway_log(SWAY_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
// free old bar id
free(config->current_bar->id);

View file

@ -28,7 +28,7 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
if (!config->reading) {
ipc_event_barconfig_update(bar);
}
wlr_log(WLR_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
sway_log(SWAY_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
}
// free old mode

View file

@ -29,7 +29,7 @@ struct cmd_results *bar_cmd_modifier(int argc, char **argv) {
}
list_free_items_and_destroy(split);
config->current_bar->modifier = mod;
wlr_log(WLR_DEBUG,
sway_log(SWAY_DEBUG,
"Show/Hide the bar when pressing '%s' in hide mode.", argv[0]);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -42,7 +42,7 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
if (add_output) {
list_add(outputs, strdup(output));
wlr_log(WLR_DEBUG, "Adding bar: '%s' to output '%s'",
sway_log(SWAY_DEBUG, "Adding bar: '%s' to output '%s'",
config->current_bar->id, output);
}
return cmd_results_new(CMD_SUCCESS, NULL);

View file

@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) {
config->current_bar->pango_markup
= parse_boolean(argv[0], config->current_bar->pango_markup);
if (config->current_bar->pango_markup) {
wlr_log(WLR_DEBUG, "Enabling pango markup for bar: %s",
sway_log(SWAY_DEBUG, "Enabling pango markup for bar: %s",
config->current_bar->id);
} else {
wlr_log(WLR_DEBUG, "Disabling pango markup for bar: %s",
sway_log(SWAY_DEBUG, "Disabling pango markup for bar: %s",
config->current_bar->id);
}
return cmd_results_new(CMD_SUCCESS, NULL);

View file

@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) {
char *valid[] = { "top", "bottom" };
for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) {
if (strcasecmp(valid[i], argv[0]) == 0) {
wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s",
sway_log(SWAY_DEBUG, "Setting bar position '%s' for bar: %s",
argv[0], config->current_bar->id);
free(config->current_bar->position);
config->current_bar->position = strdup(argv[0]);

View file

@ -13,7 +13,7 @@ struct cmd_results *bar_cmd_separator_symbol(int argc, char **argv) {
}
free(config->current_bar->separator_symbol);
config->current_bar->separator_symbol = strdup(argv[0]);
wlr_log(WLR_DEBUG, "Settings separator_symbol '%s' for bar: %s",
sway_log(SWAY_DEBUG, "Settings separator_symbol '%s' for bar: %s",
config->current_bar->separator_symbol, config->current_bar->id);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -17,7 +17,7 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
char *new_command = join_args(argv, argc);
if (strcmp(new_command, "-") != 0) {
config->current_bar->status_command = new_command;
wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
sway_log(SWAY_DEBUG, "Feeding bar with status command: %s",
config->current_bar->status_command);
} else {
free(new_command);

View file

@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_status_edge_padding(int argc, char **argv) {
"Padding must be a positive integer");
}
config->current_bar->status_edge_padding = padding;
wlr_log(WLR_DEBUG, "Status edge padding on bar %s: %d",
sway_log(SWAY_DEBUG, "Status edge padding on bar %s: %d",
config->current_bar->id, config->current_bar->status_edge_padding);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_status_padding(int argc, char **argv) {
"Padding must be a positive integer");
}
config->current_bar->status_padding = padding;
wlr_log(WLR_DEBUG, "Status padding on bar %s: %d",
sway_log(SWAY_DEBUG, "Status padding on bar %s: %d",
config->current_bar->id, config->current_bar->status_padding);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -20,10 +20,10 @@ struct cmd_results *bar_cmd_strip_workspace_name(int argc, char **argv) {
if (config->current_bar->strip_workspace_name) {
config->current_bar->strip_workspace_numbers = false;
wlr_log(WLR_DEBUG, "Stripping workspace name on bar: %s",
sway_log(SWAY_DEBUG, "Stripping workspace name on bar: %s",
config->current_bar->id);
} else {
wlr_log(WLR_DEBUG, "Enabling workspace name on bar: %s",
sway_log(SWAY_DEBUG, "Enabling workspace name on bar: %s",
config->current_bar->id);
}

View file

@ -20,10 +20,10 @@ struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
if (config->current_bar->strip_workspace_numbers) {
config->current_bar->strip_workspace_name = false;
wlr_log(WLR_DEBUG, "Stripping workspace numbers on bar: %s",
sway_log(SWAY_DEBUG, "Stripping workspace numbers on bar: %s",
config->current_bar->id);
} else {
wlr_log(WLR_DEBUG, "Enabling workspace numbers on bar: %s",
sway_log(SWAY_DEBUG, "Enabling workspace numbers on bar: %s",
config->current_bar->id);
}

View file

@ -13,7 +13,7 @@ struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) {
}
free(config->current_bar->swaybar_command);
config->current_bar->swaybar_command = join_args(argv, argc);
wlr_log(WLR_DEBUG, "Using custom swaybar command: %s",
sway_log(SWAY_DEBUG, "Using custom swaybar command: %s",
config->current_bar->swaybar_command);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -67,7 +67,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) {
other->command = binding->command;
free(binding);
binding = other;
wlr_log(WLR_DEBUG,
sway_log(SWAY_DEBUG,
"[bar %s] Updated tray binding for %u (%s) to %s",
config->current_bar->id, binding->button, name,
binding->command);
@ -76,7 +76,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) {
}
if (!overwritten) {
wl_list_insert(&config->current_bar->tray_bindings, &binding->link);
wlr_log(WLR_DEBUG, "[bar %s] Added tray binding for %u (%s) to %s",
sway_log(SWAY_DEBUG, "[bar %s] Added tray binding for %u (%s) to %s",
config->current_bar->id, binding->button, name,
binding->command);
}

View file

@ -23,13 +23,13 @@ struct cmd_results *bar_cmd_tray_output(int argc, char **argv) {
}
if (strcmp(argv[0], "none") == 0) {
wlr_log(WLR_DEBUG, "Hiding tray on bar: %s", config->current_bar->id);
sway_log(SWAY_DEBUG, "Hiding tray on bar: %s", config->current_bar->id);
for (int i = 0; i < outputs->length; ++i) {
free(outputs->items[i]);
}
outputs->length = 0;
} else {
wlr_log(WLR_DEBUG, "Showing tray on output '%s' for bar: %s", argv[0],
sway_log(SWAY_DEBUG, "Showing tray on output '%s' for bar: %s", argv[0],
config->current_bar->id);
}
list_add(outputs, strdup(argv[0]));

View file

@ -32,7 +32,7 @@ struct cmd_results *bar_cmd_tray_padding(int argc, char **argv) {
"Expected 'tray_padding <px> [px]'");
}
wlr_log(WLR_DEBUG, "[Bar %s] Setting tray padding to %d", bar->id, padding);
sway_log(SWAY_DEBUG, "[Bar %s] Setting tray padding to %d", bar->id, padding);
config->current_bar->tray_padding = padding;
return cmd_results_new(CMD_SUCCESS, NULL);
#else

View file

@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) {
config->current_bar->workspace_buttons =
parse_boolean(argv[0], config->current_bar->workspace_buttons);
if (config->current_bar->workspace_buttons) {
wlr_log(WLR_DEBUG, "Enabling workspace buttons on bar: %s",
sway_log(SWAY_DEBUG, "Enabling workspace buttons on bar: %s",
config->current_bar->id);
} else {
wlr_log(WLR_DEBUG, "Disabling workspace buttons on bar: %s",
sway_log(SWAY_DEBUG, "Disabling workspace buttons on bar: %s",
config->current_bar->id);
}
return cmd_results_new(CMD_SUCCESS, NULL);

View file

@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) {
config->current_bar->wrap_scroll =
parse_boolean(argv[0], config->current_bar->wrap_scroll);
if (config->current_bar->wrap_scroll) {
wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s",
sway_log(SWAY_DEBUG, "Enabling wrap scroll on bar: %s",
config->current_bar->id);
} else {
wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s",
sway_log(SWAY_DEBUG, "Disabling wrap scroll on bar: %s",
config->current_bar->id);
}
return cmd_results_new(CMD_SUCCESS, NULL);

View file

@ -291,7 +291,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
for (int i = 0; i < mode_bindings->length; ++i) {
struct sway_binding *config_binding = mode_bindings->items[i];
if (binding_key_compare(binding, config_binding)) {
wlr_log(WLR_INFO, "Overwriting binding '%s' for device '%s' "
sway_log(SWAY_INFO, "Overwriting binding '%s' for device '%s' "
"from `%s` to `%s`", argv[0], binding->input,
binding->command, config_binding->command);
if (warn) {
@ -310,7 +310,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
list_add(mode_bindings, binding);
}
wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'",
sway_log(SWAY_DEBUG, "%s - Bound %s to command `%s` for device '%s'",
bindtype, argv[0], binding->command, binding->input);
return cmd_results_new(CMD_SUCCESS, NULL);
}
@ -327,14 +327,14 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
* Execute the command associated to a binding
*/
void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) {
wlr_log(WLR_DEBUG, "running command for binding: %s", binding->command);
sway_log(SWAY_DEBUG, "running command for binding: %s", binding->command);
list_t *res_list = execute_command(binding->command, seat, NULL);
bool success = true;
for (int i = 0; i < res_list->length; ++i) {
struct cmd_results *results = res_list->items[i];
if (results->status != CMD_SUCCESS) {
wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
sway_log(SWAY_DEBUG, "could not run command for binding: %s (%s)",
binding->command, results->error);
success = false;
}

View file

@ -114,6 +114,6 @@ struct cmd_results *cmd_client_urgent(int argc, char **argv) {
}
struct cmd_results *cmd_client_noop(int argc, char **argv) {
wlr_log(WLR_INFO, "Warning: %s is ignored by sway", argv[-1]);
sway_log(SWAY_INFO, "Warning: %s is ignored by sway", argv[-1]);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -8,7 +8,7 @@ struct cmd_results *cmd_exec(int argc, char **argv) {
if (!config->active) return cmd_results_new(CMD_DEFER, NULL);
if (config->reloading) {
char *args = join_args(argv, argc);
wlr_log(WLR_DEBUG, "Ignoring 'exec %s' due to reload", args);
sway_log(SWAY_DEBUG, "Ignoring 'exec %s' due to reload", args);
free(args);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -24,7 +24,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
char *tmp = NULL;
if (strcmp(argv[0], "--no-startup-id") == 0) {
wlr_log(WLR_INFO, "exec switch '--no-startup-id' not supported, ignored.");
sway_log(SWAY_INFO, "exec switch '--no-startup-id' not supported, ignored.");
--argc; ++argv;
if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) {
return error;
@ -43,11 +43,11 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
strncpy(cmd, tmp, sizeof(cmd) - 1);
cmd[sizeof(cmd) - 1] = 0;
free(tmp);
wlr_log(WLR_DEBUG, "Executing %s", cmd);
sway_log(SWAY_DEBUG, "Executing %s", cmd);
int fd[2];
if (pipe(fd) != 0) {
wlr_log(WLR_ERROR, "Unable to create pipe for fork");
sway_log(SWAY_ERROR, "Unable to create pipe for fork");
}
pid_t pid, child;
@ -84,7 +84,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
// cleanup child process
waitpid(pid, NULL, 0);
if (child > 0) {
wlr_log(WLR_DEBUG, "Child process created with pid %d", child);
sway_log(SWAY_DEBUG, "Child process created with pid %d", child);
root_record_workspace_pid(child);
} else {
return cmd_results_new(CMD_FAILURE, "Second fork() failed");

View file

@ -4,7 +4,6 @@
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <wlr/util/log.h>
#include "sway/commands.h"
#include "log.h"

View file

@ -1,6 +1,5 @@
#include <strings.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/util/log.h>
#include "log.h"
#include "sway/commands.h"
#include "sway/input/input-manager.h"

View file

@ -23,7 +23,7 @@ struct cmd_results *cmd_for_window(int argc, char **argv) {
criteria->cmdlist = join_args(argv + 1, argc - 1);
list_add(config->criteria, criteria);
wlr_log(WLR_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist);
sway_log(SWAY_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -45,7 +45,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
return error;
}
wlr_log(WLR_DEBUG, "entering input block: %s", argv[0]);
sway_log(SWAY_DEBUG, "entering input block: %s", argv[0]);
config->handler_context.input_config = new_input_config(argv[0]);
if (!config->handler_context.input_config) {

View file

@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
ic->xkb_layout = strdup(argv[0]);
wlr_log(WLR_DEBUG, "set-xkb_layout for config: %s layout: %s",
sway_log(SWAY_DEBUG, "set-xkb_layout for config: %s layout: %s",
ic->identifier, ic->xkb_layout);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
ic->xkb_model = strdup(argv[0]);
wlr_log(WLR_DEBUG, "set-xkb_model for config: %s model: %s",
sway_log(SWAY_DEBUG, "set-xkb_model for config: %s model: %s",
ic->identifier, ic->xkb_model);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
ic->xkb_options = strdup(argv[0]);
wlr_log(WLR_DEBUG, "set-xkb_options for config: %s options: %s",
sway_log(SWAY_DEBUG, "set-xkb_options for config: %s options: %s",
ic->identifier, ic->xkb_options);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
ic->xkb_rules = strdup(argv[0]);
wlr_log(WLR_DEBUG, "set-xkb_rules for config: %s rules: %s",
sway_log(SWAY_DEBUG, "set-xkb_rules for config: %s rules: %s",
ic->identifier, ic->xkb_rules);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
ic->xkb_variant = strdup(argv[0]);
wlr_log(WLR_DEBUG, "set-xkb_variant for config: %s variant: %s",
sway_log(SWAY_DEBUG, "set-xkb_variant for config: %s variant: %s",
ic->identifier, ic->xkb_variant);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -1,4 +1,3 @@
#include <wlr/util/log.h>
#include "log.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"

View file

@ -62,7 +62,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) {
return error;
}
if ((config->reading && argc > 1) || (!config->reading && argc == 1)) {
wlr_log(WLR_DEBUG, "Switching to mode `%s' (pango=%d)",
sway_log(SWAY_DEBUG, "Switching to mode `%s' (pango=%d)",
mode->name, mode->pango);
}
// Set current mode

View file

@ -6,7 +6,6 @@
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/util/log.h>
#include "sway/commands.h"
#include "sway/input/cursor.h"
#include "sway/input/seat.h"
@ -106,13 +105,13 @@ static void container_move_to_container_from_direction(
if (destination->view) {
if (destination->parent == container->parent &&
destination->workspace == container->workspace) {
wlr_log(WLR_DEBUG, "Swapping siblings");
sway_log(SWAY_DEBUG, "Swapping siblings");
list_t *siblings = container_get_siblings(container);
int container_index = list_find(siblings, container);
int destination_index = list_find(siblings, destination);
list_swap(siblings, container_index, destination_index);
} else {
wlr_log(WLR_DEBUG, "Promoting to sibling of cousin");
sway_log(SWAY_DEBUG, "Promoting to sibling of cousin");
int offset =
move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP;
int index = container_sibling_index(destination) + offset;
@ -128,7 +127,7 @@ static void container_move_to_container_from_direction(
}
if (is_parallel(destination->layout, move_dir)) {
wlr_log(WLR_DEBUG, "Reparenting container (parallel)");
sway_log(SWAY_DEBUG, "Reparenting container (parallel)");
int index =
move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ?
0 : destination->children->length;
@ -137,7 +136,7 @@ static void container_move_to_container_from_direction(
return;
}
wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)");
sway_log(SWAY_DEBUG, "Reparenting container (perpendicular)");
struct sway_node *focus_inactive = seat_get_active_tiling_child(
config->handler_context.seat, &destination->node);
if (!focus_inactive || focus_inactive == &destination->node) {
@ -157,7 +156,7 @@ static void container_move_to_workspace_from_direction(
container->width = container->height = 0;
if (is_parallel(workspace->layout, move_dir)) {
wlr_log(WLR_DEBUG, "Reparenting container (parallel)");
sway_log(SWAY_DEBUG, "Reparenting container (parallel)");
int index =
move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ?
0 : workspace->tiling->length;
@ -165,7 +164,7 @@ static void container_move_to_workspace_from_direction(
return;
}
wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)");
sway_log(SWAY_DEBUG, "Reparenting container (perpendicular)");
struct sway_container *focus_inactive = seat_get_focus_inactive_tiling(
config->handler_context.seat, workspace);
if (!focus_inactive) {
@ -362,7 +361,7 @@ static bool container_move_in_direction(struct sway_container *container,
container_move_to_workspace_from_direction(container, ws, move_dir);
return true;
}
wlr_log(WLR_DEBUG, "Hit edge of output, nowhere else to go");
sway_log(SWAY_DEBUG, "Hit edge of output, nowhere else to go");
return false;
}

View file

@ -28,7 +28,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
struct output_config *output = new_output_config(argv[0]);
if (!output) {
wlr_log(WLR_ERROR, "Failed to allocate output config");
sway_log(SWAY_ERROR, "Failed to allocate output config");
return NULL;
}
argc--; argv++;

View file

@ -79,7 +79,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
src = join_args(p.we_wordv, p.we_wordc);
wordfree(&p);
if (!src) {
wlr_log(WLR_ERROR, "Failed to duplicate string");
sway_log(SWAY_ERROR, "Failed to duplicate string");
return cmd_results_new(CMD_FAILURE, "Unable to allocate resource");
}
@ -88,7 +88,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
char *conf = strdup(config->current_config_path);
if (!conf) {
wlr_log(WLR_ERROR, "Failed to duplicate string");
sway_log(SWAY_ERROR, "Failed to duplicate string");
free(src);
return cmd_results_new(CMD_FAILURE,
"Unable to allocate resources");
@ -100,7 +100,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
if (!src) {
free(rel_path);
free(conf);
wlr_log(WLR_ERROR, "Unable to allocate memory");
sway_log(SWAY_ERROR, "Unable to allocate memory");
return cmd_results_new(CMD_FAILURE,
"Unable to allocate resources");
}
@ -112,7 +112,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
bool can_access = access(src, F_OK) != -1;
if (!can_access) {
wlr_log(WLR_ERROR, "Unable to access background file '%s': %s",
sway_log(SWAY_ERROR, "Unable to access background file '%s': %s",
src, strerror(errno));
config_add_swaynag_warning("Unable to access background file '%s'",
src);

View file

@ -23,7 +23,7 @@ static void do_reload(void *data) {
}
if (!load_main_config(config->current_config_path, true, false)) {
wlr_log(WLR_ERROR, "Error(s) reloading config");
sway_log(SWAY_ERROR, "Error(s) reloading config");
list_free_items_and_destroy(bar_ids);
return;
}

View file

@ -88,7 +88,7 @@ struct cmd_results *cmd_rename(int argc, char **argv) {
}
}
wlr_log(WLR_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name);
sway_log(SWAY_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name);
free(workspace->name);
workspace->name = new_name;

View file

@ -6,7 +6,6 @@
#include <string.h>
#include <strings.h>
#include <wlr/util/edges.h>
#include <wlr/util/log.h>
#include "sway/commands.h"
#include "sway/tree/arrange.h"
#include "sway/tree/view.h"

View file

@ -23,7 +23,7 @@ static void scratchpad_toggle_auto(void) {
// Check if the currently focused window is a scratchpad window and should
// be hidden again.
if (focus && focus->scratchpad) {
wlr_log(WLR_DEBUG, "Focus is a scratchpad window - hiding %s",
sway_log(SWAY_DEBUG, "Focus is a scratchpad window - hiding %s",
focus->title);
root_scratchpad_hide(focus);
return;
@ -34,7 +34,7 @@ static void scratchpad_toggle_auto(void) {
for (int i = 0; i < ws->floating->length; ++i) {
struct sway_container *floater = ws->floating->items[i];
if (floater->scratchpad && focus != floater) {
wlr_log(WLR_DEBUG,
sway_log(SWAY_DEBUG,
"Focusing other scratchpad window (%s) in this workspace",
floater->title);
root_scratchpad_show(floater);
@ -47,7 +47,7 @@ static void scratchpad_toggle_auto(void) {
for (int i = 0; i < root->scratchpad->length; ++i) {
struct sway_container *con = root->scratchpad->items[i];
if (con->parent) {
wlr_log(WLR_DEBUG,
sway_log(SWAY_DEBUG,
"Moving a visible scratchpad window (%s) to this workspace",
con->title);
root_scratchpad_show(con);
@ -60,7 +60,7 @@ static void scratchpad_toggle_auto(void) {
return;
}
struct sway_container *con = root->scratchpad->items[0];
wlr_log(WLR_DEBUG, "Showing %s from list", con->title);
sway_log(SWAY_DEBUG, "Showing %s from list", con->title);
root_scratchpad_show(con);
}

View file

@ -1,6 +1,5 @@
#define _POSIX_C_SOURCE 200809L
#include <strings.h>
#include <wlr/util/log.h>
#include "config.h"
#include "log.h"
#include "sway/commands.h"
@ -96,7 +95,7 @@ static void container_swap(struct sway_container *con1,
return;
}
wlr_log(WLR_DEBUG, "Swapping containers %zu and %zu",
sway_log(SWAY_DEBUG, "Swapping containers %zu and %zu",
con1->node.id, con2->node.id);
bool fs1 = con1->is_fullscreen;

View file

@ -15,7 +15,7 @@ struct cmd_results *cmd_swaybg_command(int argc, char **argv) {
char *new_command = join_args(argv, argc);
if (strcmp(new_command, "-") != 0) {
config->swaybg_command = new_command;
wlr_log(WLR_DEBUG, "Using custom swaybg command: %s",
sway_log(SWAY_DEBUG, "Using custom swaybg command: %s",
config->swaybg_command);
} else {
free(new_command);

View file

@ -15,7 +15,7 @@ struct cmd_results *cmd_swaynag_command(int argc, char **argv) {
char *new_command = join_args(argv, argc);
if (strcmp(new_command, "-") != 0) {
config->swaynag_command = new_command;
wlr_log(WLR_DEBUG, "Using custom swaynag command: %s",
sway_log(SWAY_DEBUG, "Using custom swaynag command: %s",
config->swaynag_command);
} else {
free(new_command);

View file

@ -13,7 +13,7 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) {
#ifdef HAVE_XWAYLAND
config->xwayland = parse_boolean(argv[0], config->xwayland);
#else
wlr_log(WLR_INFO, "Ignoring `xwayland` command, "
sway_log(SWAY_INFO, "Ignoring `xwayland` command, "
"sway hasn't been built with Xwayland support");
#endif