diff options
author | M Stoeckl <code@mstoeckl.com> | 2019-01-20 13:51:12 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-01-21 12:59:42 +0100 |
commit | 1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 (patch) | |
tree | 5c3f60e0219cb8b4a1b7cafb760a871661866e32 /sway | |
parent | 5c834d36e14aaeca4ac1d22b869254d5722af4af (diff) |
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.
Diffstat (limited to 'sway')
82 files changed, 353 insertions, 356 deletions
diff --git a/sway/commands.c b/sway/commands.c index 6f786035..f92a5e46 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -142,7 +142,7 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, int handlers_size) { struct cmd_handler d = { .command=line }; struct cmd_handler *res = NULL; - wlr_log(WLR_DEBUG, "find_handler(%s)", line); + sway_log(SWAY_DEBUG, "find_handler(%s)", line); bool config_loading = config->reading || !config->active; @@ -247,10 +247,10 @@ list_t *execute_command(char *_exec, struct sway_seat *seat, cmd = argsep(&cmdlist, ","); for (; isspace(*cmd); ++cmd) {} if (strcmp(cmd, "") == 0) { - wlr_log(WLR_INFO, "Ignoring empty command."); + sway_log(SWAY_INFO, "Ignoring empty command."); continue; } - wlr_log(WLR_INFO, "Handling command '%s'", cmd); + sway_log(SWAY_INFO, "Handling command '%s'", cmd); //TODO better handling of argv int argc; char **argv = split_args(cmd, &argc); @@ -353,7 +353,7 @@ struct cmd_results *config_command(char *exec, char **new_block) { } // Determine the command handler - wlr_log(WLR_INFO, "Config command: %s", exec); + sway_log(SWAY_INFO, "Config command: %s", exec); struct cmd_handler *handler = find_handler(argv[0], NULL, 0); if (!handler || !handler->handle) { const char *error = handler @@ -373,7 +373,7 @@ struct cmd_results *config_command(char *exec, char **new_block) { argv[1] = temp; } char *command = do_var_replacement(join_args(argv, argc)); - wlr_log(WLR_INFO, "After replacement: %s", command); + sway_log(SWAY_INFO, "After replacement: %s", command); free_argv(argc, argv); argv = split_args(command, &argc); free(command); @@ -402,7 +402,7 @@ cleanup: struct cmd_results *config_subcommand(char **argv, int argc, struct cmd_handler *handlers, size_t handlers_size) { char *command = join_args(argv, argc); - wlr_log(WLR_DEBUG, "Subcommand: %s", command); + sway_log(SWAY_DEBUG, "Subcommand: %s", command); free(command); struct cmd_handler *handler = find_handler(argv[0], handlers, @@ -489,7 +489,7 @@ struct cmd_results *config_commands_command(char *exec) { } policy->context = context; - wlr_log(WLR_INFO, "Set command policy for %s to %d", + sway_log(SWAY_INFO, "Set command policy for %s to %d", policy->command, policy->context); results = cmd_results_new(CMD_SUCCESS, NULL); @@ -503,7 +503,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status, const char *format, ...) { struct cmd_results *results = malloc(sizeof(struct cmd_results)); if (!results) { - wlr_log(WLR_ERROR, "Unable to allocate command results"); + sway_log(SWAY_ERROR, "Unable to allocate command results"); return NULL; } results->status = status; diff --git a/sway/commands/assign.c b/sway/commands/assign.c index 3bd1f65d..976bc3cc 100644 --- a/sway/commands/assign.c +++ b/sway/commands/assign.c @@ -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); diff --git a/sway/commands/bar.c b/sway/commands/bar.c index 2cfc538f..e9360603 100644 --- a/sway/commands/bar.c +++ b/sway/commands/bar.c @@ -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, diff --git a/sway/commands/bar/bind.c b/sway/commands/bar/bind.c index 4b0be804..17030a05 100644 --- a/sway/commands/bar/bind.c +++ b/sway/commands/bar/bind.c @@ -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" : ""); } diff --git a/sway/commands/bar/binding_mode_indicator.c b/sway/commands/bar/binding_mode_indicator.c index 15acc309..29c93ddc 100644 --- a/sway/commands/bar/binding_mode_indicator.c +++ b/sway/commands/bar/binding_mode_indicator.c @@ -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); diff --git a/sway/commands/bar/font.c b/sway/commands/bar/font.c index c6147e3d..cf1f759e 100644 --- a/sway/commands/bar/font.c +++ b/sway/commands/bar/font.c @@ -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); } diff --git a/sway/commands/bar/gaps.c b/sway/commands/bar/gaps.c index fabe12fc..83480fb5 100644 --- a/sway/commands/bar/gaps.c +++ b/sway/commands/bar/gaps.c @@ -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); diff --git a/sway/commands/bar/height.c b/sway/commands/bar/height.c index a2e72533..945eb707 100644 --- a/sway/commands/bar/height.c +++ b/sway/commands/bar/height.c @@ -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); } diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c index 3364ce70..b2c2d245 100644 --- a/sway/commands/bar/hidden_state.c +++ b/sway/commands/bar/hidden_state.c @@ -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 diff --git a/sway/commands/bar/icon_theme.c b/sway/commands/bar/icon_theme.c index 2d16f748..54b7b16e 100644 --- a/sway/commands/bar/icon_theme.c +++ b/sway/commands/bar/icon_theme.c @@ -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]); diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c index bef3023b..a9a61743 100644 --- a/sway/commands/bar/id.c +++ b/sway/commands/bar/id.c @@ -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); diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c index 1698db8d..d89ddf24 100644 --- a/sway/commands/bar/mode.c +++ b/sway/commands/bar/mode.c @@ -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 diff --git a/sway/commands/bar/modifier.c b/sway/commands/bar/modifier.c index 0d28d6a2..62ec681f 100644 --- a/sway/commands/bar/modifier.c +++ b/sway/commands/bar/modifier.c @@ -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); } diff --git a/sway/commands/bar/output.c b/sway/commands/bar/output.c index 9ad10678..956c1959 100644 --- a/sway/commands/bar/output.c +++ b/sway/commands/bar/output.c @@ -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); diff --git a/sway/commands/bar/pango_markup.c b/sway/commands/bar/pango_markup.c index 0ffa41d9..b0958cf1 100644 --- a/sway/commands/bar/pango_markup.c +++ b/sway/commands/bar/pango_markup.c @@ -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); diff --git a/sway/commands/bar/position.c b/sway/commands/bar/position.c index 2e3f79b4..4456d724 100644 --- a/sway/commands/bar/position.c +++ b/sway/commands/bar/position.c @@ -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]); diff --git a/sway/commands/bar/separator_symbol.c b/sway/commands/bar/separator_symbol.c index 145cdea5..76e99b49 100644 --- a/sway/commands/bar/separator_symbol.c +++ b/sway/commands/bar/separator_symbol.c @@ -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); } diff --git a/sway/commands/bar/status_command.c b/sway/commands/bar/status_command.c index c379cc72..0b58e5fa 100644 --- a/sway/commands/bar/status_command.c +++ b/sway/commands/bar/status_command.c @@ -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); diff --git a/sway/commands/bar/status_edge_padding.c b/sway/commands/bar/status_edge_padding.c index 565ab9a9..75ef86f0 100644 --- a/sway/commands/bar/status_edge_padding.c +++ b/sway/commands/bar/status_edge_padding.c @@ -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); } diff --git a/sway/commands/bar/status_padding.c b/sway/commands/bar/status_padding.c index 7a69a25d..0c65e516 100644 --- a/sway/commands/bar/status_padding.c +++ b/sway/commands/bar/status_padding.c @@ -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); } diff --git a/sway/commands/bar/strip_workspace_name.c b/sway/commands/bar/strip_workspace_name.c index b74afd6e..1aa39359 100644 --- a/sway/commands/bar/strip_workspace_name.c +++ b/sway/commands/bar/strip_workspace_name.c @@ -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); } diff --git a/sway/commands/bar/strip_workspace_numbers.c b/sway/commands/bar/strip_workspace_numbers.c index 9c6ec228..56c4c4a1 100644 --- a/sway/commands/bar/strip_workspace_numbers.c +++ b/sway/commands/bar/strip_workspace_numbers.c @@ -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); } diff --git a/sway/commands/bar/swaybar_command.c b/sway/commands/bar/swaybar_command.c index 6253e2b1..b54bafa9 100644 --- a/sway/commands/bar/swaybar_command.c +++ b/sway/commands/bar/swaybar_command.c @@ -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); } diff --git a/sway/commands/bar/tray_bind.c b/sway/commands/bar/tray_bind.c index 48a15462..7fe67c42 100644 --- a/sway/commands/bar/tray_bind.c +++ b/sway/commands/bar/tray_bind.c @@ -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); } diff --git a/sway/commands/bar/tray_output.c b/sway/commands/bar/tray_output.c index d45c09c6..16e16f60 100644 --- a/sway/commands/bar/tray_output.c +++ b/sway/commands/bar/tray_output.c @@ -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])); diff --git a/sway/commands/bar/tray_padding.c b/sway/commands/bar/tray_padding.c index 1e8b294b..f43cfe4f 100644 --- a/sway/commands/bar/tray_padding.c +++ b/sway/commands/bar/tray_padding.c @@ -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 diff --git a/sway/commands/bar/workspace_buttons.c b/sway/commands/bar/workspace_buttons.c index 773e6357..792ef605 100644 --- a/sway/commands/bar/workspace_buttons.c +++ b/sway/commands/bar/workspace_buttons.c @@ -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); diff --git a/sway/commands/bar/wrap_scroll.c b/sway/commands/bar/wrap_scroll.c index 2f7bb090..decd238d 100644 --- a/sway/commands/bar/wrap_scroll.c +++ b/sway/commands/bar/wrap_scroll.c @@ -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); diff --git a/sway/commands/bind.c b/sway/commands/bind.c index b0493f7e..ce087fd0 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -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; } diff --git a/sway/commands/client.c b/sway/commands/client.c index 10bfa519..f5c7d90f 100644 --- a/sway/commands/client.c +++ b/sway/commands/client.c @@ -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); } diff --git a/sway/commands/exec.c b/sway/commands/exec.c index dc8d8aac..87d90716 100644 --- a/sway/commands/exec.c +++ b/sway/commands/exec.c @@ -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); } diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 1ed6c7e6..a5724295 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -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"); diff --git a/sway/commands/floating_minmax_size.c b/sway/commands/floating_minmax_size.c index 31c1e999..3a1d606a 100644 --- a/sway/commands/floating_minmax_size.c +++ b/sway/commands/floating_minmax_size.c @@ -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" diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 8564f3ff..e7680062 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -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" diff --git a/sway/commands/for_window.c b/sway/commands/for_window.c index f151575e..63cba099 100644 --- a/sway/commands/for_window.c +++ b/sway/commands/for_window.c @@ -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); } diff --git a/sway/commands/input.c b/sway/commands/input.c index 1f77507a..b72bd76b 100644 --- a/sway/commands/input.c +++ b/sway/commands/input.c @@ -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) { diff --git a/sway/commands/input/xkb_layout.c b/sway/commands/input/xkb_layout.c index c9200aa2..0879e2da 100644 --- a/sway/commands/input/xkb_layout.c +++ b/sway/commands/input/xkb_layout.c @@ -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); } diff --git a/sway/commands/input/xkb_model.c b/sway/commands/input/xkb_model.c index 763ae80e..9e384156 100644 --- a/sway/commands/input/xkb_model.c +++ b/sway/commands/input/xkb_model.c @@ -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); } diff --git a/sway/commands/input/xkb_options.c b/sway/commands/input/xkb_options.c index 1ff6e680..8197dd1d 100644 --- a/sway/commands/input/xkb_options.c +++ b/sway/commands/input/xkb_options.c @@ -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); } diff --git a/sway/commands/input/xkb_rules.c b/sway/commands/input/xkb_rules.c index 29172b24..01ccd06f 100644 --- a/sway/commands/input/xkb_rules.c +++ b/sway/commands/input/xkb_rules.c @@ -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); } diff --git a/sway/commands/input/xkb_variant.c b/sway/commands/input/xkb_variant.c index 9f3baed6..37c82fbd 100644 --- a/sway/commands/input/xkb_variant.c +++ b/sway/commands/input/xkb_variant.c @@ -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); } diff --git a/sway/commands/kill.c b/sway/commands/kill.c index 41daeb4e..f1e95e4b 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c @@ -1,4 +1,3 @@ -#include <wlr/util/log.h> #include "log.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" diff --git a/sway/commands/mode.c b/sway/commands/mode.c index 828d77e1..d424eb1c 100644 --- a/sway/commands/mode.c +++ b/sway/commands/mode.c @@ -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 diff --git a/sway/commands/move.c b/sway/commands/move.c index d4b55922..b22bb056 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -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; } diff --git a/sway/commands/output.c b/sway/commands/output.c index 73dbb723..74ca9d0b 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -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++; diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index 00038e67..affa04ea 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c @@ -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); diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 6e7772e9..19ec065c 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -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; } diff --git a/sway/commands/rename.c b/sway/commands/rename.c index a68302c4..88377b09 100644 --- a/sway/commands/rename.c +++ b/sway/commands/rename.c @@ -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; diff --git a/sway/commands/resize.c b/sway/commands/resize.c index c88d2734..0e497239 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c @@ -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" diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c index 1162d51f..805dbc0b 100644 --- a/sway/commands/scratchpad.c +++ b/sway/commands/scratchpad.c @@ -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); } diff --git a/sway/commands/swap.c b/sway/commands/swap.c index a8beb162..0d8d1116 100644 --- a/sway/commands/swap.c +++ b/sway/commands/swap.c @@ -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; diff --git a/sway/commands/swaybg_command.c b/sway/commands/swaybg_command.c index 91294bf4..92e9bdfd 100644 --- a/sway/commands/swaybg_command.c +++ b/sway/commands/swaybg_command.c @@ -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); diff --git a/sway/commands/swaynag_command.c b/sway/commands/swaynag_command.c index b420f311..f851d223 100644 --- a/sway/commands/swaynag_command.c +++ b/sway/commands/swaynag_command.c @@ -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); diff --git a/sway/commands/xwayland.c b/sway/commands/xwayland.c index c3f73f67..b72f3239 100644 --- a/sway/commands/xwayland.c +++ b/sway/commands/xwayland.c @@ -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 diff --git a/sway/config.c b/sway/config.c index d5d36306..145b3be6 100644 --- a/sway/config.c +++ b/sway/config.c @@ -335,11 +335,11 @@ static char *get_config_path(void) { static bool load_config(const char *path, struct sway_config *config, struct swaynag_instance *swaynag) { if (path == NULL) { - wlr_log(WLR_ERROR, "Unable to find a config file!"); + sway_log(SWAY_ERROR, "Unable to find a config file!"); return false; } - wlr_log(WLR_INFO, "Loading config from %s", path); + sway_log(SWAY_INFO, "Loading config from %s", path); struct stat sb; if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { @@ -348,7 +348,7 @@ static bool load_config(const char *path, struct sway_config *config, FILE *f = fopen(path, "r"); if (!f) { - wlr_log(WLR_ERROR, "Unable to open %s for reading", path); + sway_log(SWAY_ERROR, "Unable to open %s for reading", path); return false; } @@ -356,7 +356,7 @@ static bool load_config(const char *path, struct sway_config *config, fclose(f); if (!config_load_success) { - wlr_log(WLR_ERROR, "Error(s) loading config!"); + sway_log(SWAY_ERROR, "Error(s) loading config!"); } return true; @@ -379,7 +379,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { config_defaults(config); config->validating = validating; if (is_active) { - wlr_log(WLR_DEBUG, "Performing configuration file %s", + sway_log(SWAY_DEBUG, "Performing configuration file %s", validating ? "validation" : "reload"); config->reloading = true; config->active = true; @@ -403,7 +403,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { /* DIR *dir = opendir(SYSCONFDIR "/sway/security.d"); if (!dir) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "%s does not exist, sway will have no security configuration" " and will probably be broken", SYSCONFDIR "/sway/security.d"); } else { @@ -432,7 +432,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || (((s.st_mode & 0777) != 0644) && (s.st_mode & 0777) != 0444)) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "Refusing to load %s - it must be owned by root " "and mode 644 or 444", _path); success = false; @@ -488,7 +488,7 @@ static bool load_include_config(const char *path, const char *parent_dir, len = len + strlen(parent_dir) + 2; full_path = malloc(len * sizeof(char)); if (!full_path) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "Unable to allocate full path to included config"); return false; } @@ -501,7 +501,7 @@ static bool load_include_config(const char *path, const char *parent_dir, free(full_path); if (real_path == NULL) { - wlr_log(WLR_DEBUG, "%s not found.", path); + sway_log(SWAY_DEBUG, "%s not found.", path); return false; } @@ -510,7 +510,7 @@ static bool load_include_config(const char *path, const char *parent_dir, for (j = 0; j < config->config_chain->length; ++j) { char *old_path = config->config_chain->items[j]; if (strcmp(real_path, old_path) == 0) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "%s already included once, won't be included again.", real_path); free(real_path); @@ -565,7 +565,7 @@ bool load_include_configs(const char *path, struct sway_config *config, // restore wd if (chdir(wd) < 0) { free(wd); - wlr_log(WLR_ERROR, "failed to restore working directory"); + sway_log(SWAY_ERROR, "failed to restore working directory"); return false; } @@ -630,7 +630,7 @@ static char *expand_line(const char *block, const char *line, bool add_brace) { + (add_brace ? 2 : 0) + 1; char *expanded = calloc(1, size); if (!expanded) { - wlr_log(WLR_ERROR, "Cannot allocate expanded line buffer"); + sway_log(SWAY_ERROR, "Cannot allocate expanded line buffer"); return NULL; } snprintf(expanded, size, "%s%s%s%s", block ? block : "", @@ -649,7 +649,7 @@ bool read_config(FILE *file, struct sway_config *config, int ret_seek = fseek(file, 0, SEEK_END); long ret_tell = ftell(file); if (ret_seek == -1 || ret_tell == -1) { - wlr_log(WLR_ERROR, "Unable to get size of config file"); + sway_log(SWAY_ERROR, "Unable to get size of config file"); return false; } config_size = ret_tell; @@ -657,7 +657,7 @@ bool read_config(FILE *file, struct sway_config *config, config->current_config = this_config = calloc(1, config_size + 1); if (this_config == NULL) { - wlr_log(WLR_ERROR, "Unable to allocate buffer for config contents"); + sway_log(SWAY_ERROR, "Unable to allocate buffer for config contents"); return false; } } @@ -673,7 +673,7 @@ bool read_config(FILE *file, struct sway_config *config, while ((nread = getline_with_cont(&line, &line_size, file, &nlines)) != -1) { if (reading_main_config) { if (read + nread > config_size) { - wlr_log(WLR_ERROR, "Config file changed during reading"); + sway_log(SWAY_ERROR, "Config file changed during reading"); success = false; break; } @@ -687,7 +687,7 @@ bool read_config(FILE *file, struct sway_config *config, } line_number += nlines; - wlr_log(WLR_DEBUG, "Read line %d: %s", line_number, line); + sway_log(SWAY_DEBUG, "Read line %d: %s", line_number, line); strip_whitespace(line); if (!*line || line[0] == '#') { @@ -698,7 +698,7 @@ bool read_config(FILE *file, struct sway_config *config, brace_detected = detect_brace(file); if (brace_detected > 0) { line_number += brace_detected; - wlr_log(WLR_DEBUG, "Detected open brace on line %d", line_number); + sway_log(SWAY_DEBUG, "Detected open brace on line %d", line_number); } } char *block = stack->length ? stack->items[0] : NULL; @@ -720,7 +720,7 @@ bool read_config(FILE *file, struct sway_config *config, switch(res->status) { case CMD_FAILURE: case CMD_INVALID: - wlr_log(WLR_ERROR, "Error on line %i '%s': %s (%s)", line_number, + sway_log(SWAY_ERROR, "Error on line %i '%s': %s (%s)", line_number, line, res->error, config->current_config_path); if (!config->validating) { swaynag_log(config->swaynag_command, swaynag, @@ -731,17 +731,17 @@ bool read_config(FILE *file, struct sway_config *config, break; case CMD_DEFER: - wlr_log(WLR_DEBUG, "Deferring command `%s'", line); + sway_log(SWAY_DEBUG, "Deferring command `%s'", line); list_add(config->cmd_queue, strdup(expanded)); break; case CMD_BLOCK_COMMANDS: - wlr_log(WLR_DEBUG, "Entering commands block"); + sway_log(SWAY_DEBUG, "Entering commands block"); list_insert(stack, 0, "<commands>"); break; case CMD_BLOCK: - wlr_log(WLR_DEBUG, "Entering block '%s'", new_block); + sway_log(SWAY_DEBUG, "Entering block '%s'", new_block); list_insert(stack, 0, strdup(new_block)); if (strcmp(new_block, "bar") == 0) { config->current_bar = NULL; @@ -750,7 +750,7 @@ bool read_config(FILE *file, struct sway_config *config, case CMD_BLOCK_END: if (!block) { - wlr_log(WLR_DEBUG, "Unmatched '}' on line %i", line_number); + sway_log(SWAY_DEBUG, "Unmatched '}' on line %i", line_number); success = false; break; } @@ -758,7 +758,7 @@ bool read_config(FILE *file, struct sway_config *config, config->current_bar = NULL; } - wlr_log(WLR_DEBUG, "Exiting block '%s'", block); + sway_log(SWAY_DEBUG, "Exiting block '%s'", block); list_del(stack, 0); free(block); memset(&config->handler_context, 0, @@ -786,7 +786,7 @@ void config_add_swaynag_warning(char *fmt, ...) { char *temp = malloc(length + 1); if (!temp) { - wlr_log(WLR_ERROR, "Failed to allocate buffer for warning."); + sway_log(SWAY_ERROR, "Failed to allocate buffer for warning."); return; } @@ -828,7 +828,7 @@ char *do_var_replacement(char *str) { int vvlen = strlen(var->value); char *newstr = malloc(strlen(str) - vnlen + vvlen + 1); if (!newstr) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "Unable to allocate replacement " "during variable expansion"); break; diff --git a/sway/config/bar.c b/sway/config/bar.c index b1aa2313..0fdac5d8 100644 --- a/sway/config/bar.c +++ b/sway/config/bar.c @@ -19,10 +19,10 @@ #include "util.h" static void terminate_swaybar(pid_t pid) { - wlr_log(WLR_DEBUG, "Terminating swaybar %d", pid); + sway_log(SWAY_DEBUG, "Terminating swaybar %d", pid); int ret = kill(-pid, SIGTERM); if (ret != 0) { - wlr_log_errno(WLR_ERROR, "Unable to terminate swaybar %d", pid); + sway_log_errno(SWAY_ERROR, "Unable to terminate swaybar %d", pid); } else { int status; waitpid(pid, &status, 0); @@ -194,7 +194,7 @@ static void invoke_swaybar(struct bar_config *bar) { // Pipe to communicate errors int filedes[2]; if (pipe(filedes) == -1) { - wlr_log(WLR_ERROR, "Pipe setup failed! Cannot fork into bar"); + sway_log(SWAY_ERROR, "Pipe setup failed! Cannot fork into bar"); return; } @@ -227,17 +227,17 @@ static void invoke_swaybar(struct bar_config *bar) { execvp(cmd[0], cmd); exit(1); } - wlr_log(WLR_DEBUG, "Spawned swaybar %d", bar->pid); + sway_log(SWAY_DEBUG, "Spawned swaybar %d", bar->pid); close(filedes[0]); size_t len; if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) { char *buf = malloc(len); if(!buf) { - wlr_log(WLR_ERROR, "Cannot allocate error string"); + sway_log(SWAY_ERROR, "Cannot allocate error string"); return; } if (read(filedes[1], buf, len)) { - wlr_log(WLR_ERROR, "%s", buf); + sway_log(SWAY_ERROR, "%s", buf); } free(buf); } @@ -248,7 +248,7 @@ void load_swaybar(struct bar_config *bar) { if (bar->pid != 0) { terminate_swaybar(bar->pid); } - wlr_log(WLR_DEBUG, "Invoking swaybar for bar id '%s'", bar->id); + sway_log(SWAY_DEBUG, "Invoking swaybar for bar id '%s'", bar->id); invoke_swaybar(bar); } diff --git a/sway/config/input.c b/sway/config/input.c index d649d34d..63c28635 100644 --- a/sway/config/input.c +++ b/sway/config/input.c @@ -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; } diff --git a/sway/config/output.c b/sway/config/output.c index 8f59c863..ec833ffe 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -91,7 +91,7 @@ static void merge_wildcard_on_all(struct output_config *wildcard) { for (int i = 0; i < config->output_configs->length; i++) { struct output_config *oc = config->output_configs->items[i]; if (strcmp(wildcard->name, oc->name) != 0) { - wlr_log(WLR_DEBUG, "Merging output * config on %s", oc->name); + sway_log(SWAY_DEBUG, "Merging output * config on %s", oc->name); merge_output_config(oc, wildcard); } } @@ -105,16 +105,16 @@ struct output_config *store_output_config(struct output_config *oc) { int i = list_seq_find(config->output_configs, output_name_cmp, oc->name); if (i >= 0) { - wlr_log(WLR_DEBUG, "Merging on top of existing output config"); + sway_log(SWAY_DEBUG, "Merging on top of existing output config"); struct output_config *current = config->output_configs->items[i]; merge_output_config(current, oc); free_output_config(oc); oc = current; } else if (!wildcard) { - wlr_log(WLR_DEBUG, "Adding non-wildcard output config"); + sway_log(SWAY_DEBUG, "Adding non-wildcard output config"); i = list_seq_find(config->output_configs, output_name_cmp, "*"); if (i >= 0) { - wlr_log(WLR_DEBUG, "Merging on top of output * config"); + sway_log(SWAY_DEBUG, "Merging on top of output * config"); struct output_config *current = new_output_config(oc->name); merge_output_config(current, config->output_configs->items[i]); merge_output_config(current, oc); @@ -124,11 +124,11 @@ struct output_config *store_output_config(struct output_config *oc) { list_add(config->output_configs, oc); } else { // New wildcard config. Just add it - wlr_log(WLR_DEBUG, "Adding output * config"); + sway_log(SWAY_DEBUG, "Adding output * config"); list_add(config->output_configs, oc); } - wlr_log(WLR_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " + sway_log(SWAY_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " "position %d,%d scale %f transform %d) (bg %s %s) (dpms %d)", oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate, oc->x, oc->y, oc->scale, oc->transform, oc->background, @@ -141,7 +141,7 @@ static bool set_mode(struct wlr_output *output, int width, int height, float refresh_rate) { int mhz = (int)(refresh_rate * 1000); if (wl_list_empty(&output->modes)) { - wlr_log(WLR_DEBUG, "Assigning custom mode to %s", output->name); + sway_log(SWAY_DEBUG, "Assigning custom mode to %s", output->name); return wlr_output_set_custom_mode(output, width, height, mhz); } @@ -156,11 +156,11 @@ static bool set_mode(struct wlr_output *output, int width, int height, } } if (!best) { - wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name); - wlr_log(WLR_INFO, "Picking default mode instead"); + sway_log(SWAY_ERROR, "Configured mode for %s not available", output->name); + sway_log(SWAY_INFO, "Picking default mode instead"); best = wl_container_of(output->modes.prev, mode, link); } else { - wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name); + sway_log(SWAY_DEBUG, "Assigning configured mode to %s", output->name); } return wlr_output_set_mode(output, best); } @@ -168,7 +168,7 @@ static bool set_mode(struct wlr_output *output, int width, int height, void terminate_swaybg(pid_t pid) { int ret = kill(pid, SIGTERM); if (ret != 0) { - wlr_log(WLR_ERROR, "Unable to terminate swaybg [pid: %d]", pid); + sway_log(SWAY_ERROR, "Unable to terminate swaybg [pid: %d]", pid); } else { int status; waitpid(pid, &status, 0); @@ -197,7 +197,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { bool modeset_success; if (oc && oc->width > 0 && oc->height > 0) { - wlr_log(WLR_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, + sway_log(SWAY_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, oc->height, oc->refresh_rate); modeset_success = set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); @@ -213,22 +213,22 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { // Failed to modeset, maybe the output is missing a CRTC. Leave the // output disabled for now and try again when the output gets the mode // we asked for. - wlr_log(WLR_ERROR, "Failed to modeset output %s", wlr_output->name); + sway_log(SWAY_ERROR, "Failed to modeset output %s", wlr_output->name); return false; } if (oc && oc->scale > 0) { - wlr_log(WLR_DEBUG, "Set %s scale to %f", oc->name, oc->scale); + sway_log(SWAY_DEBUG, "Set %s scale to %f", oc->name, oc->scale); wlr_output_set_scale(wlr_output, oc->scale); } if (oc && oc->transform >= 0) { - wlr_log(WLR_DEBUG, "Set %s transform to %d", oc->name, oc->transform); + sway_log(SWAY_DEBUG, "Set %s transform to %d", oc->name, oc->transform); wlr_output_set_transform(wlr_output, oc->transform); } // Find position for it if (oc && (oc->x != -1 || oc->y != -1)) { - wlr_log(WLR_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); + sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); wlr_output_layout_add(root->output_layout, wlr_output, oc->x, oc->y); } else { wlr_output_layout_add_auto(root->output_layout, wlr_output); @@ -238,7 +238,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { terminate_swaybg(output->bg_pid); } if (oc && oc->background && config->swaybg_command) { - wlr_log(WLR_DEBUG, "Setting background for output %s to %s", + sway_log(SWAY_DEBUG, "Setting background for output %s to %s", wlr_output->name, oc->background); char *const cmd[] = { @@ -252,21 +252,21 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { output->bg_pid = fork(); if (output->bg_pid < 0) { - wlr_log_errno(WLR_ERROR, "fork failed"); + sway_log_errno(SWAY_ERROR, "fork failed"); } else if (output->bg_pid == 0) { execvp(cmd[0], cmd); - wlr_log_errno(WLR_ERROR, "Failed to execute swaybg"); + sway_log_errno(SWAY_ERROR, "Failed to execute swaybg"); } } if (oc) { switch (oc->dpms_state) { case DPMS_ON: - wlr_log(WLR_DEBUG, "Turning on screen"); + sway_log(SWAY_DEBUG, "Turning on screen"); wlr_output_enable(wlr_output, true); break; case DPMS_OFF: - wlr_log(WLR_DEBUG, "Turning off screen"); + sway_log(SWAY_DEBUG, "Turning off screen"); wlr_output_enable(wlr_output, false); break; case DPMS_IGNORE: @@ -325,7 +325,7 @@ static struct output_config *get_output_config(char *identifier, merge_output_config(result, oc_name); merge_output_config(result, oc_id); - wlr_log(WLR_DEBUG, "Generated output config \"%s\" (enabled: %d)" + sway_log(SWAY_DEBUG, "Generated output config \"%s\" (enabled: %d)" " (%dx%d@%fHz position %d,%d scale %f transform %d) (bg %s %s)" " (dpms %d)", result->name, result->enabled, result->width, result->height, result->refresh_rate, result->x, result->y, diff --git a/sway/config/seat.c b/sway/config/seat.c index d7316c68..92dc42e3 100644 --- a/sway/config/seat.c +++ b/sway/config/seat.c @@ -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; diff --git a/sway/criteria.c b/sway/criteria.c index 54583b04..59a923f9 100644 --- a/sway/criteria.c +++ b/sway/criteria.c @@ -626,7 +626,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) { } unescape(value); } - wlr_log(WLR_DEBUG, "Found pair: %s=%s", name, value); + sway_log(SWAY_DEBUG, "Found pair: %s=%s", name, value); if (!parse_token(criteria, name, value)) { *error_arg = error; goto cleanup; diff --git a/sway/debug-tree.c b/sway/debug-tree.c index b3266241..0444bb3f 100644 --- a/sway/debug-tree.c +++ b/sway/debug-tree.c @@ -1,7 +1,6 @@ #include <pango/pangocairo.h> #include <wlr/backend.h> #include <wlr/render/wlr_texture.h> -#include <wlr/util/log.h> #include "config.h" #include "sway/debug.h" #include "sway/input/input-manager.h" diff --git a/sway/desktop/idle_inhibit_v1.c b/sway/desktop/idle_inhibit_v1.c index 17d4242b..87b4ef43 100644 --- a/sway/desktop/idle_inhibit_v1.c +++ b/sway/desktop/idle_inhibit_v1.c @@ -9,7 +9,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { struct sway_idle_inhibitor_v1 *inhibitor = wl_container_of(listener, inhibitor, destroy); - wlr_log(WLR_DEBUG, "Sway idle inhibitor destroyed"); + sway_log(SWAY_DEBUG, "Sway idle inhibitor destroyed"); wl_list_remove(&inhibitor->link); wl_list_remove(&inhibitor->destroy.link); idle_inhibit_v1_check_active(inhibitor->manager); @@ -20,7 +20,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data) { struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data; struct sway_idle_inhibit_manager_v1 *manager = wl_container_of(listener, manager, new_idle_inhibitor_v1); - wlr_log(WLR_DEBUG, "New sway idle inhibitor"); + sway_log(SWAY_DEBUG, "New sway idle inhibitor"); struct sway_idle_inhibitor_v1 *inhibitor = calloc(1, sizeof(struct sway_idle_inhibitor_v1)); diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index ab05778d..a870bb9a 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -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); diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 646b6d70..edf77fbc 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -510,7 +510,7 @@ static void handle_mode(struct wl_listener *listener, void *data) { // We want to enable this output, but it didn't work last time, // possibly because we hadn't enough CRTCs. Try again now that the // output has a mode. - wlr_log(WLR_DEBUG, "Output %s has gained a CRTC, " + sway_log(SWAY_DEBUG, "Output %s has gained a CRTC, " "trying to enable it", output->wlr_output->name); apply_output_config(oc, output); } @@ -580,7 +580,7 @@ static void handle_present(struct wl_listener *listener, void *data) { void handle_new_output(struct wl_listener *listener, void *data) { struct sway_server *server = wl_container_of(listener, server, new_output); struct wlr_output *wlr_output = data; - wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); + sway_log(SWAY_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); struct sway_output *output = output_create(wlr_output); if (!output) { diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 1cdd7c6d..55cf1c5e 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -260,14 +260,14 @@ static void apply_container_state(struct sway_container *container, * Apply a transaction to the "current" state of the tree. */ static void transaction_apply(struct sway_transaction *transaction) { - wlr_log(WLR_DEBUG, "Applying transaction %p", transaction); + sway_log(SWAY_DEBUG, "Applying transaction %p", transaction); if (debug.txn_timings) { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); struct timespec *commit = &transaction->commit_time; float ms = (now.tv_sec - commit->tv_sec) * 1000 + (now.tv_nsec - commit->tv_nsec) / 1000000.0; - wlr_log(WLR_DEBUG, "Transaction %p: %.1fms waiting " + sway_log(SWAY_DEBUG, "Transaction %p: %.1fms waiting " "(%.1f frames if 60Hz)", transaction, ms, ms / (1000.0f / 60)); } @@ -363,7 +363,7 @@ static void transaction_progress_queue(void) { static int handle_timeout(void *data) { struct sway_transaction *transaction = data; - wlr_log(WLR_DEBUG, "Transaction %p timed out (%zi waiting)", + sway_log(SWAY_DEBUG, "Transaction %p timed out (%zi waiting)", transaction, transaction->num_waiting); transaction->num_waiting = 0; transaction_progress_queue(); @@ -398,7 +398,7 @@ static bool should_configure(struct sway_node *node, } static void transaction_commit(struct sway_transaction *transaction) { - wlr_log(WLR_DEBUG, "Transaction %p committing with %i instructions", + sway_log(SWAY_DEBUG, "Transaction %p committing with %i instructions", transaction, transaction->instructions->length); transaction->num_waiting = 0; for (int i = 0; i < transaction->instructions->length; ++i) { @@ -449,7 +449,7 @@ static void transaction_commit(struct sway_transaction *transaction) { wl_event_source_timer_update(transaction->timer, server.txn_timeout_ms); } else { - wlr_log(WLR_ERROR, "Unable to create transaction timer (%s). " + sway_log(SWAY_ERROR, "Unable to create transaction timer (%s). " "Some imperfect frames might be rendered.", strerror(errno)); transaction->num_waiting = 0; @@ -472,7 +472,7 @@ static void set_instruction_ready( struct timespec *start = &transaction->commit_time; float ms = (now.tv_sec - start->tv_sec) * 1000 + (now.tv_nsec - start->tv_nsec) / 1000000.0; - wlr_log(WLR_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)", + sway_log(SWAY_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)", transaction, transaction->num_configures - transaction->num_waiting + 1, transaction->num_configures, ms, @@ -481,7 +481,7 @@ static void set_instruction_ready( // If the transaction has timed out then its num_waiting will be 0 already. if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { - wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction); + sway_log(SWAY_DEBUG, "Transaction %p is ready", transaction); wl_event_source_timer_update(transaction->timer, 0); } diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 7da86136..b4ac3a68 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -485,11 +485,11 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { struct wlr_xdg_surface *xdg_surface = data; if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { - wlr_log(WLR_DEBUG, "New xdg_shell popup"); + sway_log(SWAY_DEBUG, "New xdg_shell popup"); return; } - wlr_log(WLR_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", + sway_log(SWAY_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); wlr_xdg_surface_ping(xdg_surface); diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 9f6741c8..553d532d 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -469,11 +469,11 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { struct wlr_xdg_surface_v6 *xdg_surface = data; if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { - wlr_log(WLR_DEBUG, "New xdg_shell_v6 popup"); + sway_log(SWAY_DEBUG, "New xdg_shell_v6 popup"); return; } - wlr_log(WLR_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", + sway_log(SWAY_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); wlr_xdg_surface_v6_ping(xdg_surface); diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 080f6c41..8dcf4bd6 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -118,7 +118,7 @@ static struct sway_xwayland_unmanaged *create_unmanaged( struct sway_xwayland_unmanaged *surface = calloc(1, sizeof(struct sway_xwayland_unmanaged)); if (surface == NULL) { - wlr_log(WLR_ERROR, "Allocation failed"); + sway_log(SWAY_ERROR, "Allocation failed"); return NULL; } @@ -578,12 +578,12 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { struct wlr_xwayland_surface *xsurface = data; if (xsurface->override_redirect) { - wlr_log(WLR_DEBUG, "New xwayland unmanaged surface"); + sway_log(SWAY_DEBUG, "New xwayland unmanaged surface"); create_unmanaged(xsurface); return; } - wlr_log(WLR_DEBUG, "New xwayland surface title='%s' class='%s'", + sway_log(SWAY_DEBUG, "New xwayland surface title='%s' class='%s'", xsurface->title, xsurface->class); struct sway_xwayland_view *xwayland_view = @@ -655,7 +655,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) { xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL); int err = xcb_connection_has_error(xcb_conn); if (err) { - wlr_log(WLR_ERROR, "XCB connect failed: %d", err); + sway_log(SWAY_ERROR, "XCB connect failed: %d", err); return; } @@ -674,7 +674,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) { free(reply); if (error != NULL) { - wlr_log(WLR_ERROR, "could not resolve atom %s, X11 error code %d", + sway_log(SWAY_ERROR, "could not resolve atom %s, X11 error code %d", atom_map[i], error->error_code); free(error); break; diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 35683f06..bf9bf2da 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -713,7 +713,7 @@ static uint32_t wl_axis_to_button(struct wlr_event_pointer_axis *event) { case WLR_AXIS_ORIENTATION_HORIZONTAL: return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT; default: - wlr_log(WLR_DEBUG, "Unknown axis orientation"); + sway_log(SWAY_DEBUG, "Unknown axis orientation"); return 0; } } @@ -1004,7 +1004,7 @@ static void handle_request_set_cursor(struct wl_listener *listener, // TODO: check cursor mode if (focused_client == NULL || event->seat_client->client != focused_client) { - wlr_log(WLR_DEBUG, "denying request to set cursor from unfocused client"); + sway_log(SWAY_DEBUG, "denying request to set cursor from unfocused client"); return; } diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 9fff5f48..2b4a99d4 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -62,7 +62,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) { int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1; char *identifier = malloc(len); if (!identifier) { - wlr_log(WLR_ERROR, "Unable to allocate unique input device name"); + sway_log(SWAY_ERROR, "Unable to allocate unique input device name"); return NULL; } @@ -98,7 +98,7 @@ static bool input_has_seat_fallback_configuration(void) { void input_manager_verify_fallback_seat(void) { struct sway_seat *seat = NULL; if (!input_has_seat_fallback_configuration()) { - wlr_log(WLR_DEBUG, "no fallback seat config - creating default"); + sway_log(SWAY_DEBUG, "no fallback seat config - creating default"); seat = input_manager_get_default_seat(); struct seat_config *sc = new_seat_config(seat->wlr_seat->name); sc->fallback = true; @@ -124,11 +124,11 @@ static void input_manager_libinput_config_keyboard( } libinput_device = wlr_libinput_get_device_handle(wlr_device); - wlr_log(WLR_DEBUG, "input_manager_libinput_config_keyboard(%s)", + sway_log(SWAY_DEBUG, "input_manager_libinput_config_keyboard(%s)", ic->identifier); if (ic->send_events != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_keyboard(%s) send_events_set_mode(%d)", + sway_log(SWAY_DEBUG, "libinput_config_keyboard(%s) send_events_set_mode(%d)", ic->identifier, ic->send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, ic->send_events)); @@ -148,7 +148,7 @@ static void input_manager_libinput_reset_keyboard( uint32_t send_events = libinput_device_config_send_events_get_default_mode(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_keyboard(%s) send_events_set_mode(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_keyboard(%s) send_events_set_mode(%d)", input_device->identifier, send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, send_events)); @@ -165,11 +165,11 @@ static void input_manager_libinput_config_touch( } libinput_device = wlr_libinput_get_device_handle(wlr_device); - wlr_log(WLR_DEBUG, "input_manager_libinput_config_touch(%s)", + sway_log(SWAY_DEBUG, "input_manager_libinput_config_touch(%s)", ic->identifier); if (ic->send_events != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_touch(%s) send_events_set_mode(%d)", + sway_log(SWAY_DEBUG, "libinput_config_touch(%s) send_events_set_mode(%d)", ic->identifier, ic->send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, ic->send_events)); @@ -189,7 +189,7 @@ static void input_manager_libinput_reset_touch( uint32_t send_events = libinput_device_config_send_events_get_default_mode(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_touch(%s) send_events_set_mode(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) send_events_set_mode(%d)", input_device->identifier, send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, send_events)); @@ -206,30 +206,30 @@ static void input_manager_libinput_config_pointer( } libinput_device = wlr_libinput_get_device_handle(wlr_device); - wlr_log(WLR_DEBUG, "input_manager_libinput_config_pointer(%s)", + sway_log(SWAY_DEBUG, "input_manager_libinput_config_pointer(%s)", ic->identifier); if (ic->accel_profile != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", ic->identifier, ic->accel_profile); log_libinput_config_status(libinput_device_config_accel_set_profile( libinput_device, ic->accel_profile)); } if (ic->click_method != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)", ic->identifier, ic->click_method); log_libinput_config_status(libinput_device_config_click_set_method( libinput_device, ic->click_method)); } if (ic->drag != INT_MIN) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) tap_set_drag_enabled(%d)", ic->identifier, ic->drag); log_libinput_config_status(libinput_device_config_tap_set_drag_enabled( libinput_device, ic->drag)); } if (ic->drag_lock != INT_MIN) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)", ic->identifier, ic->drag_lock); log_libinput_config_status( @@ -237,20 +237,20 @@ static void input_manager_libinput_config_pointer( libinput_device, ic->drag_lock)); } if (ic->dwt != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)", ic->identifier, ic->dwt); log_libinput_config_status(libinput_device_config_dwt_set_enabled( libinput_device, ic->dwt)); } if (ic->left_handed != INT_MIN) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) left_handed_set_enabled(%d)", ic->identifier, ic->left_handed); log_libinput_config_status(libinput_device_config_left_handed_set( libinput_device, ic->left_handed)); } if (ic->middle_emulation != INT_MIN) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)", ic->identifier, ic->middle_emulation); log_libinput_config_status( @@ -258,7 +258,7 @@ static void input_manager_libinput_config_pointer( libinput_device, ic->middle_emulation)); } if (ic->natural_scroll != INT_MIN) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)", ic->identifier, ic->natural_scroll); log_libinput_config_status( @@ -266,37 +266,37 @@ static void input_manager_libinput_config_pointer( libinput_device, ic->natural_scroll)); } if (ic->pointer_accel != FLT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)", ic->identifier, ic->pointer_accel); log_libinput_config_status(libinput_device_config_accel_set_speed( libinput_device, ic->pointer_accel)); } if (ic->scroll_button != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) scroll_set_button(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) scroll_set_button(%d)", ic->identifier, ic->scroll_button); log_libinput_config_status(libinput_device_config_scroll_set_button( libinput_device, ic->scroll_button)); } if (ic->scroll_method != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)", ic->identifier, ic->scroll_method); log_libinput_config_status(libinput_device_config_scroll_set_method( libinput_device, ic->scroll_method)); } if (ic->send_events != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)", ic->identifier, ic->send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, ic->send_events)); } if (ic->tap != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)", ic->identifier, ic->tap); log_libinput_config_status(libinput_device_config_tap_set_enabled( libinput_device, ic->tap)); } if (ic->tap_button_map != INT_MIN) { - wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_button_map(%d)", + sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) tap_set_button_map(%d)", ic->identifier, ic->tap_button_map); log_libinput_config_status(libinput_device_config_tap_set_button_map( libinput_device, ic->tap_button_map)); @@ -316,21 +316,21 @@ static void input_manager_libinput_reset_pointer( enum libinput_config_accel_profile accel_profile = libinput_device_config_accel_get_default_profile(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)", input_device->identifier, accel_profile); log_libinput_config_status(libinput_device_config_accel_set_profile( libinput_device, accel_profile)); enum libinput_config_click_method click_method = libinput_device_config_click_get_default_method(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)", input_device->identifier, click_method); log_libinput_config_status(libinput_device_config_click_set_method( libinput_device, click_method)); enum libinput_config_drag_state drag = libinput_device_config_tap_get_default_drag_enabled(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)", input_device->identifier, drag); log_libinput_config_status(libinput_device_config_tap_set_drag_enabled( libinput_device, drag)); @@ -338,7 +338,7 @@ static void input_manager_libinput_reset_pointer( enum libinput_config_drag_lock_state drag_lock = libinput_device_config_tap_get_default_drag_lock_enabled( libinput_device); - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_lock_enabled(%d)", input_device->identifier, drag_lock); log_libinput_config_status( @@ -347,14 +347,14 @@ static void input_manager_libinput_reset_pointer( enum libinput_config_dwt_state dwt = libinput_device_config_dwt_get_default_enabled(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)", input_device->identifier, dwt); log_libinput_config_status(libinput_device_config_dwt_set_enabled( libinput_device, dwt)); int left_handed = libinput_device_config_left_handed_get_default(libinput_device); - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) left_handed_set_enabled(%d)", input_device->identifier, left_handed); log_libinput_config_status(libinput_device_config_left_handed_set( @@ -363,7 +363,7 @@ static void input_manager_libinput_reset_pointer( enum libinput_config_middle_emulation_state middle_emulation = libinput_device_config_middle_emulation_get_default_enabled( libinput_device); - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)", input_device->identifier, middle_emulation); log_libinput_config_status( @@ -373,7 +373,7 @@ static void input_manager_libinput_reset_pointer( int natural_scroll = libinput_device_config_scroll_get_default_natural_scroll_enabled( libinput_device); - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) natural_scroll_set_enabled(%d)", input_device->identifier, natural_scroll); log_libinput_config_status( @@ -382,42 +382,42 @@ static void input_manager_libinput_reset_pointer( double pointer_accel = libinput_device_config_accel_get_default_speed(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)", input_device->identifier, pointer_accel); log_libinput_config_status(libinput_device_config_accel_set_speed( libinput_device, pointer_accel)); uint32_t scroll_button = libinput_device_config_scroll_get_default_button(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)", input_device->identifier, scroll_button); log_libinput_config_status(libinput_device_config_scroll_set_button( libinput_device, scroll_button)); enum libinput_config_scroll_method scroll_method = libinput_device_config_scroll_get_default_method(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)", input_device->identifier, scroll_method); log_libinput_config_status(libinput_device_config_scroll_set_method( libinput_device, scroll_method)); uint32_t send_events = libinput_device_config_send_events_get_default_mode(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)", input_device->identifier, send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, send_events)); enum libinput_config_tap_state tap = libinput_device_config_tap_get_default_enabled(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)", input_device->identifier, tap); log_libinput_config_status(libinput_device_config_tap_set_enabled( libinput_device, tap)); enum libinput_config_tap_button_map tap_button_map = libinput_device_config_tap_get_button_map(libinput_device); - wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) tap_set_button_map(%d)", + sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_button_map(%d)", input_device->identifier, tap_button_map); log_libinput_config_status(libinput_device_config_tap_set_button_map( libinput_device, tap_button_map)); @@ -432,7 +432,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) { return; } - wlr_log(WLR_DEBUG, "removing device: '%s'", + sway_log(SWAY_DEBUG, "removing device: '%s'", input_device->identifier); struct sway_seat *seat = NULL; @@ -462,7 +462,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) { input_device->identifier = input_device_get_identifier(device); wl_list_insert(&input->devices, &input_device->link); - wlr_log(WLR_DEBUG, "adding device: '%s'", + sway_log(SWAY_DEBUG, "adding device: '%s'", input_device->identifier); if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER || @@ -504,7 +504,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) { } if (!added) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "device '%s' is not configured on any seats", input_device->identifier); } @@ -554,7 +554,7 @@ void handle_virtual_keyboard(struct wl_listener *listener, void *data) { input_device->identifier = input_device_get_identifier(device); wl_list_insert(&input_manager->devices, &input_device->link); - wlr_log(WLR_DEBUG, "adding virtual keyboard: '%s'", + sway_log(SWAY_DEBUG, "adding virtual keyboard: '%s'", input_device->identifier); wl_signal_add(&device->events.destroy, &input_device->device_destroy); @@ -660,7 +660,7 @@ void input_manager_reset_all_inputs() { void input_manager_apply_seat_config(struct seat_config *seat_config) { - wlr_log(WLR_DEBUG, "applying seat config for seat %s", seat_config->name); + sway_log(SWAY_DEBUG, "applying seat config for seat %s", seat_config->name); if (strcmp(seat_config->name, "*") == 0) { struct sway_seat *seat = NULL; wl_list_for_each(seat, &server.input->seats, link) { diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 2ea796a9..c1fc60f7 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c @@ -126,7 +126,7 @@ static void get_active_binding(const struct sway_shortcut_state *state, if (*current_binding && *current_binding != binding && strcmp((*current_binding)->input, binding->input) == 0) { - wlr_log(WLR_DEBUG, "encountered duplicate bindings %d and %d", + sway_log(SWAY_DEBUG, "encountered duplicate bindings %d and %d", (*current_binding)->order, binding->order); } else if (!*current_binding || strcmp((*current_binding)->input, "*") == 0) { @@ -219,7 +219,7 @@ void sway_keyboard_disarm_key_repeat(struct sway_keyboard *keyboard) { } keyboard->repeat_binding = NULL; if (wl_event_source_timer_update(keyboard->key_repeat_source, 0) < 0) { - wlr_log(WLR_DEBUG, "failed to disarm key repeat timer"); + sway_log(SWAY_DEBUG, "failed to disarm key repeat timer"); } } @@ -313,7 +313,7 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) { keyboard->repeat_binding = binding; if (wl_event_source_timer_update(keyboard->key_repeat_source, wlr_device->keyboard->repeat_info.delay) < 0) { - wlr_log(WLR_DEBUG, "failed to set key repeat timer"); + sway_log(SWAY_DEBUG, "failed to set key repeat timer"); } } else if (keyboard->repeat_binding) { sway_keyboard_disarm_key_repeat(keyboard); @@ -356,7 +356,7 @@ static int handle_keyboard_repeat(void *data) { // We queue the next event first, as the command might cancel it if (wl_event_source_timer_update(keyboard->key_repeat_source, 1000 / wlr_device->repeat_info.rate) < 0) { - wlr_log(WLR_DEBUG, "failed to update key repeat timer"); + sway_log(SWAY_DEBUG, "failed to update key repeat timer"); } } @@ -460,7 +460,7 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) { xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); if (!keymap) { - wlr_log(WLR_DEBUG, "cannot configure keyboard: keymap does not exist"); + sway_log(SWAY_DEBUG, "cannot configure keyboard: keymap does not exist"); xkb_context_unref(context); return; } diff --git a/sway/input/seat.c b/sway/input/seat.c index a66a8198..82e0e754 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -62,7 +62,7 @@ static void seat_node_destroy(struct sway_seat_node *seat_node) { static void seat_send_activate(struct sway_node *node, struct sway_seat *seat) { if (node_is_view(node)) { if (!seat_is_input_allowed(seat, node->sway_container->view->surface)) { - wlr_log(WLR_DEBUG, "Refusing to set focus, input is inhibited"); + sway_log(SWAY_DEBUG, "Refusing to set focus, input is inhibited"); return; } view_set_activated(node->sway_container->view, true); @@ -208,7 +208,7 @@ static struct sway_seat_node *seat_node_from_node( seat_node = calloc(1, sizeof(struct sway_seat_node)); if (seat_node == NULL) { - wlr_log(WLR_ERROR, "could not allocate seat node"); + sway_log(SWAY_ERROR, "could not allocate seat node"); return NULL; } @@ -289,7 +289,7 @@ static void handle_new_drag_icon(struct wl_listener *listener, void *data) { struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon)); if (icon == NULL) { - wlr_log(WLR_ERROR, "Allocation failed"); + sway_log(SWAY_ERROR, "Allocation failed"); return; } icon->seat = seat; @@ -407,7 +407,7 @@ static void seat_update_capabilities(struct sway_seat *seat) { static void seat_reset_input_config(struct sway_seat *seat, struct sway_seat_device *sway_device) { - wlr_log(WLR_DEBUG, "Resetting output mapping for input device %s", + sway_log(SWAY_DEBUG, "Resetting output mapping for input device %s", sway_device->input_device->identifier); wlr_cursor_map_input_to_output(seat->cursor->cursor, sway_device->input_device->wlr_device, NULL); @@ -420,7 +420,7 @@ static void seat_apply_input_config(struct sway_seat *seat, struct input_config *ic = input_device_get_config( sway_device->input_device); if (ic != NULL) { - wlr_log(WLR_DEBUG, "Applying input config to %s", + sway_log(SWAY_DEBUG, "Applying input config to %s", sway_device->input_device->identifier); mapped_to_output = ic->mapped_to_output; @@ -430,19 +430,19 @@ static void seat_apply_input_config(struct sway_seat *seat, mapped_to_output = sway_device->input_device->wlr_device->output_name; } if (mapped_to_output != NULL) { - wlr_log(WLR_DEBUG, "Mapping input device %s to output %s", + sway_log(SWAY_DEBUG, "Mapping input device %s to output %s", sway_device->input_device->identifier, mapped_to_output); if (strcmp("*", mapped_to_output) == 0) { wlr_cursor_map_input_to_output(seat->cursor->cursor, sway_device->input_device->wlr_device, NULL); - wlr_log(WLR_DEBUG, "Reset output mapping"); + sway_log(SWAY_DEBUG, "Reset output mapping"); return; } struct sway_output *output = output_by_name_or_id(mapped_to_output); if (output) { wlr_cursor_map_input_to_output(seat->cursor->cursor, sway_device->input_device->wlr_device, output->wlr_output); - wlr_log(WLR_DEBUG, "Mapped to output %s", output->wlr_output->name); + sway_log(SWAY_DEBUG, "Mapped to output %s", output->wlr_output->name); } } } @@ -522,10 +522,10 @@ void seat_configure_device(struct sway_seat *seat, seat_configure_tablet_tool(seat, seat_device); break; case WLR_INPUT_DEVICE_TABLET_PAD: - wlr_log(WLR_DEBUG, "TODO: configure tablet pad"); + sway_log(SWAY_DEBUG, "TODO: configure tablet pad"); break; case WLR_INPUT_DEVICE_SWITCH: - wlr_log(WLR_DEBUG, "TODO: configure switch device"); + sway_log(SWAY_DEBUG, "TODO: configure switch device"); break; } } @@ -552,10 +552,10 @@ void seat_reset_device(struct sway_seat *seat, seat_reset_input_config(seat, seat_device); break; case WLR_INPUT_DEVICE_TABLET_PAD: - wlr_log(WLR_DEBUG, "TODO: reset tablet pad"); + sway_log(SWAY_DEBUG, "TODO: reset tablet pad"); break; case WLR_INPUT_DEVICE_SWITCH: - wlr_log(WLR_DEBUG, "TODO: reset switch device"); + sway_log(SWAY_DEBUG, "TODO: reset switch device"); break; } } @@ -570,11 +570,11 @@ void seat_add_device(struct sway_seat *seat, struct sway_seat_device *seat_device = calloc(1, sizeof(struct sway_seat_device)); if (!seat_device) { - wlr_log(WLR_DEBUG, "could not allocate seat device"); + sway_log(SWAY_DEBUG, "could not allocate seat device"); return; } - wlr_log(WLR_DEBUG, "adding device %s to seat %s", + sway_log(SWAY_DEBUG, "adding device %s to seat %s", input_device->identifier, seat->wlr_seat->name); seat_device->sway_seat = seat; @@ -594,7 +594,7 @@ void seat_remove_device(struct sway_seat *seat, return; } - wlr_log(WLR_DEBUG, "removing device %s from seat %s", + sway_log(SWAY_DEBUG, "removing device %s from seat %s", input_device->identifier, seat->wlr_seat->name); seat_device_destroy(seat_device); @@ -790,7 +790,7 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { wl_event_source_timer_update(view->urgent_timer, config->urgent_timeout); } else { - wlr_log(WLR_ERROR, "Unable to create urgency timer (%s)", + sway_log(SWAY_ERROR, "Unable to create urgency timer (%s)", strerror(errno)); handle_urgent_timeout(view); } diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 9a033a4b..82e144b7 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -147,32 +147,32 @@ struct sockaddr_un *ipc_user_sockaddr(void) { int ipc_handle_connection(int fd, uint32_t mask, void *data) { (void) fd; struct sway_server *server = data; - wlr_log(WLR_DEBUG, "Event on IPC listening socket"); + sway_log(SWAY_DEBUG, "Event on IPC listening socket"); assert(mask == WL_EVENT_READABLE); int client_fd = accept(ipc_socket, NULL, NULL); if (client_fd == -1) { - wlr_log_errno(WLR_ERROR, "Unable to accept IPC client connection"); + sway_log_errno(SWAY_ERROR, "Unable to accept IPC client connection"); return 0; } int flags; if ((flags = fcntl(client_fd, F_GETFD)) == -1 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) { - wlr_log_errno(WLR_ERROR, "Unable to set CLOEXEC on IPC client socket"); + sway_log_errno(SWAY_ERROR, "Unable to set CLOEXEC on IPC client socket"); close(client_fd); return 0; } if ((flags = fcntl(client_fd, F_GETFL)) == -1 || fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) { - wlr_log_errno(WLR_ERROR, "Unable to set NONBLOCK on IPC client socket"); + sway_log_errno(SWAY_ERROR, "Unable to set NONBLOCK on IPC client socket"); close(client_fd); return 0; } struct ipc_client *client = malloc(sizeof(struct ipc_client)); if (!client) { - wlr_log(WLR_ERROR, "Unable to allocate ipc client"); + sway_log(SWAY_ERROR, "Unable to allocate ipc client"); close(client_fd); return 0; } @@ -188,12 +188,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) { client->write_buffer_len = 0; client->write_buffer = malloc(client->write_buffer_size); if (!client->write_buffer) { - wlr_log(WLR_ERROR, "Unable to allocate ipc client write buffer"); + sway_log(SWAY_ERROR, "Unable to allocate ipc client write buffer"); close(client_fd); return 0; } - wlr_log(WLR_DEBUG, "New client: fd %d", client_fd); + sway_log(SWAY_DEBUG, "New client: fd %d", client_fd); list_add(ipc_client_list, client); return 0; } @@ -202,22 +202,22 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) { struct ipc_client *client = data; if (mask & WL_EVENT_ERROR) { - wlr_log(WLR_ERROR, "IPC Client socket error, removing client"); + sway_log(SWAY_ERROR, "IPC Client socket error, removing client"); ipc_client_disconnect(client); return 0; } if (mask & WL_EVENT_HANGUP) { - wlr_log(WLR_DEBUG, "Client %d hung up", client->fd); + sway_log(SWAY_DEBUG, "Client %d hung up", client->fd); ipc_client_disconnect(client); return 0; } - wlr_log(WLR_DEBUG, "Client %d readable", client->fd); + sway_log(SWAY_DEBUG, "Client %d readable", client->fd); int read_available; if (ioctl(client_fd, FIONREAD, &read_available) == -1) { - wlr_log_errno(WLR_INFO, "Unable to read IPC socket buffer size"); + sway_log_errno(SWAY_INFO, "Unable to read IPC socket buffer size"); ipc_client_disconnect(client); return 0; } @@ -239,13 +239,13 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) { // Should be fully available, because read_available >= IPC_HEADER_SIZE ssize_t received = recv(client_fd, buf, IPC_HEADER_SIZE, 0); if (received == -1) { - wlr_log_errno(WLR_INFO, "Unable to receive header from IPC client"); + sway_log_errno(SWAY_INFO, "Unable to receive header from IPC client"); ipc_client_disconnect(client); return 0; } if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) { - wlr_log(WLR_DEBUG, "IPC header check failed"); + sway_log(SWAY_DEBUG, "IPC header check failed"); ipc_client_disconnect(client); return 0; } @@ -279,7 +279,7 @@ static void ipc_send_event(const char *json_string, enum ipc_command_type event) } client->current_command = event; if (!ipc_send_reply(client, json_string, (uint32_t) strlen(json_string))) { - wlr_log_errno(WLR_INFO, "Unable to send reply to IPC client"); + sway_log_errno(SWAY_INFO, "Unable to send reply to IPC client"); /* ipc_send_reply destroys client on error, which also * removes it from the list, so we need to process * current index again */ @@ -293,7 +293,7 @@ void ipc_event_workspace(struct sway_workspace *old, if (!ipc_has_event_listeners(IPC_EVENT_WORKSPACE)) { return; } - wlr_log(WLR_DEBUG, "Sending workspace::%s event", change); + sway_log(SWAY_DEBUG, "Sending workspace::%s event", change); json_object *obj = json_object_new_object(); json_object_object_add(obj, "change", json_object_new_string(change)); if (old) { @@ -319,7 +319,7 @@ void ipc_event_window(struct sway_container *window, const char *change) { if (!ipc_has_event_listeners(IPC_EVENT_WINDOW)) { return; } - wlr_log(WLR_DEBUG, "Sending window::%s event", change); + sway_log(SWAY_DEBUG, "Sending window::%s event", change); json_object *obj = json_object_new_object(); json_object_object_add(obj, "change", json_object_new_string(change)); json_object_object_add(obj, "container", @@ -334,7 +334,7 @@ void ipc_event_barconfig_update(struct bar_config *bar) { if (!ipc_has_event_listeners(IPC_EVENT_BARCONFIG_UPDATE)) { return; } - wlr_log(WLR_DEBUG, "Sending barconfig_update event"); + sway_log(SWAY_DEBUG, "Sending barconfig_update event"); json_object *json = ipc_json_describe_bar_config(bar); const char *json_string = json_object_to_json_string(json); @@ -346,7 +346,7 @@ void ipc_event_bar_state_update(struct bar_config *bar) { if (!ipc_has_event_listeners(IPC_EVENT_BAR_STATE_UPDATE)) { return; } - wlr_log(WLR_DEBUG, "Sending bar_state_update event"); + sway_log(SWAY_DEBUG, "Sending bar_state_update event"); json_object *json = json_object_new_object(); json_object_object_add(json, "id", json_object_new_string(bar->id)); @@ -362,7 +362,7 @@ void ipc_event_mode(const char *mode, bool pango) { if (!ipc_has_event_listeners(IPC_EVENT_MODE)) { return; } - wlr_log(WLR_DEBUG, "Sending mode::%s event", mode); + sway_log(SWAY_DEBUG, "Sending mode::%s event", mode); json_object *obj = json_object_new_object(); json_object_object_add(obj, "change", json_object_new_string(mode)); json_object_object_add(obj, "pango_markup", @@ -377,7 +377,7 @@ void ipc_event_shutdown(const char *reason) { if (!ipc_has_event_listeners(IPC_EVENT_SHUTDOWN)) { return; } - wlr_log(WLR_DEBUG, "Sending shutdown::%s event", reason); + sway_log(SWAY_DEBUG, "Sending shutdown::%s event", reason); json_object *json = json_object_new_object(); json_object_object_add(json, "change", json_object_new_string(reason)); @@ -391,7 +391,7 @@ void ipc_event_binding(struct sway_binding *binding) { if (!ipc_has_event_listeners(IPC_EVENT_BINDING)) { return; } - wlr_log(WLR_DEBUG, "Sending binding event"); + sway_log(SWAY_DEBUG, "Sending binding event"); json_object *json_binding = json_object_new_object(); json_object_object_add(json_binding, "command", json_object_new_string(binding->command)); @@ -464,7 +464,7 @@ static void ipc_event_tick(const char *payload) { if (!ipc_has_event_listeners(IPC_EVENT_TICK)) { return; } - wlr_log(WLR_DEBUG, "Sending tick event"); + sway_log(SWAY_DEBUG, "Sending tick event"); json_object *json = json_object_new_object(); json_object_object_add(json, "first", json_object_new_boolean(false)); @@ -479,13 +479,13 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) { struct ipc_client *client = data; if (mask & WL_EVENT_ERROR) { - wlr_log(WLR_ERROR, "IPC Client socket error, removing client"); + sway_log(SWAY_ERROR, "IPC Client socket error, removing client"); ipc_client_disconnect(client); return 0; } if (mask & WL_EVENT_HANGUP) { - wlr_log(WLR_DEBUG, "Client %d hung up", client->fd); + sway_log(SWAY_DEBUG, "Client %d hung up", client->fd); ipc_client_disconnect(client); return 0; } @@ -494,14 +494,14 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) { return 0; } - wlr_log(WLR_DEBUG, "Client %d writable", client->fd); + sway_log(SWAY_DEBUG, "Client %d writable", client->fd); ssize_t written = write(client->fd, client->write_buffer, client->write_buffer_len); if (written == -1 && errno == EAGAIN) { return 0; } else if (written == -1) { - wlr_log_errno(WLR_INFO, "Unable to send data from queue to IPC client"); + sway_log_errno(SWAY_INFO, "Unable to send data from queue to IPC client"); ipc_client_disconnect(client); return 0; } @@ -524,7 +524,7 @@ void ipc_client_disconnect(struct ipc_client *client) { shutdown(client->fd, SHUT_RDWR); - wlr_log(WLR_INFO, "IPC Client %d disconnected", client->fd); + sway_log(SWAY_INFO, "IPC Client %d disconnected", client->fd); wl_event_source_remove(client->event_source); if (client->writable_event_source) { wl_event_source_remove(client->writable_event_source); @@ -573,7 +573,7 @@ void ipc_client_handle_command(struct ipc_client *client) { char *buf = malloc(client->payload_length + 1); if (!buf) { - wlr_log_errno(WLR_INFO, "Unable to allocate IPC payload"); + sway_log_errno(SWAY_INFO, "Unable to allocate IPC payload"); ipc_client_disconnect(client); return; } @@ -582,7 +582,7 @@ void ipc_client_handle_command(struct ipc_client *client) { ssize_t received = recv(client->fd, buf, client->payload_length, 0); if (received == -1) { - wlr_log_errno(WLR_INFO, "Unable to receive payload from IPC client"); + sway_log_errno(SWAY_INFO, "Unable to receive payload from IPC client"); ipc_client_disconnect(client); free(buf); return; @@ -667,7 +667,7 @@ void ipc_client_handle_command(struct ipc_client *client) { if (request == NULL || !json_object_is_type(request, json_type_array)) { const char msg[] = "{\"success\": false}"; client_valid = ipc_send_reply(client, msg, strlen(msg)); - wlr_log(WLR_INFO, "Failed to parse subscribe request"); + sway_log(SWAY_INFO, "Failed to parse subscribe request"); goto exit_cleanup; } @@ -696,7 +696,7 @@ void ipc_client_handle_command(struct ipc_client *client) { const char msg[] = "{\"success\": false}"; client_valid = ipc_send_reply(client, msg, strlen(msg)); json_object_put(request); - wlr_log(WLR_INFO, "Unsupported event type in subscribe request"); + sway_log(SWAY_INFO, "Unsupported event type in subscribe request"); goto exit_cleanup; } } @@ -845,7 +845,7 @@ void ipc_client_handle_command(struct ipc_client *client) { } default: - wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command); + sway_log(SWAY_INFO, "Unknown IPC command type %i", client->current_command); goto exit_cleanup; } @@ -873,14 +873,14 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay } if (client->write_buffer_size > 4e6) { // 4 MB - wlr_log(WLR_ERROR, "Client write buffer too big, disconnecting client"); + sway_log(SWAY_ERROR, "Client write buffer too big, disconnecting client"); ipc_client_disconnect(client); return false; } char *new_buffer = realloc(client->write_buffer, client->write_buffer_size); if (!new_buffer) { - wlr_log(WLR_ERROR, "Unable to reallocate ipc client write buffer"); + sway_log(SWAY_ERROR, "Unable to reallocate ipc client write buffer"); ipc_client_disconnect(client); return false; } @@ -897,6 +897,6 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay ipc_client_handle_writable, client); } - wlr_log(WLR_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload); + sway_log(SWAY_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload); return true; } diff --git a/sway/main.c b/sway/main.c index 6e2f16db..4a92b25a 100644 --- a/sway/main.c +++ b/sway/main.c @@ -94,10 +94,10 @@ void detect_proprietary(int allow_unsupported_gpu) { while (getline(&line, &line_size, f) != -1) { if (strstr(line, "nvidia")) { if (allow_unsupported_gpu) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "!!! Proprietary Nvidia drivers are in use !!!"); } else { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "Proprietary Nvidia drivers are NOT supported. " "Use Nouveau. To launch sway anyway, launch with " "--my-next-gpu-wont-be-nvidia and DO NOT report issues."); @@ -107,10 +107,10 @@ void detect_proprietary(int allow_unsupported_gpu) { } if (strstr(line, "fglrx")) { if (allow_unsupported_gpu) { - wlr_log(WLR_ERROR, + sway_log(SWAY_ERROR, "!!! Proprietary AMD drivers are in use !!!"); } else { - wlr_log(WLR_ERROR, "Proprietary AMD drivers do NOT support " + sway_log(SWAY_ERROR, "Proprietary AMD drivers do NOT support " "Wayland. Use radeon. To try anyway, launch sway with " "--unsupported-gpu and DO NOT report issues."); exit(EXIT_FAILURE); @@ -141,7 +141,7 @@ static void log_env(void) { "SWAYSOCK" }; for (size_t i = 0; i < sizeof(log_vars) / sizeof(char *); ++i) { - wlr_log(WLR_INFO, "%s=%s", log_vars[i], getenv(log_vars[i])); + sway_log(SWAY_INFO, "%s=%s", log_vars[i], getenv(log_vars[i])); } } @@ -153,7 +153,7 @@ static void log_file(FILE *f) { if (line[nread - 1] == '\n') { line[nread - 1] = '\0'; } - wlr_log(WLR_INFO, "%s", line); + sway_log(SWAY_INFO, "%s", line); } free(line); } @@ -169,7 +169,7 @@ static void log_distro(void) { for (size_t i = 0; i < sizeof(paths) / sizeof(char *); ++i) { FILE *f = fopen(paths[i], "r"); if (f) { - wlr_log(WLR_INFO, "Contents of %s:", paths[i]); + sway_log(SWAY_INFO, "Contents of %s:", paths[i]); log_file(f); fclose(f); } @@ -179,7 +179,7 @@ static void log_distro(void) { static void log_kernel(void) { FILE *f = popen("uname -a", "r"); if (!f) { - wlr_log(WLR_INFO, "Unable to determine kernel version"); + sway_log(SWAY_INFO, "Unable to determine kernel version"); return; } log_file(f); @@ -190,16 +190,16 @@ static void log_kernel(void) { static bool drop_permissions(void) { if (getuid() != geteuid() || getgid() != getegid()) { if (setgid(getgid()) != 0) { - wlr_log(WLR_ERROR, "Unable to drop root, refusing to start"); + sway_log(SWAY_ERROR, "Unable to drop root, refusing to start"); return false; } if (setuid(getuid()) != 0) { - wlr_log(WLR_ERROR, "Unable to drop root, refusing to start"); + sway_log(SWAY_ERROR, "Unable to drop root, refusing to start"); return false; } } if (setuid(0) != -1) { - wlr_log(WLR_ERROR, "Unable to drop root (we shouldn't be able to " + sway_log(SWAY_ERROR, "Unable to drop root (we shouldn't be able to " "restore it after setuid), refusing to start"); return false; } @@ -303,17 +303,22 @@ int main(int argc, char **argv) { } } + // As the 'callback' function for wlr_log is equivalent to that for + // sway, we do not need to override it. if (debug) { + sway_log_init(SWAY_DEBUG, sway_terminate); wlr_log_init(WLR_DEBUG, NULL); } else if (verbose || validate) { + sway_log_init(SWAY_INFO, sway_terminate); wlr_log_init(WLR_INFO, NULL); } else { + sway_log_init(SWAY_ERROR, sway_terminate); wlr_log_init(WLR_ERROR, NULL); } if (optind < argc) { // Behave as IPC client if (optind != 1) { - wlr_log(WLR_ERROR, "Don't use options with the IPC client"); + sway_log(SWAY_ERROR, "Don't use options with the IPC client"); exit(EXIT_FAILURE); } if (!drop_permissions()) { @@ -321,7 +326,7 @@ int main(int argc, char **argv) { } char *socket_path = getenv("SWAYSOCK"); if (!socket_path) { - wlr_log(WLR_ERROR, "Unable to retrieve socket path"); + sway_log(SWAY_ERROR, "Unable to retrieve socket path"); exit(EXIT_FAILURE); } char *command = join_args(argv + optind, argc - optind); @@ -349,7 +354,7 @@ int main(int argc, char **argv) { // prevent ipc from crashing sway signal(SIGPIPE, SIG_IGN); - wlr_log(WLR_INFO, "Starting sway version " SWAY_VERSION); + sway_log(SWAY_INFO, "Starting sway version " SWAY_VERSION); root = root_create(); @@ -383,14 +388,14 @@ int main(int argc, char **argv) { config->active = true; load_swaybars(); // Execute commands until there are none left - wlr_log(WLR_DEBUG, "Running deferred commands"); + sway_log(SWAY_DEBUG, "Running deferred commands"); while (config->cmd_queue->length) { char *line = config->cmd_queue->items[0]; list_t *res_list = execute_command(line, NULL, NULL); for (int i = 0; i < res_list->length; ++i) { struct cmd_results *res = res_list->items[i]; if (res->status != CMD_SUCCESS) { - wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error); + sway_log(SWAY_ERROR, "Error on line '%s': %s", line, res->error); } free_cmd_results(res); } @@ -408,7 +413,7 @@ int main(int argc, char **argv) { server_run(&server); } - wlr_log(WLR_INFO, "Shutting down sway"); + sway_log(SWAY_INFO, "Shutting down sway"); server_fini(&server); root_destroy(root); diff --git a/sway/server.c b/sway/server.c index 0529cab1..5ae9bb01 100644 --- a/sway/server.c +++ b/sway/server.c @@ -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); } diff --git a/sway/swaynag.c b/sway/swaynag.c index 38e74b88..49027f5d 100644 --- a/sway/swaynag.c +++ b/sway/swaynag.c @@ -17,7 +17,7 @@ bool swaynag_spawn(const char *swaynag_command, if (swaynag->detailed) { if (pipe(swaynag->fd) != 0) { - wlr_log(WLR_ERROR, "Failed to create pipe for swaynag"); + sway_log(SWAY_ERROR, "Failed to create pipe for swaynag"); return false; } fcntl(swaynag->fd[1], F_SETFD, FD_CLOEXEC); @@ -37,7 +37,7 @@ bool swaynag_spawn(const char *swaynag_command, execl("/bin/sh", "/bin/sh", "-c", cmd, NULL); _exit(0); } else if (pid < 0) { - wlr_log(WLR_ERROR, "Failed to create fork for swaynag"); + sway_log(SWAY_ERROR, "Failed to create fork for swaynag"); if (swaynag->detailed) { close(swaynag->fd[0]); close(swaynag->fd[1]); @@ -67,7 +67,7 @@ void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, } if (!swaynag->detailed) { - wlr_log(WLR_ERROR, "Attempting to write to non-detailed swaynag inst"); + sway_log(SWAY_ERROR, "Attempting to write to non-detailed swaynag inst"); return; } @@ -82,7 +82,7 @@ void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, char *temp = malloc(length + 1); if (!temp) { - wlr_log(WLR_ERROR, "Failed to allocate buffer for swaynag log entry."); + sway_log(SWAY_ERROR, "Failed to allocate buffer for swaynag log entry."); return; } diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 852d53bf..f78d95a4 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -35,7 +35,7 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) { double scale = parent->width / total_width; // Resize windows - wlr_log(WLR_DEBUG, "Arranging %p horizontally", parent); + sway_log(SWAY_DEBUG, "Arranging %p horizontally", parent); double child_x = parent->x; for (int i = 0; i < children->length; ++i) { struct sway_container *child = children->items[i]; @@ -75,7 +75,7 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) { double scale = parent->height / total_height; // Resize - wlr_log(WLR_DEBUG, "Arranging %p vertically", parent); + sway_log(SWAY_DEBUG, "Arranging %p vertically", parent); double child_y = parent->y; for (int i = 0; i < children->length; ++i) { struct sway_container *child = children->items[i]; @@ -186,7 +186,7 @@ void arrange_workspace(struct sway_workspace *workspace) { } struct sway_output *output = workspace->output; struct wlr_box *area = &output->usable_area; - wlr_log(WLR_DEBUG, "Usable area for ws: %dx%d@%d,%d", + sway_log(SWAY_DEBUG, "Usable area for ws: %dx%d@%d,%d", area->width, area->height, area->x, area->y); workspace_remove_gaps(workspace); @@ -217,7 +217,7 @@ void arrange_workspace(struct sway_workspace *workspace) { workspace_add_gaps(workspace); node_set_dirty(&workspace->node); - wlr_log(WLR_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name, + sway_log(SWAY_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name, workspace->x, workspace->y); if (workspace->fullscreen) { struct sway_container *fs = workspace->fullscreen; diff --git a/sway/tree/container.c b/sway/tree/container.c index d9c721f5..97a52d91 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -28,7 +28,7 @@ struct sway_container *container_create(struct sway_view *view) { struct sway_container *c = calloc(1, sizeof(struct sway_container)); if (!c) { - wlr_log(WLR_ERROR, "Unable to allocate sway_container"); + sway_log(SWAY_ERROR, "Unable to allocate sway_container"); return NULL; } node_init(&c->node, N_CONTAINER, c); @@ -983,7 +983,7 @@ void container_discover_outputs(struct sway_container *con) { if (intersects && index == -1) { // Send enter - wlr_log(WLR_DEBUG, "Container %p entered output %p", con, output); + sway_log(SWAY_DEBUG, "Container %p entered output %p", con, output); if (con->view) { view_for_each_surface(con->view, surface_send_enter_iterator, output->wlr_output); @@ -991,7 +991,7 @@ void container_discover_outputs(struct sway_container *con) { list_add(con->outputs, output); } else if (!intersects && index != -1) { // Send leave - wlr_log(WLR_DEBUG, "Container %p left output %p", con, output); + sway_log(SWAY_DEBUG, "Container %p left output %p", con, output); if (con->view) { view_for_each_surface(con->view, surface_send_leave_iterator, output->wlr_output); diff --git a/sway/tree/output.c b/sway/tree/output.c index b79e70d4..7fbeeebd 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -97,7 +97,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) { if (!output->workspaces->length) { // Create workspace char *ws_name = workspace_next_name(wlr_output->name); - wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name); + sway_log(SWAY_DEBUG, "Creating default workspace %s", ws_name); ws = workspace_create(output, ws_name); // Set each seat's focus if not already set struct sway_seat *seat = NULL; @@ -212,7 +212,7 @@ void output_disable(struct sway_output *output) { if (!sway_assert(output->enabled, "Expected an enabled output")) { return; } - wlr_log(WLR_DEBUG, "Disabling output '%s'", output->wlr_output->name); + sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name); wl_signal_emit(&output->events.destroy, output); output_evacuate(output); @@ -237,7 +237,7 @@ void output_begin_destroy(struct sway_output *output) { if (!sway_assert(!output->enabled, "Expected a disabled output")) { return; } - wlr_log(WLR_DEBUG, "Destroying output '%s'", output->wlr_output->name); + sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name); output->node.destroying = true; node_set_dirty(&output->node); @@ -258,11 +258,11 @@ struct output_config *output_find_config(struct sway_output *output) { if (strcasecmp(name, cur->name) == 0 || strcasecmp(identifier, cur->name) == 0) { - wlr_log(WLR_DEBUG, "Matched output config for %s", name); + sway_log(SWAY_DEBUG, "Matched output config for %s", name); oc = cur; } if (strcasecmp("*", cur->name) == 0) { - wlr_log(WLR_DEBUG, "Matched wildcard output config for %s", name); + sway_log(SWAY_DEBUG, "Matched wildcard output config for %s", name); all = cur; } diff --git a/sway/tree/root.c b/sway/tree/root.c index e5df8dd1..08ce7942 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c @@ -26,7 +26,7 @@ static void output_layout_handle_change(struct wl_listener *listener, struct sway_root *root_create(void) { struct sway_root *root = calloc(1, sizeof(struct sway_root)); if (!root) { - wlr_log(WLR_ERROR, "Unable to allocate sway_root"); + sway_log(SWAY_ERROR, "Unable to allocate sway_root"); return NULL; } node_init(&root->node, N_ROOT, root); @@ -178,14 +178,14 @@ struct sway_workspace *root_workspace_for_pid(pid_t pid) { struct sway_workspace *ws = NULL; struct pid_workspace *pw = NULL; - wlr_log(WLR_DEBUG, "Looking up workspace for pid %d", pid); + sway_log(SWAY_DEBUG, "Looking up workspace for pid %d", pid); do { struct pid_workspace *_pw = NULL; wl_list_for_each(_pw, &pid_workspaces, link) { if (pid == _pw->pid) { pw = _pw; - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "found pid_workspace for pid %d, workspace %s", pid, pw->workspace); goto found; @@ -199,7 +199,7 @@ found: ws = workspace_by_name(pw->workspace); if (!ws) { - wlr_log(WLR_DEBUG, + sway_log(SWAY_DEBUG, "Creating workspace %s for pid %d because it disappeared", pw->workspace, pid); ws = workspace_create(pw->output, pw->workspace); @@ -222,7 +222,7 @@ static void pw_handle_output_destroy(struct wl_listener *listener, void *data) { } void root_record_workspace_pid(pid_t pid) { - wlr_log(WLR_DEBUG, "Recording workspace for process %d", pid); + sway_log(SWAY_DEBUG, "Recording workspace for process %d", pid); if (!pid_workspaces.prev && !pid_workspaces.next) { wl_list_init(&pid_workspaces); } @@ -230,12 +230,12 @@ void root_record_workspace_pid(pid_t pid) { struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *ws = seat_get_focused_workspace(seat); if (!ws) { - wlr_log(WLR_DEBUG, "Bailing out, no workspace"); + sway_log(SWAY_DEBUG, "Bailing out, no workspace"); return; } struct sway_output *output = ws->output; if (!output) { - wlr_log(WLR_DEBUG, "Bailing out, no output"); + sway_log(SWAY_DEBUG, "Bailing out, no output"); return; } diff --git a/sway/tree/view.c b/sway/tree/view.c index e65968c6..bc252521 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -328,7 +328,7 @@ void view_request_activate(struct sway_view *view) { } void view_set_csd_from_server(struct sway_view *view, bool enabled) { - wlr_log(WLR_DEBUG, "Telling view %p to set CSD to %i", view, enabled); + sway_log(SWAY_DEBUG, "Telling view %p to set CSD to %i", view, enabled); if (view->xdg_decoration) { uint32_t mode = enabled ? WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE : @@ -340,7 +340,7 @@ void view_set_csd_from_server(struct sway_view *view, bool enabled) { } void view_update_csd_from_client(struct sway_view *view, bool enabled) { - wlr_log(WLR_DEBUG, "View %p updated CSD to %i", view, enabled); + sway_log(SWAY_DEBUG, "View %p updated CSD to %i", view, enabled); struct sway_container *con = view->container; if (enabled && con && con->border != B_CSD) { con->saved_border = con->border; @@ -429,12 +429,12 @@ void view_execute_criteria(struct sway_view *view) { list_t *criterias = criteria_for_view(view, CT_COMMAND); for (int i = 0; i < criterias->length; i++) { struct criteria *criteria = criterias->items[i]; - wlr_log(WLR_DEBUG, "Checking criteria %s", criteria->raw); + sway_log(SWAY_DEBUG, "Checking criteria %s", criteria->raw); if (view_has_executed_criteria(view, criteria)) { - wlr_log(WLR_DEBUG, "Criteria already executed"); + sway_log(SWAY_DEBUG, "Criteria already executed"); continue; } - wlr_log(WLR_DEBUG, "for_window '%s' matches view %p, cmd: '%s'", + sway_log(SWAY_DEBUG, "for_window '%s' matches view %p, cmd: '%s'", criteria->raw, view, criteria->cmdlist); list_add(view->executed_criteria, criteria); list_t *res_list = execute_command( @@ -721,7 +721,7 @@ static void view_subsurface_create(struct sway_view *view, struct sway_subsurface *subsurface = calloc(1, sizeof(struct sway_subsurface)); if (subsurface == NULL) { - wlr_log(WLR_ERROR, "Allocation failed"); + sway_log(SWAY_ERROR, "Allocation failed"); return; } view_child_init(&subsurface->child, &subsurface_impl, view, @@ -860,7 +860,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { } const char *role = wlr_surface->role ? wlr_surface->role->name : NULL; - wlr_log(WLR_DEBUG, "Surface of unknown type (role %s): %p", + sway_log(SWAY_DEBUG, "Surface of unknown type (role %s): %p", role, wlr_surface); return NULL; } diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 7f18046d..e89c0849 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -69,12 +69,12 @@ struct sway_workspace *workspace_create(struct sway_output *output, output = workspace_get_initial_output(name); } - wlr_log(WLR_DEBUG, "Adding workspace %s for output %s", name, + sway_log(SWAY_DEBUG, "Adding workspace %s for output %s", name, output->wlr_output->name); struct sway_workspace *ws = calloc(1, sizeof(struct sway_workspace)); if (!ws) { - wlr_log(WLR_ERROR, "Unable to allocate sway_workspace"); + sway_log(SWAY_ERROR, "Unable to allocate sway_workspace"); return NULL; } node_init(&ws->node, N_WORKSPACE, ws); @@ -152,7 +152,7 @@ void workspace_destroy(struct sway_workspace *workspace) { } void workspace_begin_destroy(struct sway_workspace *workspace) { - wlr_log(WLR_DEBUG, "Destroying workspace '%s'", workspace->name); + sway_log(SWAY_DEBUG, "Destroying workspace '%s'", workspace->name); ipc_event_workspace(NULL, workspace, "empty"); // intentional wl_signal_emit(&workspace->node.events.destroy, &workspace->node); @@ -223,7 +223,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, char *_target = strdup(name); _target = do_var_replacement(_target); strip_quotes(_target); - wlr_log(WLR_DEBUG, "Got valid workspace command for target: '%s'", + sway_log(SWAY_DEBUG, "Got valid workspace command for target: '%s'", _target); // Make sure that the command references an actual workspace @@ -248,7 +248,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, temp[length - 1] = '\0'; free(_target); _target = temp; - wlr_log(WLR_DEBUG, "Isolated name from workspace number: '%s'", _target); + sway_log(SWAY_DEBUG, "Isolated name from workspace number: '%s'", _target); // Make sure the workspace number doesn't already exist if (isdigit(_target[0]) && workspace_by_number(_target)) { @@ -277,7 +277,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, *min_order = binding->order; free(*earliest_name); *earliest_name = _target; - wlr_log(WLR_DEBUG, "Workspace: Found free name %s", _target); + sway_log(SWAY_DEBUG, "Workspace: Found free name %s", _target); } else { free(_target); } @@ -286,7 +286,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, } char *workspace_next_name(const char *output_name) { - wlr_log(WLR_DEBUG, "Workspace: Generating new workspace name for output %s", + sway_log(SWAY_DEBUG, "Workspace: Generating new workspace name for output %s", output_name); // Scan for available workspace names by looking through output-workspace // assignments primarily, falling back to bindings and numbers. @@ -468,13 +468,13 @@ bool workspace_switch(struct sway_workspace *workspace, free(seat->prev_workspace_name); seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); if (!seat->prev_workspace_name) { - wlr_log(WLR_ERROR, "Unable to allocate previous workspace name"); + sway_log(SWAY_ERROR, "Unable to allocate previous workspace name"); return false; } strcpy(seat->prev_workspace_name, active_ws->name); } - wlr_log(WLR_DEBUG, "Switching to workspace %p:%s", + sway_log(SWAY_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name); struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); if (next == NULL) { |