aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-20 13:51:12 -0500
committerLibravatar emersion <contact@emersion.fr>2019-01-21 12:59:42 +0100
commit1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 (patch)
tree5c3f60e0219cb8b4a1b7cafb760a871661866e32 /sway/commands.c
parentLog libinput_config_status errors (diff)
downloadsway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.gz
sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.zst
sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.zip
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/commands.c')
-rw-r--r--sway/commands.c16
1 files changed, 8 insertions, 8 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,
142 int handlers_size) { 142 int handlers_size) {
143 struct cmd_handler d = { .command=line }; 143 struct cmd_handler d = { .command=line };
144 struct cmd_handler *res = NULL; 144 struct cmd_handler *res = NULL;
145 wlr_log(WLR_DEBUG, "find_handler(%s)", line); 145 sway_log(SWAY_DEBUG, "find_handler(%s)", line);
146 146
147 bool config_loading = config->reading || !config->active; 147 bool config_loading = config->reading || !config->active;
148 148
@@ -247,10 +247,10 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
247 cmd = argsep(&cmdlist, ","); 247 cmd = argsep(&cmdlist, ",");
248 for (; isspace(*cmd); ++cmd) {} 248 for (; isspace(*cmd); ++cmd) {}
249 if (strcmp(cmd, "") == 0) { 249 if (strcmp(cmd, "") == 0) {
250 wlr_log(WLR_INFO, "Ignoring empty command."); 250 sway_log(SWAY_INFO, "Ignoring empty command.");
251 continue; 251 continue;
252 } 252 }
253 wlr_log(WLR_INFO, "Handling command '%s'", cmd); 253 sway_log(SWAY_INFO, "Handling command '%s'", cmd);
254 //TODO better handling of argv 254 //TODO better handling of argv
255 int argc; 255 int argc;
256 char **argv = split_args(cmd, &argc); 256 char **argv = split_args(cmd, &argc);
@@ -353,7 +353,7 @@ struct cmd_results *config_command(char *exec, char **new_block) {
353 } 353 }
354 354
355 // Determine the command handler 355 // Determine the command handler
356 wlr_log(WLR_INFO, "Config command: %s", exec); 356 sway_log(SWAY_INFO, "Config command: %s", exec);
357 struct cmd_handler *handler = find_handler(argv[0], NULL, 0); 357 struct cmd_handler *handler = find_handler(argv[0], NULL, 0);
358 if (!handler || !handler->handle) { 358 if (!handler || !handler->handle) {
359 const char *error = handler 359 const char *error = handler
@@ -373,7 +373,7 @@ struct cmd_results *config_command(char *exec, char **new_block) {
373 argv[1] = temp; 373 argv[1] = temp;
374 } 374 }
375 char *command = do_var_replacement(join_args(argv, argc)); 375 char *command = do_var_replacement(join_args(argv, argc));
376 wlr_log(WLR_INFO, "After replacement: %s", command); 376 sway_log(SWAY_INFO, "After replacement: %s", command);
377 free_argv(argc, argv); 377 free_argv(argc, argv);
378 argv = split_args(command, &argc); 378 argv = split_args(command, &argc);
379 free(command); 379 free(command);
@@ -402,7 +402,7 @@ cleanup:
402struct cmd_results *config_subcommand(char **argv, int argc, 402struct cmd_results *config_subcommand(char **argv, int argc,
403 struct cmd_handler *handlers, size_t handlers_size) { 403 struct cmd_handler *handlers, size_t handlers_size) {
404 char *command = join_args(argv, argc); 404 char *command = join_args(argv, argc);
405 wlr_log(WLR_DEBUG, "Subcommand: %s", command); 405 sway_log(SWAY_DEBUG, "Subcommand: %s", command);
406 free(command); 406 free(command);
407 407
408 struct cmd_handler *handler = find_handler(argv[0], handlers, 408 struct cmd_handler *handler = find_handler(argv[0], handlers,
@@ -489,7 +489,7 @@ struct cmd_results *config_commands_command(char *exec) {
489 } 489 }
490 policy->context = context; 490 policy->context = context;
491 491
492 wlr_log(WLR_INFO, "Set command policy for %s to %d", 492 sway_log(SWAY_INFO, "Set command policy for %s to %d",
493 policy->command, policy->context); 493 policy->command, policy->context);
494 494
495 results = cmd_results_new(CMD_SUCCESS, NULL); 495 results = cmd_results_new(CMD_SUCCESS, NULL);
@@ -503,7 +503,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
503 const char *format, ...) { 503 const char *format, ...) {
504 struct cmd_results *results = malloc(sizeof(struct cmd_results)); 504 struct cmd_results *results = malloc(sizeof(struct cmd_results));
505 if (!results) { 505 if (!results) {
506 wlr_log(WLR_ERROR, "Unable to allocate command results"); 506 sway_log(SWAY_ERROR, "Unable to allocate command results");
507 return NULL; 507 return NULL;
508 } 508 }
509 results->status = status; 509 results->status = status;