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 /swaybar/ipc.c | |
parent | Log libinput_config_status errors (diff) | |
download | sway-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 'swaybar/ipc.c')
-rw-r--r-- | swaybar/ipc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 5565dc76..29b782bb 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -3,12 +3,12 @@ | |||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <strings.h> | 4 | #include <strings.h> |
5 | #include <json-c/json.h> | 5 | #include <json-c/json.h> |
6 | #include <wlr/util/log.h> | ||
7 | #include "swaybar/config.h" | 6 | #include "swaybar/config.h" |
8 | #include "swaybar/ipc.h" | 7 | #include "swaybar/ipc.h" |
9 | #include "config.h" | 8 | #include "config.h" |
10 | #include "ipc-client.h" | 9 | #include "ipc-client.h" |
11 | #include "list.h" | 10 | #include "list.h" |
11 | #include "log.h" | ||
12 | 12 | ||
13 | void ipc_send_workspace_command(struct swaybar *bar, const char *ws) { | 13 | void ipc_send_workspace_command(struct swaybar *bar, const char *ws) { |
14 | const char *fmt = "workspace \"%s\""; | 14 | const char *fmt = "workspace \"%s\""; |
@@ -150,7 +150,7 @@ static bool ipc_parse_config( | |||
150 | json_object *success; | 150 | json_object *success; |
151 | if (json_object_object_get_ex(bar_config, "success", &success) | 151 | if (json_object_object_get_ex(bar_config, "success", &success) |
152 | && !json_object_get_boolean(success)) { | 152 | && !json_object_get_boolean(success)) { |
153 | wlr_log(WLR_ERROR, "No bar with that ID. Use 'swaymsg -t get_bar_config to get the available bar configs."); | 153 | sway_log(SWAY_ERROR, "No bar with that ID. Use 'swaymsg -t get_bar_config to get the available bar configs."); |
154 | json_object_put(bar_config); | 154 | json_object_put(bar_config); |
155 | return false; | 155 | return false; |
156 | } | 156 | } |
@@ -441,7 +441,7 @@ static void ipc_get_outputs(struct swaybar *bar) { | |||
441 | } | 441 | } |
442 | 442 | ||
443 | void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) { | 443 | void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) { |
444 | wlr_log(WLR_DEBUG, "Executing binding for button %u (release=%d): `%s`", | 444 | sway_log(SWAY_DEBUG, "Executing binding for button %u (release=%d): `%s`", |
445 | bind->button, bind->release, bind->command); | 445 | bind->button, bind->release, bind->command); |
446 | uint32_t len = strlen(bind->command); | 446 | uint32_t len = strlen(bind->command); |
447 | free(ipc_single_command(bar->ipc_socketfd, | 447 | free(ipc_single_command(bar->ipc_socketfd, |
@@ -500,7 +500,7 @@ static bool handle_barconfig_update(struct swaybar *bar, | |||
500 | const char *new_state = json_object_get_string(json_state); | 500 | const char *new_state = json_object_get_string(json_state); |
501 | char *old_state = config->hidden_state; | 501 | char *old_state = config->hidden_state; |
502 | if (strcmp(new_state, old_state) != 0) { | 502 | if (strcmp(new_state, old_state) != 0) { |
503 | wlr_log(WLR_DEBUG, "Changing bar hidden state to %s", new_state); | 503 | sway_log(SWAY_DEBUG, "Changing bar hidden state to %s", new_state); |
504 | free(old_state); | 504 | free(old_state); |
505 | config->hidden_state = strdup(new_state); | 505 | config->hidden_state = strdup(new_state); |
506 | return determine_bar_visibility(bar, false); | 506 | return determine_bar_visibility(bar, false); |
@@ -510,7 +510,7 @@ static bool handle_barconfig_update(struct swaybar *bar, | |||
510 | json_object *json_mode; | 510 | json_object *json_mode; |
511 | json_object_object_get_ex(json_config, "mode", &json_mode); | 511 | json_object_object_get_ex(json_config, "mode", &json_mode); |
512 | config->mode = strdup(json_object_get_string(json_mode)); | 512 | config->mode = strdup(json_object_get_string(json_mode)); |
513 | wlr_log(WLR_DEBUG, "Changing bar mode to %s", config->mode); | 513 | sway_log(SWAY_DEBUG, "Changing bar mode to %s", config->mode); |
514 | 514 | ||
515 | json_object *gaps; | 515 | json_object *gaps; |
516 | json_object_object_get_ex(json_config, "gaps", &gaps); | 516 | json_object_object_get_ex(json_config, "gaps", &gaps); |
@@ -544,7 +544,7 @@ bool handle_ipc_readable(struct swaybar *bar) { | |||
544 | 544 | ||
545 | json_object *result = json_tokener_parse(resp->payload); | 545 | json_object *result = json_tokener_parse(resp->payload); |
546 | if (!result) { | 546 | if (!result) { |
547 | wlr_log(WLR_ERROR, "failed to parse payload as json"); | 547 | sway_log(SWAY_ERROR, "failed to parse payload as json"); |
548 | free_ipc_response(resp); | 548 | free_ipc_response(resp); |
549 | return false; | 549 | return false; |
550 | } | 550 | } |
@@ -561,7 +561,7 @@ bool handle_ipc_readable(struct swaybar *bar) { | |||
561 | free(bar->mode); | 561 | free(bar->mode); |
562 | bar->mode = strcmp(change, "default") != 0 ? strdup(change) : NULL; | 562 | bar->mode = strcmp(change, "default") != 0 ? strdup(change) : NULL; |
563 | } else { | 563 | } else { |
564 | wlr_log(WLR_ERROR, "failed to parse response"); | 564 | sway_log(SWAY_ERROR, "failed to parse response"); |
565 | bar_is_dirty = false; | 565 | bar_is_dirty = false; |
566 | break; | 566 | break; |
567 | } | 567 | } |