summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-10-26 20:42:26 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-10-26 20:42:26 +0200
commitfba88476dd346be871b932c3f7626dba21de2e95 (patch)
tree9ed366c12968854ed66b4db7dbbb4f99252a3c0c
parentfe4f4a867481821b9211942f3c101f06a1205808 (diff)
remove support for NOLIBCAIRO, cairo-xcb is widespread by now
-rw-r--r--Makefile10
-rw-r--r--README8
-rw-r--r--i3lock.c26
-rw-r--r--unlock_indicator.c7
4 files changed, 5 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index c82328e..c910e52 100644
--- a/Makefile
+++ b/Makefile
@@ -11,14 +11,8 @@ CFLAGS += -std=c99
CFLAGS += -pipe
CFLAGS += -Wall
CPPFLAGS += -D_GNU_SOURCE
-CFLAGS += $(shell pkg-config --cflags xcb-dpms xcb-xinerama xkbcommon xkbfile x11 x11-xcb)
-LIBS += $(shell pkg-config --libs xcb-dpms xcb-xinerama xcb-image xkbcommon xkbfile x11 x11-xcb)
-ifndef NOLIBCAIRO
-CFLAGS += $(shell pkg-config --cflags cairo)
-LIBS += $(shell pkg-config --libs cairo)
-else
-CPPFLAGS += -DNOLIBCAIRO
-endif
+CFLAGS += $(shell pkg-config --cflags cairo xcb-dpms xcb-xinerama xkbcommon xkbfile x11 x11-xcb)
+LIBS += $(shell pkg-config --libs cairo xcb-dpms xcb-xinerama xcb-image xkbcommon xkbfile x11 x11-xcb)
LIBS += -lpam
LIBS += -lev
diff --git a/README b/README
index 4844e57..5a100fc 100644
--- a/README
+++ b/README
@@ -33,9 +33,5 @@ Requirements
Running i3lock
-------------
-Simply invoke the 'i3lock' command. To get out of it, enter your password.
-
-Building i3lock
--------------
-If you don't want to build against libcairo run "make NOLIBCAIRO=y", without
-libcairo displaying images is not possible.
+Simply invoke the 'i3lock' command. To get out of it, enter your password and
+press enter.
diff --git a/i3lock.c b/i3lock.c
index 48ab06b..fffb3da 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -25,12 +25,8 @@
#include <X11/XKBlib.h>
#include <X11/extensions/XKBfile.h>
#include <xkbcommon/xkbcommon.h>
-
-
-#ifndef NOLIBCAIRO
#include <cairo.h>
#include <cairo/cairo-xcb.h>
-#endif
#include "i3lock.h"
#include "xcb.h"
@@ -62,10 +58,8 @@ static struct xkb_state *xkb_state;
static struct xkb_context *xkb_context;
static struct xkb_keymap *xkb_keymap;
-#ifndef NOLIBCAIRO
cairo_surface_t *img = NULL;
bool tile = false;
-#endif
/* isutf, u8_dec © 2005 Jeff Bezanson, public domain */
#define isutf(c) (((c) & 0xC0) != 0x80)
@@ -377,9 +371,7 @@ void handle_screen_resize(void) {
free(geom);
-#ifndef NOLIBCAIRO
redraw_screen();
-#endif
uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
xcb_configure_window(conn, win, mask, last_resolution);
@@ -504,9 +496,7 @@ static void xcb_check_cb(EV_P_ ev_check *w, int revents) {
int main(int argc, char *argv[]) {
char *username;
-#ifndef NOLIBCAIRO
char *image_path = NULL;
-#endif
int ret;
struct pam_conv conv = {conv_callback, NULL};
int curs_choice = CURS_NONE;
@@ -522,21 +512,15 @@ int main(int argc, char *argv[]) {
{"debug", no_argument, NULL, 0},
{"help", no_argument, NULL, 'h'},
{"no-unlock-indicator", no_argument, NULL, 'u'},
-#ifndef NOLIBCAIRO
{"image", required_argument, NULL, 'i'},
{"tiling", no_argument, NULL, 't'},
-#endif
{NULL, no_argument, NULL, 0}
};
if ((username = getenv("USER")) == NULL)
errx(1, "USER environment variable not set, please set it.\n");
- while ((o = getopt_long(argc, argv, "hvnbdc:p:u"
-#ifndef NOLIBCAIRO
- "i:t"
-#endif
- , longopts, &optind)) != -1) {
+ while ((o = getopt_long(argc, argv, "hvnbdc:p:ui:t", longopts, &optind)) != -1) {
switch (o) {
case 'v':
errx(EXIT_SUCCESS, "version " VERSION " © 2010-2012 Michael Stapelberg");
@@ -564,14 +548,12 @@ int main(int argc, char *argv[]) {
case 'u':
unlock_indicator = false;
break;
-#ifndef NOLIBCAIRO
case 'i':
image_path = strdup(optarg);
break;
case 't':
tile = true;
break;
-#endif
case 'p':
if (!strcmp(optarg, "win")) {
curs_choice = CURS_WIN;
@@ -587,11 +569,7 @@ int main(int argc, char *argv[]) {
break;
default:
errx(1, "Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-u] [-p win|default]"
-#ifndef NOLIBCAIRO
" [-i image.png] [-t]"
-#else
- " (compiled with NOLIBCAIRO)"
-#endif
);
}
}
@@ -655,7 +633,6 @@ int main(int argc, char *argv[]) {
xcb_change_window_attributes(conn, screen->root, XCB_CW_EVENT_MASK,
(uint32_t[]){ XCB_EVENT_MASK_STRUCTURE_NOTIFY });
-#ifndef NOLIBCAIRO
if (image_path) {
/* Create a pixmap to render on, fill it with the background color */
img = cairo_image_surface_create_from_png(image_path);
@@ -666,7 +643,6 @@ int main(int argc, char *argv[]) {
img = NULL;
}
}
-#endif
/* Pixmap on which the image is rendered to (if any) */
xcb_pixmap_t bg_pixmap = draw_image(last_resolution);
diff --git a/unlock_indicator.c b/unlock_indicator.c
index 62e28df..ab4d56e 100644
--- a/unlock_indicator.c
+++ b/unlock_indicator.c
@@ -11,11 +11,8 @@
#include <math.h>
#include <xcb/xcb.h>
#include <ev.h>
-
-#ifndef NOLIBCAIRO
#include <cairo.h>
#include <cairo/cairo-xcb.h>
-#endif
#include "xcb.h"
#include "unlock_indicator.h"
@@ -46,10 +43,8 @@ extern uint32_t last_resolution[2];
/* Whether the unlock indicator is enabled (defaults to true). */
extern bool unlock_indicator;
-#ifndef NOLIBCAIRO
/* A Cairo surface containing the specified image (-i), if any. */
extern cairo_surface_t *img;
-#endif
/* Whether the image should be tiled. */
extern bool tile;
@@ -78,7 +73,6 @@ pam_state_t pam_state;
xcb_pixmap_t draw_image(uint32_t *resolution) {
xcb_pixmap_t bg_pixmap = XCB_NONE;
-#ifndef NOLIBCAIRO
if (!vistype)
vistype = get_root_visual_type(screen);
bg_pixmap = create_bg_pixmap(conn, screen, resolution, color);
@@ -263,7 +257,6 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
cairo_surface_destroy(output);
cairo_destroy(ctx);
cairo_destroy(xcb_ctx);
-#endif
return bg_pixmap;
}