aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/ipc-client.c2
-rw-r--r--common/readline.c4
-rw-r--r--common/util.c2
-rw-r--r--include/log.h25
-rw-r--r--sway/commands.c12
-rw-r--r--sway/commands/bind.c8
-rw-r--r--sway/commands/exec.c2
-rw-r--r--sway/commands/exec_always.c8
-rw-r--r--sway/commands/input.c2
-rw-r--r--sway/commands/input/click_method.c2
-rw-r--r--sway/commands/input/events.c2
-rw-r--r--sway/commands/input/tap.c4
-rw-r--r--sway/commands/input/xkb_layout.c4
-rw-r--r--sway/commands/input/xkb_model.c4
-rw-r--r--sway/commands/input/xkb_options.c4
-rw-r--r--sway/commands/input/xkb_rules.c4
-rw-r--r--sway/commands/input/xkb_variant.c4
-rw-r--r--sway/commands/output.c8
-rw-r--r--sway/commands/seat.c2
-rw-r--r--sway/commands/set.c2
-rw-r--r--sway/config.c66
-rw-r--r--sway/config/input.c6
-rw-r--r--sway/config/output.c16
-rw-r--r--sway/config/seat.c6
-rw-r--r--sway/desktop/output.c4
-rw-r--r--sway/desktop/wl_shell.c2
-rw-r--r--sway/desktop/xdg_shell_v6.c2
-rw-r--r--sway/desktop/xwayland.c2
-rw-r--r--sway/input/cursor.c12
-rw-r--r--sway/input/input-manager.c36
-rw-r--r--sway/input/keyboard.c6
-rw-r--r--sway/input/seat.c8
-rw-r--r--sway/ipc-server.c50
-rw-r--r--sway/tree/container.c14
-rw-r--r--sway/tree/layout.c20
-rw-r--r--sway/tree/workspace.c2
36 files changed, 167 insertions, 190 deletions
diff --git a/common/ipc-client.c b/common/ipc-client.c
index 1ab6627b..582c5e86 100644
--- a/common/ipc-client.c
+++ b/common/ipc-client.c
@@ -79,7 +79,7 @@ struct ipc_response *ipc_recv_response(int socketfd) {
error_2:
free(response);
error_1:
- sway_log(L_ERROR, "Unable to allocate memory for IPC response");
+ wlr_log(L_ERROR, "Unable to allocate memory for IPC response");
return NULL;
}
diff --git a/common/readline.c b/common/readline.c
index cc40a2cc..ed5801de 100644
--- a/common/readline.c
+++ b/common/readline.c
@@ -8,7 +8,7 @@ char *read_line(FILE *file) {
char *string = malloc(size);
char lastChar = '\0';
if (!string) {
- sway_log(L_ERROR, "Unable to allocate memory for read_line");
+ wlr_log(L_ERROR, "Unable to allocate memory for read_line");
return NULL;
}
while (1) {
@@ -29,7 +29,7 @@ char *read_line(FILE *file) {
char *new_string = realloc(string, size *= 2);
if (!new_string) {
free(string);
- sway_log(L_ERROR, "Unable to allocate memory for read_line");
+ wlr_log(L_ERROR, "Unable to allocate memory for read_line");
return NULL;
}
string = new_string;
diff --git a/common/util.c b/common/util.c
index 83981160..fb7f9454 100644
--- a/common/util.c
+++ b/common/util.c
@@ -113,7 +113,7 @@ uint32_t parse_color(const char *color) {
int len = strlen(color);
if (len != 6 && len != 8) {
- sway_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
+ wlr_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
return 0xFFFFFFFF;
}
uint32_t res = (uint32_t)strtoul(color, NULL, 16);
diff --git a/include/log.h b/include/log.h
index a1e33fa2..646776f5 100644
--- a/include/log.h
+++ b/include/log.h
@@ -1,22 +1,7 @@
#ifndef _SWAY_LOG_H
#define _SWAY_LOG_H
#include <stdbool.h>
-
-typedef enum {
- L_SILENT = 0,
- L_ERROR = 1,
- L_INFO = 2,
- L_DEBUG = 3,
-} log_importance_t;
-
-void init_log(log_importance_t verbosity);
-void set_log_level(log_importance_t verbosity);
-log_importance_t get_log_level(void);
-void reset_log_level(void);
-// returns whether debug logging is on after switching.
-bool toggle_debug_logging(void);
-void sway_log_colors(int mode);
-void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3)));
+#include <wlr/util/log.h>
void _sway_abort(const char *filename, int line, const char* format, ...) __attribute__((format(printf,3,4)));
#define sway_abort(FMT, ...) \
@@ -26,14 +11,6 @@ bool _sway_assert(bool condition, const char *filename, int line, const char* fo
#define sway_assert(COND, FMT, ...) \
_sway_assert(COND, __FILE__, __LINE__, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__)
-void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5)));
-
-#define sway_log(VERBOSITY, FMT, ...) \
- _sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__)
-
-#define sway_vlog(VERBOSITY, FMT, VA_ARGS) \
- _sway_vlog(__FILE__, __LINE__, VERBOSITY, FMT, VA_ARGS)
-
void error_handler(int sig);
#endif
diff --git a/sway/commands.c b/sway/commands.c
index f01329db..1005cf68 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -176,7 +176,7 @@ static struct cmd_handler seat_handlers[] = {
static struct cmd_handler *find_handler(char *line, enum cmd_status block) {
struct cmd_handler d = { .command=line };
struct cmd_handler *res = NULL;
- sway_log(L_DEBUG, "find_handler(%s) %d", line, block == CMD_BLOCK_SEAT);
+ wlr_log(L_DEBUG, "find_handler(%s) %d", line, block == CMD_BLOCK_SEAT);
if (block == CMD_BLOCK_INPUT) {
res = bsearch(&d, input_handlers,
@@ -215,10 +215,10 @@ struct cmd_results *handle_command(char *_exec) {
cmd = argsep(&cmdlist, ",");
cmd += strspn(cmd, whitespace);
if (strcmp(cmd, "") == 0) {
- sway_log(L_INFO, "Ignoring empty command.");
+ wlr_log(L_INFO, "Ignoring empty command.");
continue;
}
- sway_log(L_INFO, "Handling command '%s'", cmd);
+ wlr_log(L_INFO, "Handling command '%s'", cmd);
//TODO better handling of argv
int argc;
char **argv = split_args(cmd, &argc);
@@ -276,7 +276,7 @@ struct cmd_results *config_command(char *exec, enum cmd_status block) {
goto cleanup;
}
- sway_log(L_INFO, "handling config command '%s'", exec);
+ wlr_log(L_INFO, "handling config command '%s'", exec);
// Endblock
if (**argv == '}') {
results = cmd_results_new(CMD_BLOCK_END, NULL, NULL);
@@ -380,7 +380,7 @@ struct cmd_results *config_commands_command(char *exec) {
}
policy->context = context;
- sway_log(L_INFO, "Set command policy for %s to %d",
+ wlr_log(L_INFO, "Set command policy for %s to %d",
policy->command, policy->context);
results = cmd_results_new(CMD_SUCCESS, NULL, NULL);
@@ -394,7 +394,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
const char *input, const char *format, ...) {
struct cmd_results *results = malloc(sizeof(struct cmd_results));
if (!results) {
- sway_log(L_ERROR, "Unable to allocate command results");
+ wlr_log(L_ERROR, "Unable to allocate command results");
return NULL;
}
results->status = status;
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 79121404..cbabb07b 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -145,7 +145,7 @@ struct cmd_results *cmd_bindsym(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)) {
- sway_log(L_DEBUG, "overwriting old binding with command '%s'",
+ wlr_log(L_DEBUG, "overwriting old binding with command '%s'",
config_binding->command);
free_sway_binding(config_binding);
mode_bindings->items[i] = binding;
@@ -157,7 +157,7 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) {
list_add(mode_bindings, binding);
}
- sway_log(L_DEBUG, "bindsym - Bound %s to command %s",
+ wlr_log(L_DEBUG, "bindsym - Bound %s to command %s",
argv[0], binding->command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
@@ -227,7 +227,7 @@ struct cmd_results *cmd_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)) {
- sway_log(L_DEBUG, "overwriting old binding with command '%s'",
+ wlr_log(L_DEBUG, "overwriting old binding with command '%s'",
config_binding->command);
free_sway_binding(config_binding);
mode_bindings->items[i] = binding;
@@ -239,7 +239,7 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
list_add(mode_bindings, binding);
}
- sway_log(L_DEBUG, "bindcode - Bound %s to command %s",
+ wlr_log(L_DEBUG, "bindcode - Bound %s to command %s",
argv[0], binding->command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
diff --git a/sway/commands/exec.c b/sway/commands/exec.c
index fbbc4941..363d5bef 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, "exec", NULL);
if (config->reloading) {
char *args = join_args(argv, argc);
- sway_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args);
+ wlr_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args);
free(args);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 9527a487..61870c51 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -20,7 +20,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
char *tmp = NULL;
if (strcmp((char*)*argv, "--no-startup-id") == 0) {
- sway_log(L_INFO, "exec switch '--no-startup-id' not supported, ignored.");
+ wlr_log(L_INFO, "exec switch '--no-startup-id' not supported, ignored.");
if ((error = checkarg(argc - 1, "exec_always", EXPECTED_MORE_THAN, 0))) {
return error;
}
@@ -35,11 +35,11 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
strncpy(cmd, tmp, sizeof(cmd));
cmd[sizeof(cmd) - 1] = 0;
free(tmp);
- sway_log(L_DEBUG, "Executing %s", cmd);
+ wlr_log(L_DEBUG, "Executing %s", cmd);
int fd[2];
if (pipe(fd) != 0) {
- sway_log(L_ERROR, "Unable to create pipe for fork");
+ wlr_log(L_ERROR, "Unable to create pipe for fork");
}
pid_t pid;
@@ -75,7 +75,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
// cleanup child process
wait(0);
if (*child > 0) {
- sway_log(L_DEBUG, "Child process created with pid %d", *child);
+ wlr_log(L_DEBUG, "Child process created with pid %d", *child);
// TODO: add PID to active workspace
} else {
free(child);
diff --git a/sway/commands/input.c b/sway/commands/input.c
index edf45e4c..5ea39f62 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -12,7 +12,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
if (config->reading && strcmp("{", argv[1]) == 0) {
current_input_config = new_input_config(argv[0]);
- sway_log(L_DEBUG, "entering input block: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "entering input block: %s", current_input_config->identifier);
return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL);
}
diff --git a/sway/commands/input/click_method.c b/sway/commands/input/click_method.c
index dcf64c1a..22eb15f7 100644
--- a/sway/commands/input/click_method.c
+++ b/sway/commands/input/click_method.c
@@ -6,7 +6,7 @@
#include "log.h"
struct cmd_results *input_cmd_click_method(int argc, char **argv) {
- sway_log(L_DEBUG, "click_method for device: %d %s",
+ wlr_log(L_DEBUG, "click_method for device: %d %s",
current_input_config==NULL, current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "click_method", EXPECTED_AT_LEAST, 1))) {
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c
index 8a74c11e..a1bfbacd 100644
--- a/sway/commands/input/events.c
+++ b/sway/commands/input/events.c
@@ -6,7 +6,7 @@
#include "log.h"
struct cmd_results *input_cmd_events(int argc, char **argv) {
- sway_log(L_DEBUG, "events for device: %s",
+ wlr_log(L_DEBUG, "events for device: %s",
current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) {
diff --git a/sway/commands/input/tap.c b/sway/commands/input/tap.c
index 8547c0cd..ecab9a5b 100644
--- a/sway/commands/input/tap.c
+++ b/sway/commands/input/tap.c
@@ -6,7 +6,7 @@
#include "log.h"
struct cmd_results *input_cmd_tap(int argc, char **argv) {
- sway_log(L_DEBUG, "tap for device: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "tap for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "tap", EXPECTED_AT_LEAST, 1))) {
return error;
@@ -26,7 +26,7 @@ struct cmd_results *input_cmd_tap(int argc, char **argv) {
"Expected 'tap <enabled|disabled>'");
}
- sway_log(L_DEBUG, "apply-tap for device: %s",
+ wlr_log(L_DEBUG, "apply-tap for device: %s",
current_input_config->identifier);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/input/xkb_layout.c b/sway/commands/input/xkb_layout.c
index a25d3850..25db1a33 100644
--- a/sway/commands/input/xkb_layout.c
+++ b/sway/commands/input/xkb_layout.c
@@ -5,7 +5,7 @@
#include "log.h"
struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
- sway_log(L_DEBUG, "xkb layout for device: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "xkb layout for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_layout", EXPECTED_EQUAL_TO, 1))) {
return error;
@@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
new_config->xkb_layout = strdup(argv[0]);
- sway_log(L_DEBUG, "apply-xkb_layout for device: %s layout: %s",
+ wlr_log(L_DEBUG, "apply-xkb_layout for device: %s layout: %s",
current_input_config->identifier, new_config->xkb_layout);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/input/xkb_model.c b/sway/commands/input/xkb_model.c
index 9729e869..819b796b 100644
--- a/sway/commands/input/xkb_model.c
+++ b/sway/commands/input/xkb_model.c
@@ -5,7 +5,7 @@
#include "log.h"
struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
- sway_log(L_DEBUG, "xkb model for device: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "xkb model for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_model", EXPECTED_EQUAL_TO, 1))) {
return error;
@@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
new_config->xkb_model = strdup(argv[0]);
- sway_log(L_DEBUG, "apply-xkb_model for device: %s model: %s",
+ wlr_log(L_DEBUG, "apply-xkb_model for device: %s model: %s",
current_input_config->identifier, new_config->xkb_model);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/input/xkb_options.c b/sway/commands/input/xkb_options.c
index 504849cc..ff5f83ec 100644
--- a/sway/commands/input/xkb_options.c
+++ b/sway/commands/input/xkb_options.c
@@ -5,7 +5,7 @@
#include "log.h"
struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
- sway_log(L_DEBUG, "xkb options for device: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "xkb options for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_options", EXPECTED_EQUAL_TO, 1))) {
return error;
@@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
new_config->xkb_options = strdup(argv[0]);
- sway_log(L_DEBUG, "apply-xkb_options for device: %s options: %s",
+ wlr_log(L_DEBUG, "apply-xkb_options for device: %s options: %s",
current_input_config->identifier, new_config->xkb_options);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/input/xkb_rules.c b/sway/commands/input/xkb_rules.c
index db7d8abe..aafe0003 100644
--- a/sway/commands/input/xkb_rules.c
+++ b/sway/commands/input/xkb_rules.c
@@ -5,7 +5,7 @@
#include "log.h"
struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
- sway_log(L_DEBUG, "xkb rules for device: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "xkb rules for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_rules", EXPECTED_EQUAL_TO, 1))) {
return error;
@@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
new_config->xkb_rules = strdup(argv[0]);
- sway_log(L_DEBUG, "apply-xkb_rules for device: %s rules: %s",
+ wlr_log(L_DEBUG, "apply-xkb_rules for device: %s rules: %s",
current_input_config->identifier, new_config->xkb_rules);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/input/xkb_variant.c b/sway/commands/input/xkb_variant.c
index 855e6abc..89a61fdc 100644
--- a/sway/commands/input/xkb_variant.c
+++ b/sway/commands/input/xkb_variant.c
@@ -5,7 +5,7 @@
#include "log.h"
struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
- sway_log(L_DEBUG, "xkb variant for device: %s", current_input_config->identifier);
+ wlr_log(L_DEBUG, "xkb variant for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_variant", EXPECTED_EQUAL_TO, 1))) {
return error;
@@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
new_config->xkb_variant = strdup(argv[0]);
- sway_log(L_DEBUG, "apply-xkb_variant for device: %s variant: %s",
+ wlr_log(L_DEBUG, "apply-xkb_variant for device: %s variant: %s",
current_input_config->identifier, new_config->xkb_variant);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/output.c b/sway/commands/output.c
index 8c0fa63c..e747eb4e 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -203,12 +203,12 @@ static struct cmd_results *cmd_output_background(struct output_config *output,
if (src) {
sprintf(src, "%s/%s", conf_path, p.we_wordv[0]);
} else {
- sway_log(L_ERROR,
+ wlr_log(L_ERROR,
"Unable to allocate background source");
}
free(conf);
} else {
- sway_log(L_ERROR, "Unable to allocate background source");
+ wlr_log(L_ERROR, "Unable to allocate background source");
}
}
if (!src || access(src, F_OK) == -1) {
@@ -238,7 +238,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
struct output_config *output = new_output_config(argv[0]);
if (!output) {
- sway_log(L_ERROR, "Failed to allocate output config");
+ wlr_log(L_ERROR, "Failed to allocate output config");
return NULL;
}
@@ -284,7 +284,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
list_add(config->output_configs, output);
}
- sway_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
+ wlr_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
"position %d,%d scale %f transform %d) (bg %s %s)",
output->name, output->enabled, output->width, output->height,
output->refresh_rate, output->x, output->y, output->scale,
diff --git a/sway/commands/seat.c b/sway/commands/seat.c
index 155bc510..6284002b 100644
--- a/sway/commands/seat.c
+++ b/sway/commands/seat.c
@@ -12,7 +12,7 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
if (config->reading && strcmp("{", argv[1]) == 0) {
current_seat_config = new_seat_config(argv[0]);
- sway_log(L_DEBUG, "entering seat block: %s", current_seat_config->name);
+ wlr_log(L_DEBUG, "entering seat block: %s", current_seat_config->name);
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
}
diff --git a/sway/commands/set.c b/sway/commands/set.c
index dcd928ba..856c73e7 100644
--- a/sway/commands/set.c
+++ b/sway/commands/set.c
@@ -33,7 +33,7 @@ struct cmd_results *cmd_set(int argc, char **argv) {
}
if (argv[0][0] != '$') {
- sway_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
+ wlr_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
size_t size = snprintf(NULL, 0, "$%s", argv[0]);
tmp = malloc(size + 1);
diff --git a/sway/config.c b/sway/config.c
index e0a93e19..5ec45b17 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -232,12 +232,12 @@ static char *get_config_path(void) {
char *home = getenv("HOME");
char *config_home = malloc(strlen(home) + strlen("/.config") + 1);
if (!config_home) {
- sway_log(L_ERROR, "Unable to allocate $HOME/.config");
+ wlr_log(L_ERROR, "Unable to allocate $HOME/.config");
} else {
strcpy(config_home, home);
strcat(config_home, "/.config");
setenv("XDG_CONFIG_HOME", config_home, 1);
- sway_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
+ wlr_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
free(config_home);
}
}
@@ -263,7 +263,7 @@ static char *get_config_path(void) {
const char *current_config_path;
static bool load_config(const char *path, struct sway_config *config) {
- sway_log(L_INFO, "Loading config from %s", path);
+ wlr_log(L_INFO, "Loading config from %s", path);
current_config_path = path;
struct stat sb;
@@ -272,13 +272,13 @@ static bool load_config(const char *path, struct sway_config *config) {
}
if (path == NULL) {
- sway_log(L_ERROR, "Unable to find a config file!");
+ wlr_log(L_ERROR, "Unable to find a config file!");
return false;
}
FILE *f = fopen(path, "r");
if (!f) {
- sway_log(L_ERROR, "Unable to open %s for reading", path);
+ wlr_log(L_ERROR, "Unable to open %s for reading", path);
return false;
}
@@ -286,7 +286,7 @@ static bool load_config(const char *path, struct sway_config *config) {
fclose(f);
if (!config_load_success) {
- sway_log(L_ERROR, "Error(s) loading config!");
+ wlr_log(L_ERROR, "Error(s) loading config!");
}
current_config_path = NULL;
@@ -313,7 +313,7 @@ bool load_main_config(const char *file, bool is_active) {
config_defaults(config);
if (is_active) {
- sway_log(L_DEBUG, "Performing configuration file reload");
+ wlr_log(L_DEBUG, "Performing configuration file reload");
config->reloading = true;
config->active = true;
}
@@ -327,7 +327,7 @@ bool load_main_config(const char *file, bool is_active) {
bool success = true;
DIR *dir = opendir(SYSCONFDIR "/sway/security.d");
if (!dir) {
- sway_log(L_ERROR,
+ wlr_log(L_ERROR,
"%s does not exist, sway will have no security configuration"
" and will probably be broken", SYSCONFDIR "/sway/security.d");
} else {
@@ -356,7 +356,7 @@ bool load_main_config(const char *file, bool is_active) {
if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 ||
(((s.st_mode & 0777) != 0644) &&
(s.st_mode & 0777) != 0444)) {
- sway_log(L_ERROR,
+ wlr_log(L_ERROR,
"Refusing to load %s - it must be owned by root "
"and mode 644 or 444", _path);
success = false;
@@ -398,7 +398,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) {
- sway_log(L_ERROR,
+ wlr_log(L_ERROR,
"Unable to allocate full path to included config");
return false;
}
@@ -409,7 +409,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
free(full_path);
if (real_path == NULL) {
- sway_log(L_DEBUG, "%s not found.", path);
+ wlr_log(L_DEBUG, "%s not found.", path);
return false;
}
@@ -418,7 +418,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) {
- sway_log(L_DEBUG,
+ wlr_log(L_DEBUG,
"%s already included once, won't be included again.",
real_path);
free(real_path);
@@ -472,7 +472,7 @@ bool load_include_configs(const char *path, struct sway_config *config) {
// restore wd
if (chdir(wd) < 0) {
free(wd);
- sway_log(L_ERROR, "failed to restore working directory");
+ wlr_log(L_ERROR, "failed to restore working directory");
return false;
}
@@ -508,13 +508,13 @@ bool read_config(FILE *file, struct sway_config *config) {
switch(res->status) {
case CMD_FAILURE:
case CMD_INVALID:
- sway_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number,
+ wlr_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number,
line, res->error, config->current_config);
success = false;
break;
case CMD_DEFER:
- sway_log(L_DEBUG, "Deferring command `%s'", line);
+ wlr_log(L_DEBUG, "Deferring command `%s'", line);
list_add(config->cmd_queue, strdup(line));
break;
@@ -522,7 +522,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_MODE;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -530,7 +530,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_INPUT;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -538,7 +538,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_SEAT;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -546,7 +546,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_BAR;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -554,7 +554,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_BAR) {
block = CMD_BLOCK_BAR_COLORS;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -562,7 +562,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_COMMANDS;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -570,7 +570,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_IPC;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
@@ -578,59 +578,59 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_IPC) {
block = CMD_BLOCK_IPC_EVENTS;
} else {
- sway_log(L_ERROR, "Invalid block '%s'", line);
+ wlr_log(L_ERROR, "Invalid block '%s'", line);
}
break;
case CMD_BLOCK_END:
switch(block) {
case CMD_BLOCK_MODE:
- sway_log(L_DEBUG, "End of mode block");
+ wlr_log(L_DEBUG, "End of mode block");
config->current_mode = config->modes->items[0];
block = CMD_BLOCK_END;
break;
case CMD_BLOCK_INPUT:
- sway_log(L_DEBUG, "End of input block");
+ wlr_log(L_DEBUG, "End of input block");
free_input_config(current_input_config);
current_input_config = NULL;
block = CMD_BLOCK_END;
break;
case CMD_BLOCK_SEAT:
- sway_log(L_DEBUG, "End of seat block");
+ wlr_log(L_DEBUG, "End of seat block");
current_seat_config = NULL;
block = CMD_BLOCK_END;
break;
case CMD_BLOCK_BAR:
- sway_log(L_DEBUG, "End of bar block");
+ wlr_log(L_DEBUG, "End of bar block");
config->current_bar = NULL;
block = CMD_BLOCK_END;
break;
case CMD_BLOCK_BAR_COLORS:
- sway_log(L_DEBUG, "End of bar colors block");
+ wlr_log(L_DEBUG, "End of bar colors block");
block = CMD_BLOCK_BAR;
break;
case CMD_BLOCK_COMMANDS:
- sway_log(L_DEBUG, "End of commands block");
+ wlr_log(L_DEBUG, "End of commands block");
block = CMD_BLOCK_END;
break;
case CMD_BLOCK_IPC:
- sway_log(L_DEBUG, "End of IPC block");
+ wlr_log(L_DEBUG, "End of IPC block");
block = CMD_BLOCK_END;
break;
case CMD_BLOCK_IPC_EVENTS:
- sway_log(L_DEBUG, "End of IPC events block");
+ wlr_log(L_DEBUG, "End of IPC events block");
block = CMD_BLOCK_IPC;
break;
case CMD_BLOCK_END:
- sway_log(L_ERROR, "Unmatched }");
+ wlr_log(L_ERROR, "Unmatched }");
break;
default:;
@@ -663,7 +663,7 @@ char *do_var_replacement(char *str) {
int vvlen = strlen(var->value);
char *newstr = malloc(strlen(str) - vnlen + vvlen + 1);
if (!newstr) {
- sway_log(L_E