summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Nuew <code@nuew.net>2016-03-24 19:55:00 -0400
committerLibravatar Nuew <code@nuew.net>2016-03-24 19:55:00 -0400
commit328e0310952473c832022d492771b2fe884c7dc8 (patch)
tree12cb9bfc354f7783f678ab29e9e0d3fda90d5530
parentMerge branch 'master' into display-images (diff)
downloadsway-328e0310952473c832022d492771b2fe884c7dc8.tar.gz
sway-328e0310952473c832022d492771b2fe884c7dc8.tar.zst
sway-328e0310952473c832022d492771b2fe884c7dc8.zip
Replace with in swaylock
-rw-r--r--swaylock/main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 9ed97013..8f0eddb3 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -213,8 +213,7 @@ cairo_surface_t *load_image(char *image_path) {
213 GError *err = NULL; 213 GError *err = NULL;
214 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(image_path, &err); 214 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(image_path, &err);
215 if (!pixbuf) { 215 if (!pixbuf) {
216 fprintf(stderr, "GDK Error: %s\n", err->message); 216 sway_abort("Failed to load background image: %s", err->message);
217 sway_abort("Failed to load background image.");
218 } 217 }
219 image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf); 218 image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf);
220 g_object_unref(pixbuf); 219 g_object_unref(pixbuf);
@@ -272,7 +271,7 @@ int main(int argc, char **argv) {
272 { 271 {
273 int colorlen = strlen(optarg); 272 int colorlen = strlen(optarg);
274 if (colorlen < 6 || colorlen == 7 || colorlen > 8) { 273 if (colorlen < 6 || colorlen == 7 || colorlen > 8) {
275 fprintf(stderr, "color must be specified in 3 or 4 byte format, e.g. ff0000 or ff0000ff\n"); 274 sway_log(L_ERROR, "color must be specified in 3 or 4 byte format, e.g. ff0000 or ff0000ff");
276 exit(EXIT_FAILURE); 275 exit(EXIT_FAILURE);
277 } 276 }
278 color = strtol(optarg, NULL, 16); 277 color = strtol(optarg, NULL, 16);
@@ -293,14 +292,14 @@ int main(int argc, char **argv) {
293 images = load_image(optarg); 292 images = load_image(optarg);
294 num_images = -1; 293 num_images = -1;
295 } else { 294 } else {
296 fprintf(stderr, "output must be defined for all --images or no --images.\n"); 295 sway_log(L_ERROR, "output must be defined for all --images or no --images");
297 exit(EXIT_FAILURE); 296 exit(EXIT_FAILURE);
298 } 297 }
299 } else { 298 } else {
300 if (num_images == 0) { 299 if (num_images == 0) {
301 images = calloc(registry->outputs->length, sizeof(char*) * 2); 300 images = calloc(registry->outputs->length, sizeof(char*) * 2);
302 } else if (num_images == -1) { 301 } else if (num_images == -1) {
303 fprintf(stderr, "output must be defined for all --images or no --images.\n"); 302 sway_log(L_ERROR, "output must be defined for all --images or no --images");
304 exit(EXIT_FAILURE); 303 exit(EXIT_FAILURE);
305 } 304 }
306 305
@@ -397,7 +396,7 @@ int main(int argc, char **argv) {
397 if (displays_paths[i * 2] != NULL) { 396 if (displays_paths[i * 2] != NULL) {
398 for (int j = 0;; ++j) { 397 for (int j = 0;; ++j) {
399 if (j >= json_object_array_length(json_outputs)) { 398 if (j >= json_object_array_length(json_outputs)) {
400 fprintf(stderr, "%s is not an extant output\n", displays_paths[i * 2]); 399 sway_log(L_ERROR, "%s is not an extant output", displays_paths[i * 2]);
401 exit(EXIT_FAILURE); 400 exit(EXIT_FAILURE);
402 } 401 }
403 402