diff options
author | 2015-12-20 11:56:13 -0500 | |
---|---|---|
committer | 2015-12-20 11:56:13 -0500 | |
commit | dfc23086fd9597a5f9c7182851052435e134be5f (patch) | |
tree | 946a056785f05744932f21538a90f5687deb299c /swaylock | |
parent | Update README screenshot (diff) | |
parent | make gdk-pixbuf dependency really optional (diff) | |
download | sway-dfc23086fd9597a5f9c7182851052435e134be5f.tar.gz sway-dfc23086fd9597a5f9c7182851052435e134be5f.tar.zst sway-dfc23086fd9597a5f9c7182851052435e134be5f.zip |
Merge pull request #377 from progandy/optional-pixbuf
make gdk-pixbuf dependency really optional
Diffstat (limited to 'swaylock')
-rw-r--r-- | swaylock/CMakeLists.txt | 11 | ||||
-rw-r--r-- | swaylock/main.c | 4 |
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 | ||
24 | if (WITH_GDK_PIXBUF) | ||
25 | include_directories( | ||
26 | ${GDK_PIXBUF_INCLUDE_DIRS} | ||
27 | ) | ||
28 | target_link_libraries(swaylock | ||
29 | ${GDK_PIXBUF_LIBRARIES} | ||
30 | ) | ||
31 | endif() | ||
32 | |||
26 | install( | 33 | install( |
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 | } |