diff --git a/CMakeLists.txt b/CMakeLists.txt index 306be80..950a170 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ include_directories( ${PROTOCOLS_INCLUDE_DIRS} ${WAYLAND_CLIENT_INCLUDE_DIR} ${CAIRO_INCLUDE_DIRS} - ${GDK_PIXBUF_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS} ${PAM_INCLUDE_DIRS} ) @@ -17,12 +16,20 @@ target_link_libraries(swaylock ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} - ${GDK_PIXBUF_LIBRARIES} ${PANGO_LIBRARIES} ${PAM_LIBRARIES} m ) +if (WITH_GDK_PIXBUF) + include_directories( + ${GDK_PIXBUF_INCLUDE_DIRS} + ) + target_link_libraries(swaylock + ${GDK_PIXBUF_LIBRARIES} + ) +endif() + install( TARGETS swaylock RUNTIME diff --git a/main.c b/main.c index 82b8873..eccb902 100644 --- a/main.c +++ b/main.c @@ -113,6 +113,7 @@ int main(int argc, char **argv) { registry->input->notify = notify_key; +#ifdef WITH_GDK_PIXBUF GError *err = NULL; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[1], &err); // TODO: Parse i3lock arguments if (!pixbuf) { @@ -120,6 +121,9 @@ int main(int argc, 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[1]); +#endif //WITH_GDK_PIXBUF if (!image) { sway_abort("Failed to read background image."); }