summaryrefslogtreecommitdiffstats
path: root/swaylock
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 /swaylock
parentUpdate README screenshot (diff)
downloadsway-21014e606b9b28d792b98cf363f20c7df2136723.tar.gz
sway-21014e606b9b28d792b98cf363f20c7df2136723.tar.zst
sway-21014e606b9b28d792b98cf363f20c7df2136723.zip
make gdk-pixbuf dependency really optional
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/CMakeLists.txt11
-rw-r--r--swaylock/main.c4
2 files changed, 13 insertions, 2 deletions
diff --git a/swaylock/CMakeLists.txt b/swaylock/CMakeLists.txt
index 306be80e..950a170d 100644
--- a/swaylock/CMakeLists.txt
+++ b/swaylock/CMakeLists.txt
@@ -2,7 +2,6 @@ include_directories(
2 ${PROTOCOLS_INCLUDE_DIRS} 2 ${PROTOCOLS_INCLUDE_DIRS}
3 ${WAYLAND_CLIENT_INCLUDE_DIR} 3 ${WAYLAND_CLIENT_INCLUDE_DIR}
4 ${CAIRO_INCLUDE_DIRS} 4 ${CAIRO_INCLUDE_DIRS}
5 ${GDK_PIXBUF_INCLUDE_DIRS}
6 ${PANGO_INCLUDE_DIRS} 5 ${PANGO_INCLUDE_DIRS}
7 ${PAM_INCLUDE_DIRS} 6 ${PAM_INCLUDE_DIRS}
8) 7)
@@ -17,12 +16,20 @@ target_link_libraries(swaylock
17 ${WAYLAND_CLIENT_LIBRARIES} 16 ${WAYLAND_CLIENT_LIBRARIES}
18 ${WAYLAND_CURSOR_LIBRARIES} 17 ${WAYLAND_CURSOR_LIBRARIES}
19 ${CAIRO_LIBRARIES} 18 ${CAIRO_LIBRARIES}
20 ${GDK_PIXBUF_LIBRARIES}
21 ${PANGO_LIBRARIES} 19 ${PANGO_LIBRARIES}
22 ${PAM_LIBRARIES} 20 ${PAM_LIBRARIES}
23 m 21 m
24) 22)
25 23
24if (WITH_GDK_PIXBUF)
25 include_directories(
26 ${GDK_PIXBUF_INCLUDE_DIRS}
27 )
28 target_link_libraries(swaylock
29 ${GDK_PIXBUF_LIBRARIES}
30 )
31endif()
32
26install( 33install(
27 TARGETS swaylock 34 TARGETS swaylock
28 RUNTIME 35 RUNTIME
diff --git a/swaylock/main.c b/swaylock/main.c
index 82b88731..eccb902e 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -113,6 +113,7 @@ int main(int argc, char **argv) {
113 113
114 registry->input->notify = notify_key; 114 registry->input->notify = notify_key;
115 115
116#ifdef WITH_GDK_PIXBUF
116 GError *err = NULL; 117 GError *err = NULL;
117 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[1], &err); // TODO: Parse i3lock arguments 118 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[1], &err); // TODO: Parse i3lock arguments
118 if (!pixbuf) { 119 if (!pixbuf) {
@@ -120,6 +121,9 @@ int main(int argc, char **argv) {
120 } 121 }
121 cairo_surface_t *image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf); 122 cairo_surface_t *image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf);
122 g_object_unref(pixbuf); 123 g_object_unref(pixbuf);
124#else
125 cairo_surface_t *image = cairo_image_surface_create_from_png(argv[1]);
126#endif //WITH_GDK_PIXBUF
123 if (!image) { 127 if (!image) {
124 sway_abort("Failed to read background image."); 128 sway_abort("Failed to read background image.");
125 } 129 }