aboutsummaryrefslogtreecommitdiffstats
path: root/swaybg
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 /swaybg
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 'swaybg')
-rw-r--r--swaybg/main.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/swaybg/main.c b/swaybg/main.c
index 5678a671..e66221f0 100644
--- a/swaybg/main.c
+++ b/swaybg/main.c
@@ -6,9 +6,9 @@
6#include <string.h> 6#include <string.h>
7#include <time.h> 7#include <time.h>
8#include <wayland-client.h> 8#include <wayland-client.h>
9#include <wlr/util/log.h>
10#include "background-image.h" 9#include "background-image.h"
11#include "cairo.h" 10#include "cairo.h"
11#include "log.h"
12#include "pool-buffer.h" 12#include "pool-buffer.h"
13#include "util.h" 13#include "util.h"
14#include "wlr-layer-shell-unstable-v1-client-protocol.h" 14#include "wlr-layer-shell-unstable-v1-client-protocol.h"
@@ -62,7 +62,7 @@ struct swaybg_state {
62bool is_valid_color(const char *color) { 62bool is_valid_color(const char *color) {
63 int len = strlen(color); 63 int len = strlen(color);
64 if (len != 7 || color[0] != '#') { 64 if (len != 7 || color[0] != '#') {
65 wlr_log(WLR_ERROR, "%s is not a valid color for swaybg. " 65 sway_log(SWAY_ERROR, "%s is not a valid color for swaybg. "
66 "Color should be specified as #rrggbb (no alpha).", color); 66 "Color should be specified as #rrggbb (no alpha).", color);
67 return false; 67 return false;
68 } 68 }
@@ -253,14 +253,14 @@ static const struct wl_registry_listener registry_listener = {
253}; 253};
254 254
255int main(int argc, const char **argv) { 255int main(int argc, const char **argv) {
256 wlr_log_init(WLR_DEBUG, NULL); 256 sway_log_init(SWAY_DEBUG, NULL);
257 257
258 struct swaybg_args args = {0}; 258 struct swaybg_args args = {0};
259 struct swaybg_state state = { .args = &args }; 259 struct swaybg_state state = { .args = &args };
260 wl_list_init(&state.outputs); 260 wl_list_init(&state.outputs);
261 261
262 if (argc < 4 || argc > 5) { 262 if (argc < 4 || argc > 5) {
263 wlr_log(WLR_ERROR, "Do not run this program manually. " 263 sway_log(SWAY_ERROR, "Do not run this program manually. "
264 "See `man 5 sway-output` and look for background options."); 264 "See `man 5 sway-output` and look for background options.");
265 return 1; 265 return 1;
266 } 266 }
@@ -281,7 +281,7 @@ int main(int argc, const char **argv) {
281 281
282 state.display = wl_display_connect(NULL); 282 state.display = wl_display_connect(NULL);
283 if (!state.display) { 283 if (!state.display) {
284 wlr_log(WLR_ERROR, "Unable to connect to the compositor. " 284 sway_log(SWAY_ERROR, "Unable to connect to the compositor. "
285 "If your compositor is running, check or set the " 285 "If your compositor is running, check or set the "
286 "WAYLAND_DISPLAY environment variable."); 286 "WAYLAND_DISPLAY environment variable.");
287 return 1; 287 return 1;
@@ -292,7 +292,7 @@ int main(int argc, const char **argv) {
292 wl_display_roundtrip(state.display); 292 wl_display_roundtrip(state.display);
293 if (state.compositor == NULL || state.shm == NULL || 293 if (state.compositor == NULL || state.shm == NULL ||
294 state.layer_shell == NULL || state.xdg_output_manager == NULL) { 294 state.layer_shell == NULL || state.xdg_output_manager == NULL) {
295 wlr_log(WLR_ERROR, "Missing a required Wayland interface"); 295 sway_log(SWAY_ERROR, "Missing a required Wayland interface");
296 return 1; 296 return 1;
297 } 297 }
298 298
@@ -306,7 +306,7 @@ int main(int argc, const char **argv) {
306 // Second roundtrip to get xdg_output properties 306 // Second roundtrip to get xdg_output properties
307 wl_display_roundtrip(state.display); 307 wl_display_roundtrip(state.display);
308 if (state.output == NULL) { 308 if (state.output == NULL) {
309 wlr_log(WLR_ERROR, "Cannot find output '%s'", args.output); 309 sway_log(SWAY_ERROR, "Cannot find output '%s'", args.output);
310 return 1; 310 return 1;
311 } 311 }
312 312