From 1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 Mon Sep 17 00:00:00 2001 From: M Stoeckl Date: Sun, 20 Jan 2019 13:51:12 -0500 Subject: 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. --- sway/commands/assign.c | 2 +- sway/commands/bar.c | 8 ++++---- sway/commands/bar/bind.c | 4 ++-- sway/commands/bar/binding_mode_indicator.c | 4 ++-- sway/commands/bar/font.c | 2 +- sway/commands/bar/gaps.c | 2 +- sway/commands/bar/height.c | 2 +- sway/commands/bar/hidden_state.c | 2 +- sway/commands/bar/icon_theme.c | 2 +- sway/commands/bar/id.c | 2 +- sway/commands/bar/mode.c | 2 +- sway/commands/bar/modifier.c | 2 +- sway/commands/bar/output.c | 2 +- sway/commands/bar/pango_markup.c | 4 ++-- sway/commands/bar/position.c | 2 +- sway/commands/bar/separator_symbol.c | 2 +- sway/commands/bar/status_command.c | 2 +- sway/commands/bar/status_edge_padding.c | 2 +- sway/commands/bar/status_padding.c | 2 +- sway/commands/bar/strip_workspace_name.c | 4 ++-- sway/commands/bar/strip_workspace_numbers.c | 4 ++-- sway/commands/bar/swaybar_command.c | 2 +- sway/commands/bar/tray_bind.c | 4 ++-- sway/commands/bar/tray_output.c | 4 ++-- sway/commands/bar/tray_padding.c | 2 +- sway/commands/bar/workspace_buttons.c | 4 ++-- sway/commands/bar/wrap_scroll.c | 4 ++-- sway/commands/bind.c | 8 ++++---- sway/commands/client.c | 2 +- sway/commands/exec.c | 2 +- sway/commands/exec_always.c | 8 ++++---- sway/commands/floating_minmax_size.c | 1 - sway/commands/focus.c | 1 - sway/commands/for_window.c | 2 +- sway/commands/input.c | 2 +- sway/commands/input/xkb_layout.c | 2 +- sway/commands/input/xkb_model.c | 2 +- sway/commands/input/xkb_options.c | 2 +- sway/commands/input/xkb_rules.c | 2 +- sway/commands/input/xkb_variant.c | 2 +- sway/commands/kill.c | 1 - sway/commands/mode.c | 2 +- sway/commands/move.c | 15 +++++++-------- sway/commands/output.c | 2 +- sway/commands/output/background.c | 8 ++++---- sway/commands/reload.c | 2 +- sway/commands/rename.c | 2 +- sway/commands/resize.c | 1 - sway/commands/scratchpad.c | 8 ++++---- sway/commands/swap.c | 3 +-- sway/commands/swaybg_command.c | 2 +- sway/commands/swaynag_command.c | 2 +- sway/commands/xwayland.c | 2 +- 53 files changed, 79 insertions(+), 85 deletions(-) (limited to 'sway/commands') 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 #include -#include #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]'"); } - 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 #include #include -#include #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 #include -#include #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 #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 #include #include -#include #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 #include #include -#include #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 -#include #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 -- cgit v1.2.3-54-g00ecf