aboutsummaryrefslogtreecommitdiff
path: root/swaybg
diff options
context:
space:
mode:
authorprogandy <code@progandy>2015-12-20 17:37:52 +0100
committerprogandy <code@progandy>2015-12-20 17:37:52 +0100
commit21014e606b9b28d792b98cf363f20c7df2136723 (patch)
tree946a056785f05744932f21538a90f5687deb299c /swaybg
parent66554698a08e8c3846d22f61445c880c9de20e26 (diff)
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(
${WAYLAND_CLIENT_INCLUDE_DIR}
${CAIRO_INCLUDE_DIRS}
${PANGO_INCLUDE_DIRS}
- ${GDK_PIXBUF_INCLUDE_DIRS}
)
add_executable(swaybg
@@ -17,10 +16,18 @@ target_link_libraries(swaybg
${WAYLAND_CURSOR_LIBRARIES}
${CAIRO_LIBRARIES}
${PANGO_LIBRARIES}
- ${GDK_PIXBUF_LIBRARIES}
m
)
+if (WITH_GDK_PIXBUF)
+ include_directories(
+ ${GDK_PIXBUF_INCLUDE_DIRS}
+ )
+ target_link_libraries(swaybg
+ ${GDK_PIXBUF_LIBRARIES}
+ )
+endif()
+
install(
TARGETS swaybg
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) {
desktop_shell_set_background(registry->desktop_shell, output->output, window->surface);
list_add(surfaces, window);
+#ifdef WITH_GDK_PIXBUF
GError *err = NULL;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[2], &err);
if (!pixbuf) {
@@ -63,6 +64,9 @@ int main(int argc, const char **argv) {
}
cairo_surface_t *image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf);
g_object_unref(pixbuf);
+#else
+ cairo_surface_t *image = cairo_image_surface_create_from_png(argv[2]);
+#endif //WITH_GDK_PIXBUF
if (!image) {
sway_abort("Failed to read background image.");
}