aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/i3bar.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 /swaybar/i3bar.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 'swaybar/i3bar.c')
-rw-r--r--swaybar/i3bar.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c
index 8bca1bf9..e938694c 100644
--- a/swaybar/i3bar.c
+++ b/swaybar/i3bar.c
@@ -5,7 +5,7 @@
5#include <stdlib.h> 5#include <stdlib.h>
6#include <string.h> 6#include <string.h>
7#include <unistd.h> 7#include <unistd.h>
8#include <wlr/util/log.h> 8#include "log.h"
9#include "swaybar/bar.h" 9#include "swaybar/bar.h"
10#include "swaybar/config.h" 10#include "swaybar/config.h"
11#include "swaybar/i3bar.h" 11#include "swaybar/i3bar.h"
@@ -120,7 +120,7 @@ bool i3bar_handle_readable(struct status_line *status) {
120 memmove(status->buffer, &status->buffer[c], status->buffer_index); 120 memmove(status->buffer, &status->buffer[c], status->buffer_index);
121 break; 121 break;
122 } else if (!isspace(status->buffer[c])) { 122 } else if (!isspace(status->buffer[c])) {
123 wlr_log(WLR_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'", 123 sway_log(SWAY_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'",
124 status->buffer[c]); 124 status->buffer[c]);
125 status_error(status, "[invalid i3bar json]"); 125 status_error(status, "[invalid i3bar json]");
126 return true; 126 return true;
@@ -160,7 +160,7 @@ bool i3bar_handle_readable(struct status_line *status) {
160 ++buffer_pos; 160 ++buffer_pos;
161 break; 161 break;
162 } else if (!isspace(status->buffer[buffer_pos])) { 162 } else if (!isspace(status->buffer[buffer_pos])) {
163 wlr_log(WLR_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'", 163 sway_log(SWAY_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'",
164 status->buffer[buffer_pos]); 164 status->buffer[buffer_pos]);
165 status_error(status, "[invalid i3bar json]"); 165 status_error(status, "[invalid i3bar json]");
166 return true; 166 return true;
@@ -195,7 +195,7 @@ bool i3bar_handle_readable(struct status_line *status) {
195 } 195 }
196 *last_char_pos = '\0'; 196 *last_char_pos = '\0';
197 size_t offset = strspn(&status->buffer[buffer_pos], " \f\n\r\t\v"); 197 size_t offset = strspn(&status->buffer[buffer_pos], " \f\n\r\t\v");
198 wlr_log(WLR_DEBUG, "Received i3bar json: '%s%c'", 198 sway_log(SWAY_DEBUG, "Received i3bar json: '%s%c'",
199 &status->buffer[buffer_pos + offset], last_char); 199 &status->buffer[buffer_pos + offset], last_char);
200 *last_char_pos = last_char; 200 *last_char_pos = last_char;
201 201
@@ -229,7 +229,7 @@ bool i3bar_handle_readable(struct status_line *status) {
229 } else { 229 } else {
230 char last_char = status->buffer[status->buffer_index - 1]; 230 char last_char = status->buffer[status->buffer_index - 1];
231 status->buffer[status->buffer_index - 1] = '\0'; 231 status->buffer[status->buffer_index - 1] = '\0';
232 wlr_log(WLR_DEBUG, "Failed to parse i3bar json - %s: '%s%c'", 232 sway_log(SWAY_DEBUG, "Failed to parse i3bar json - %s: '%s%c'",
233 json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char); 233 json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char);
234 status_error(status, "[failed to parse i3bar json]"); 234 status_error(status, "[failed to parse i3bar json]");
235 return true; 235 return true;
@@ -250,7 +250,7 @@ bool i3bar_handle_readable(struct status_line *status) {
250 } 250 }
251 251
252 if (last_object) { 252 if (last_object) {
253 wlr_log(WLR_DEBUG, "Rendering last received json"); 253 sway_log(SWAY_DEBUG, "Rendering last received json");
254 i3bar_parse_json(status, last_object); 254 i3bar_parse_json(status, last_object);
255 json_object_put(last_object); 255 json_object_put(last_object);
256 return true; 256 return true;
@@ -262,7 +262,7 @@ bool i3bar_handle_readable(struct status_line *status) {
262enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, 262enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
263 struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h, 263 struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h,
264 uint32_t button) { 264 uint32_t button) {
265 wlr_log(WLR_DEBUG, "block %s clicked", block->name); 265 sway_log(SWAY_DEBUG, "block %s clicked", block->name);
266 if (!block->name || !status->click_events) { 266 if (!block->name || !status->click_events) {
267 return HOTSPOT_PROCESS; 267 return HOTSPOT_PROCESS;
268 } 268 }