aboutsummaryrefslogtreecommitdiffstats
path: root/swaybg
diff options
context:
space:
mode:
authorLibravatar progandy <code@progandy>2015-12-20 17:37:52 +0100
committerLibravatar progandy <code@progandy>2015-12-20 17:37:52 +0100
commit21014e606b9b28d792b98cf363f20c7df2136723 (patch)
tree946a056785f05744932f21538a90f5687deb299c /swaybg
parentUpdate README screenshot (diff)
downloadsway-21014e606b9b28d792b98cf363f20c7df2136723.tar.gz
sway-21014e606b9b28d792b98cf363f20c7df2136723.tar.zst
sway-21014e606b9b28d792b98cf363f20c7df2136723.zip
make gdk-pixbuf dependency really optional
Diffstat (limited to 'swaybg')
-rw-r--r--swaybg/CMakeLists.txt11
-rw-r--r--swaybg/main.c4
2 files changed, 13 insertions, 2 deletions
diff --git a/swaybg/CMakeLists.txt b/swaybg/CMakeLists.txt
index 4dc961ff..68098370 100644
--- a/swaybg/CMakeLists.txt
+++ b/swaybg/CMakeLists.txt
@@ -3,7 +3,6 @@ include_directories(
3 ${WAYLAND_CLIENT_INCLUDE_DIR} 3 ${WAYLAND_CLIENT_INCLUDE_DIR}
4 ${CAIRO_INCLUDE_DIRS} 4 ${CAIRO_INCLUDE_DIRS}
5 ${PANGO_INCLUDE_DIRS} 5 ${PANGO_INCLUDE_DIRS}
6 ${GDK_PIXBUF_INCLUDE_DIRS}
7) 6)
8 7
9add_executable(swaybg 8add_executable(swaybg
@@ -17,10 +16,18 @@ target_link_libraries(swaybg
17 ${WAYLAND_CURSOR_LIBRARIES} 16 ${WAYLAND_CURSOR_LIBRARIES}
18 ${CAIRO_LIBRARIES} 17 ${CAIRO_LIBRARIES}
19 ${PANGO_LIBRARIES} 18 ${PANGO_LIBRARIES}
20 ${GDK_PIXBUF_LIBRARIES}
21 m 19 m
22) 20)
23 21
22if (WITH_GDK_PIXBUF)
23 include_directories(
24 ${GDK_PIXBUF_INCLUDE_DIRS}
25 )
26 target_link_libraries(swaybg
27 ${GDK_PIXBUF_LIBRARIES}
28 )
29endif()
30
24install( 31install(
25 TARGETS swaybg 32 TARGETS swaybg
26 RUNTIME 33 RUNTIME
diff --git a/swaybg/main.c b/swaybg/main.c
index 2ae06c6f..b936be2b 100644
--- a/swaybg/main.c
+++ b/swaybg/main.c
@@ -56,6 +56,7 @@ int main(int argc, const char **argv) {
56 desktop_shell_set_background(registry->desktop_shell, output->output, window->surface); 56 desktop_shell_set_background(registry->desktop_shell, output->output, window->surface);
57 list_add(surfaces, window); 57 list_add(surfaces, window);
58 58
59#ifdef WITH_GDK_PIXBUF
59 GError *err = NULL; 60 GError *err = NULL;
60 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[2], &err); 61 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[2], &err);
61 if (!pixbuf) { 62 if (!pixbuf) {
@@ -63,6 +64,9 @@ int main(int argc, const char **argv) {
63 } 64 }
64 cairo_surface_t *image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf); 65 cairo_surface_t *image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf);
65 g_object_unref(pixbuf); 66 g_object_unref(pixbuf);
67#else
68 cairo_surface_t *image = cairo_image_surface_create_from_png(argv[2]);
69#endif //WITH_GDK_PIXBUF
66 if (!image) { 70 if (!image) {
67 sway_abort("Failed to read background image."); 71 sway_abort("Failed to read background image.");
68 } 72 }