From 934e4ba05eb1f39b9c0ffcde0a831e4a7a16a9e2 Mon Sep 17 00:00:00 2001 From: mathias Date: Mon, 29 May 2006 21:32:25 +0000 Subject: [PATCH] * added configure / Makefile to avoid scons-dependancy * fixes buildsystem --HG-- extra : convert_revision : svn%3Aeebe1cee-a9af-4fe4-bd26-ad572b19c5ab/trunk%4041 --- CHANGELOG | 25 +--- Makefile | 10 ++ configure | 306 +++++++++++++++++++++++++++++++++++++++++++++ src/Makefile | 138 ++++++++++++++++++++ src/alock.c | 18 ++- src/alock.h | 1 + src/alock_utils.c | 28 ++--- src/bg_image.c | 12 +- src/bg_shade.c | 2 +- src/cursor_theme.c | 22 ++-- 10 files changed, 506 insertions(+), 56 deletions(-) create mode 100644 Makefile create mode 100755 configure create mode 100644 src/Makefile diff --git a/CHANGELOG b/CHANGELOG index 18f4600..517ce8e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,26 +1,28 @@ Version 1.0 +---------------------------------------------------------------------- +2006-05-29: + * added a minimal configure / gmake buildsystem to make building easier + * stop when no auth method is selected to prevent confusion + 2006-05-05: * lock all screens if in X is running in multiscreen mode + 2005-12-25: * added -auth sha256 * added -auth sha384 * added -auth sha512 2005-08-12: - * added static=yes built option to scons 2005-06-01: - * added -cursor image:file=, uses xrender and xpm/imlib2 2005-05-25: - * solved problems install-problems: use at least scons 0.96.90 * minor tweaks to buildsystem 2005-05-24: - * updated documentation * updated buildsystem, scons install works * rewritten README to be also in asciidoc-format @@ -30,20 +32,17 @@ Version 1.0 * rename -cursor font to -cursor glyph 2005-05-23: - * added -bg image:shade= * little restructuring: - added alock_utils.c for shared code - mv bg_imlib2.c bg_image.c 2005-05-20: - * added -bg shade: - shade= - percentage, 0 - 100 - color= - tint with , default is "black" 2005-05-18: - * fixed minor issues with defaults * deleted fancy contrib/xcursor-watch (too big) * added even more fancy contrib/xcursor-fluxbox @@ -56,7 +55,6 @@ Version 1.0 * -bg blank uses the color-option now 2005-05-17: - * restructuring almost done, polished interface: : working -bg, -auth and -cursor with all the submodules - cleaned -h @@ -65,22 +63,18 @@ Version 1.0 * added -cursor none, doesnt change cursor 2005-05-16: - * updated documention 2005-05-14: - * started documention, using asciidoc 2005-05-09: - * changed project-name to 'alock': + simpler, better name + i want to dedicate it to my gf: anja * minor fixes 2005-05-08: - * changed the auth_md5.c - code to the openbsd-version (public domain) * added auth_sha1.c - also from openbsd-codebase, also public domain * added two stand-alone programs to calculate md5/sha1 hashs: @@ -90,7 +84,6 @@ Version 1.0 * minor changes to aklock.c 2005-05-07: - * big restructering + feature enhancements + added auth_.c, each basic auth-method has now its own implementation-file @@ -103,7 +96,6 @@ Version 1.0 * support for 'shadow'-passwords is part of the passwd authmodule 2005-05-06: - * added -nolock * discard all pending xevents after wrong password to prevent strange folks for blocking the current session by filling @@ -118,20 +110,15 @@ Version 1.0 + src/ 2005-05-02: - * restructuring 2005-04-30: - * added -cursor * cursor-bitmap-themes are stored in bitmaps/ * started svn-usage -Version 0.1 - 2005-04-28: * first release (0.1) * added pam-support (works ok with linux + freebsd so far) * use scons for building the stuff -# vim:ft=changelog diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..23b7dbc --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ + +first: + $(MAKE) -C src + +clean: + $(MAKE) -C src clean + +distclean: + $(MAKE) -C src distclean + diff --git a/configure b/configure new file mode 100755 index 0000000..14879a1 --- /dev/null +++ b/configure @@ -0,0 +1,306 @@ +#!/bin/sh + +[[ -z $CC ]] && CC=gcc +[[ -z $CFLAGS ]] && CFLAGS="-I/usr/X11R6/include" +[[ -z $LDFLAGS ]] && LDFLAGS="-L/usr/X11R6/lib" + +CHECK_XRENDER=0 +CHECK_XCURSOR=0 +CHECK_IMLIB2=0 +CHECK_PAM=0 +CHECK_PASSWD=0 +CHECK_HASH=0 + +prefix=/usr/local + + +############################################################## + +msg_chkfor() { + echo -n "checking for "$1" ... " +} + + +check_imlib2() { + + msg_chkfor "imlib2-config" + if which imlib2-config 1> /dev/null 2>&3 + then + echo "ok." + cat << EOF > tmp.c +#include +int main() { + Imlib_Context ctx = NULL; + ctx = imlib_context_new(); + return 0; +} +EOF + msg_chkfor "compile with imlib2" + if ${CC} -c tmp.c -o /dev/null `imlib2-config --cflags` 2>&3 + then + echo "ok." + msg_chkfor "link with imlib2" + if ${CC} tmp.c -o /dev/null `imlib2-config --cflags` `imlib2-config --libs` 2>&3 + then + echo "ok." + echo "#_______________________" >&4 + echo "WITH_IMLIB2=1" >&4 + echo "CFLAGS_IMLIB2=`imlib2-config --cflags`" >&4 + echo "LIBS_IMLIB2=`imlib2-config --libs`" >&4 + echo "" >&4 + else + echo "no." + echo "error, can't link against imlib2. check 'config.log' for possible" + echo "error messages. you can also call configure with specifying " + echo "special LDFLAGS." + exit 1 + fi + else + echo "no." + echo "error, can't compile with imlib2 support. check 'config.log'" + echo "for further detailts." + exit 1 + fi + else + echo "no." + fi +} + + +check_xrender() { + + cat << EOF > tmp.c +#include +#include +int main() { + XRenderFindVisualFormat(NULL, NULL); + return 0; +} +EOF + msg_chkfor "Xrender.h" + if ${CC} ${CFLAGS} -c tmp.c -o /dev/null 2>&3 + then + echo "ok." + msg_chkfor "libXrender" + if ${CC} ${CFLAGS} tmp.c -o /dev/null ${LDFLAGS} -lXrender 2>&3 + then + echo "ok." + echo "#_______________________" >&4 + echo "WITH_XRENDER=1" >&4 + echo "CFLAGS_XRENDER=" >&4 + echo "LDFLAGS_XRENDER=-lXrender" >&4 + echo "" >&4 + else + echo "no." + exit 1 + fi + else + echo "no." + exit 1 + fi +} + +check_xcursor() { + + cat << EOF > tmp.c +#include +#include +int main() { + XcursorFilenameLoadCursor(NULL, NULL); + return 0; +} +EOF + msg_chkfor "Xcursor.h" + if ${CC} ${CFLAGS} -c tmp.c -o /dev/null 2>&3 + then + echo "ok." + msg_chkfor "libXcursor" + if ${CC} ${CFLAGS} tmp.c -o /dev/null ${LDFLAGS} -lXcursor 2>&3 + then + echo "ok." + echo "#_______________________" >&4 + echo "WITH_XCURSOR=1" >&4 + echo "CFLAGS_XCURSOR=" >&4 + echo "LDFLAGS_XCURSOR=" >&4 + echo "LIBS_XCURSOR=-lXcursor" >&4 + echo "" >&4 + else + echo "no." + exit 1 + fi + else + echo "no." + exit 1 + fi +} + +check_xlib() { + + cat << EOF > tmp.c +#include +int main() { + XOpenDisplay(NULL); + return 0; +} +EOF + msg_chkfor "Xlib.h" + if ${CC} ${CFLAGS} -c tmp.c -o /dev/null 2>&3 + then + echo "ok." + msg_chkfor "Xlib" + if ${CC} ${CFLAGS} tmp.c -o /dev/null ${LDFLAGS} -lX11 2>&3 + then + echo "ok." + echo "#_______________________" >&4 + echo "LIBS += -lX11" >&4 + echo "" >&4 + else + echo "no." + echo "error: you need Xlibs to build alock." + exit 1 + fi + else + echo "no." + echo "error: can't compile without Xlib.h header." + exit 1 + fi +} + +check_xlogo16() { + cat << EOF > tmp.c +#include +int main() { + return 0; +} +EOF + msg_chkfor "X11/bitmaps/xlogo16" + if ${CC} ${CFLAGS} -c tmp.c -o /dev/null 2>&3 + then + echo "ok." + echo "#_______________________" >&4 + echo "WITH_THEME=1" >&4 + echo "" >&4 + else + echo "no." + echo "maybe you should install a package called 'xbitmaps'." + fi +} + +check_hash() { + + echo "configure for hash." + echo "#_______________________" >&4 + echo "WITH_HASH=1" >&4 + echo "" >&4 +} + +check_pam() { + echo "configure for pam." + echo "#_______________________" >&4 + echo "WITH_PAM=1" >&4 + echo "LIBS_PAM= -lpam -lpam_misc -lcrypt" >&4 + echo "" >&4 +} + +check_passwd() { + echo "configure for passwd." + echo "#_______________________" >&4 + echo "WITH_PASSWD=1" >&4 + echo "LIBS_PASSWD=-lcrypt" >&4 + echo "" >&4 +} + +############################################################################# + + +while [ $# -gt 0 ] +do + case $1 in + + --help) + cat < where to install + --debug enable debug + + --with(out)-xrender use Xrender + --with(out)-xcursor use Xcursor + --with(out)-imlib2 use imlib2 + --with(out)-xpm use Xpm + + --with(out)-pam use pam_login + --with(out)-passwd use /etc/passwd + --with(out)-hash use sha1,sha2 and md5 based passwords + + --help shows usage of the configure script + +EOF + exit 0 + ;; + + --with-xrender|--enable-xrender) CHECK_XRENDER=1;; + --without-xrender|--disable-xrender) CHECK_XRENDER=0;; + + --with-xcursor|--enable-xcursor) CHECK_XCURSOR=1;; + --without-xcursor|--disable-xcursor) CHECK_XCURSOR=0;; + + --with-imlib2|--enable-imlib2) CHECK_IMLIB2=1;; + --without-imlib2|--disable-imlib2) CHECK_IMLIB2=0;; + + --with-pam|--enable-pam) CHECK_PAM=1;; + --without-pam|--disable-pam) CHECK_PAM=0;; + + --with-passwd|--enable-passwd) CHECK_PASSWD=1;; + --without-passwd|--disable-passwd) CHECK_PASSWD=0;; + + --prefix) + shift + if [[ $# -gt 0 ]] + then + prefix=$1 + else + echo "error, missing argument for -prefix." + exit 1 + fi + ;; + + --debug) + CFLAGS="${CFLAGS} -g" + LDFLAGS="${LDFLAGS} -g" + ;; + esac + shift +done + + +############################################################## + +exec 3> config.log +exec 4> config.mk + +echo "# alock's config.mk" >&4 +echo "#_______________________" >&4 +echo "VERSION=\\\"1.0\\\"" >&4 +echo "prefix=$prefix" >&4 +echo "CC=${CC}" >&4 +echo "CFLAGS=${CFLAGS}" >&4 +echo "LDFLAGS=${LDFLAGS}" >&4 +echo "LIBS=${LIBS}" >&4 +echo "#_______________________" >&4 +echo "" >&4 + + +check_xlib +check_xlogo16 +[[ $CHECK_XRENDER == 1 ]] && check_xrender +[[ $CHECK_XCURSOR == 1 ]] && check_xcursor +[[ $CHECK_IMLIB2 == 1 ]] && check_imlib2 +[[ $CHECK_PAM == 1 ]] && check_pam +[[ $CHECK_PASSWD == 1 ]] && check_passwd +[[ $CHECK_HASH == 1 ]] && check_hash + +true + +# vim:ft=sh diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..0e79907 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,138 @@ + +### +# +# +$(info check for ../config.mk ...) +ifeq ($(wildcard ../config.mk),../config.mk) +$(info ok.) +include ../config.mk +else +$(error not ok. no '../config.mk' found. call 'configure'.) +endif + + +########################## +MAKEDEP ?= gcc -MM +CC ?= gcc +CFLAGS += -DVERSION=$(VERSION) +LDFLAGS ?= +LIBS ?= -lX11 + +########################## + +SRC := alock.c alock_utils.c \ + auth_none.c \ + bg_none.c bg_blank.c \ + cursor_none.c cursor_glyph.c cursor_theme.c +SRC_PAM := auth_pam.c +SRC_PASSWD := auth_passwd.c +SRC_HASH := auth_sha1.c \ + auth_sha2.c \ + auth_md5.c +SRC_XRENDER := bg_shade.c +SRC_IMLIB2 := cursor_image.c \ + bg_image.c +ifdef WITH_XRENDER +SRC_XPM := cursor_image.c +SRC_XCURSOR := cursor_xcursor.c +endif + +###################### + +ifdef WITH_PAM +SRC += $(SRC_PAM) +CFLAGS += $(CFLAGS_PAM) +LDFLAGS += $(LDFLAGS_PAM) +LIBS += $(LIBS_PAM) +endif + +ifdef WITH_PASSWD +SRC += $(SRC_PASSWD) +CFLAGS += $(CFLAGS_PASSWD) +LDFLAGS += $(LDFLAGS_PASSWD) +LIBS += $(LIBS_PASSWD) +endif + +ifdef WITH_HASH +SRC += $(SRC_HASH) +CFLAGS += $(CFLAGS_HASH) +LDFLAGS += $(LDFLAGS_HASH) +LIBS += $(LIBS_HASH) +endif + +ifdef WITH_THEME +CFLAGS += $(CFLAGS_THEME) -DHAVE_THEME +endif + +ifdef WITH_XRENDER +SRC += $(SRC_XRENDER) +CFLAGS += $(CFLAGS_XRENDER) -DHAVE_XRENDER +LDFLAGS += $(LDFLAGS_XRENDER) +LIBS += $(LIBS_XRENDER) +endif + +ifdef WITH_XCURSOR +SRC += $(SRC_XCURSOR) +CFLAGS += $(CFLAGS_XCURSOR) -DHAVE_XCURSOR +LDFLAGS += $(LDFLAGS_XCURSOR) +LIBS += $(LIBS_XCURSOR) +endif + + +ifdef WITH_IMLIB2 +SRC += $(SRC_IMLIB2) +CFLAGS += $(CFLAGS_IMLIB2) -DHAVE_IMLIB2 +LDFLAGS += $(LDFLAGS_IMLIB2) +LIBS += $(LIBS_IMLIB2) +endif + +ifdef WITH_XPM +SRC += $(SRC_XPM) +CFLAGS += $(CFLAGS_XPM) -DHAVE_XPM +LDFLAGS += $(LDFLAGS_XPM) +LIBS += $(LIBS_XPM) +endif + +####################### + +SOURCES = $(sort $(SRC)) +OBJECTS = $(SOURCES:.c=.o) +DEPS := $(foreach deps, $(SOURCES), $(deps:.c=.d)) +TARGET := alock +####################### + + +####################### +first: ../config.mk $(TARGET) + +clean: + @rm -fr $(OBJECTS) + +distclean: + @rm -fr $(OBJECTS) $(DEPS) + +deps: $(DEPS) + +$(TARGET) : $(OBJECTS) + $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LIBS) + +alock.o : ../config.mk + +%.d : %.c + $(MAKEDEP) -o $@ $< + + + + +ifneq ($(MAKECMDGOALS),deps) +ifneq ($(MAKECMDGOALS),first) +ifneq ($(MAKECMDGOALS),distclean) +ifneq ($(MAKECMDGOALS),clean) + -include $(DEPS) +endif +endif +endif +endif + + + diff --git a/src/alock.c b/src/alock.c index 02a394b..30bc689 100644 --- a/src/alock.c +++ b/src/alock.c @@ -89,14 +89,14 @@ static struct aBackground* alock_backgrounds[] = { /* ---------------------------------------------------------------- *\ \* ---------------------------------------------------------------- */ extern struct aCursor alock_cursor_none; -extern struct aCursor alock_cursor_theme; extern struct aCursor alock_cursor_glyph; +extern struct aCursor alock_cursor_theme; #ifdef HAVE_XCURSOR extern struct aCursor alock_cursor_xcursor; -#endif /* HAVE_XCURSOR */ #ifdef HAVE_XRENDER extern struct aCursor alock_cursor_image; #endif /* HAVE_XRENDER */ +#endif /* HAVE_XCURSOR */ static struct aCursor* alock_cursors[] = { &alock_cursor_none, @@ -104,10 +104,10 @@ static struct aCursor* alock_cursors[] = { &alock_cursor_glyph, #ifdef HAVE_XCURSOR &alock_cursor_xcursor, -#endif /* HAVE_XCURSOR */ #ifdef HAVE_XRENDER &alock_cursor_image, #endif /* HAVE_XRENDER */ +#endif /* HAVE_XCURSOR */ NULL }; /*------------------------------------------------------------------*\ @@ -229,12 +229,10 @@ int main(int argc, char **argv) { const char* cursor_args = NULL; const char* background_args = NULL; - opts.auth = alock_authmodules[0]; + opts.auth = NULL; opts.cursor = alock_cursors[0]; opts.background = alock_backgrounds[0]; - opts.auth->init(NULL); - /* parse options */ if (argc != 1) { for(arg = 1; arg <= argc; arg++) { @@ -353,6 +351,14 @@ int main(int argc, char **argv) { } } + if (!opts.auth) { + printf("alock: error, no auth-method specified.\n"); + displayUsage(); + exit(1); + } + + opts.auth->init(NULL); + initXInfo(&xinfo, &opts); if (!opts.background->init(background_args, &xinfo)) { diff --git a/src/alock.h b/src/alock.h index 6ffbb0d..957c951 100644 --- a/src/alock.h +++ b/src/alock.h @@ -80,6 +80,7 @@ int alock_alloc_color(const struct aXInfo* xinfo, const int scr, XColor* result); int alock_check_xrender(const struct aXInfo* xinfo); int alock_shade_pixmap(const struct aXInfo* xinfo, + int scr, const Pixmap src_pm, Pixmap dst_pm, unsigned char shade, diff --git a/src/alock_utils.c b/src/alock_utils.c index 4b2bf9b..f4190da 100644 --- a/src/alock_utils.c +++ b/src/alock_utils.c @@ -5,7 +5,7 @@ copyr : copyright (c) 2005 by m. gumz license : see LICENSE - + start : Mo 23 Mai 2005 13:55:24 CEST $Id$ @@ -44,8 +44,8 @@ int alock_alloc_color(const struct aXInfo* xinfo, const int scr, const char* col static XColor tmp; - if (!xinfo || - !xinfo->colormap || xinfo->nr_screens < scr || scr < 0 || + if (!xinfo || + !xinfo->colormap || xinfo->nr_screens < scr || scr < 0 || !color_name || !fallback_name || !result) return 0; @@ -79,7 +79,7 @@ int alock_check_xrender(const struct aXInfo* xinfo) { have_xrender = 0; } else have_xrender = 1; - + checked_already = 1; } return have_xrender; @@ -90,17 +90,17 @@ int alock_check_xrender(const struct aXInfo* xinfo) { } int alock_shade_pixmap(const struct aXInfo* xinfo, + int scr, const Pixmap src_pm, - Pixmap dst_pm, - unsigned char shade, + Pixmap dst_pm, + unsigned char shade, int src_x, int src_y, int dst_x, int dst_y, unsigned int width, unsigned int height) { #ifdef HAVE_XRENDER Display* dpy = xinfo->display; - int scrnr = DefaultScreen(dpy); - Visual* vis = DefaultVisual(dpy, scrnr); + Visual* vis = DefaultVisual(dpy, scr); Picture alpha_pic = None; XRenderPictFormat* format = None; @@ -123,9 +123,9 @@ int alock_shade_pixmap(const struct aXInfo* xinfo, return 0; } - { /* fill the alpha-picture */ + { /* fill the alpha-picture */ Pixmap alpha_pm = None; - + XRenderColor alpha_color; XRenderPictureAttributes alpha_attr; @@ -138,18 +138,18 @@ int alock_shade_pixmap(const struct aXInfo* xinfo, XRenderFillRectangle(dpy, PictOpSrc, alpha_pic, &alpha_color, 0, 0, 1, 1); XFreePixmap(dpy, alpha_pm); } - + { /* blend all together */ Picture src_pic; Picture dst_pic; - + format = XRenderFindVisualFormat(dpy, vis); src_pic = XRenderCreatePicture(dpy, src_pm, format, 0, 0); dst_pic = XRenderCreatePicture(dpy, dst_pm, format, 0, 0); - XRenderComposite(dpy, PictOpOver, - src_pic, alpha_pic, dst_pic, + XRenderComposite(dpy, PictOpOver, + src_pic, alpha_pic, dst_pic, src_x, src_y, 0, 0, dst_x, dst_y, width, height); XRenderFreePicture(dpy, src_pic); XRenderFreePicture(dpy, dst_pic); diff --git a/src/bg_image.c b/src/bg_image.c index 06f8aa4..7d62050 100644 --- a/src/bg_image.c +++ b/src/bg_image.c @@ -103,11 +103,9 @@ static int alock_bg_image_init(const char* args, struct aXInfo* xinfo) { shade = 0; } - { - pixmap = (Pixmap*)calloc(xinfo->nr_screens, sizeof(Pixmap)); - window = (Window*)calloc(xinfo->nr_screens, sizeof(Window)); - color = (XColor*)calloc(xinfo->nr_screens, sizeof(XColor)); - } + pixmap = (Pixmap*)calloc(xinfo->nr_screens, sizeof(Pixmap)); + window = (Window*)calloc(xinfo->nr_screens, sizeof(Window)); + color = (XColor*)calloc(xinfo->nr_screens, sizeof(XColor)); { int scr; @@ -171,7 +169,7 @@ static int alock_bg_image_init(const char* args, struct aXInfo* xinfo) { imlib_context_set_drawable(tmp_pixmap); imlib_render_image_on_drawable(0, 0); - alock_shade_pixmap(xinfo, tmp_pixmap, shaded_pixmap, shade, 0, 0, 0, 0, w, h); + alock_shade_pixmap(xinfo, scr, tmp_pixmap, shaded_pixmap, shade, 0, 0, 0, 0, w, h); imlib_free_image_and_decache(); imlib_context_set_drawable(shaded_pixmap); @@ -250,7 +248,7 @@ static int alock_bg_image_init(const char* args, struct aXInfo* xinfo) { if (filename) free(filename); - return window; + return (window != 0); } diff --git a/src/bg_shade.c b/src/bg_shade.c index 59d0aae..d6187db 100644 --- a/src/bg_shade.c +++ b/src/bg_shade.c @@ -126,7 +126,7 @@ static int alock_bg_shade_init(const char* args, struct aXInfo* xinfo) { XFreeGC(dpy, tintgc); } - alock_shade_pixmap(xinfo, src_pm, dst_pm, shade, 0, 0, 0, 0, width, height); + alock_shade_pixmap(xinfo, scr, src_pm, dst_pm, shade, 0, 0, 0, 0, width, height); } { /* create final window */ diff --git a/src/cursor_theme.c b/src/cursor_theme.c index c65a1b0..575536c 100644 --- a/src/cursor_theme.c +++ b/src/cursor_theme.c @@ -33,7 +33,9 @@ /* ---------------------------------------------------------------- *\ \* ---------------------------------------------------------------- */ +#ifdef HAVE_THEME #include +#endif /* HAVE_THEME */ #include "../bitmaps/mini.xbm" #include "../bitmaps/mini_mask.xbm" @@ -141,19 +143,15 @@ static int alock_cursor_theme_init(const char* args, struct aXInfo* xinfo) { { int scr; - for (scr = 0; xinfo->nr_screens; scr++) { - alock_alloc_color(xinfo, scr, color_fg_name, "white", &color_fg[scr]); - alock_alloc_color(xinfo, scr, color_bg_name, "blank", &color_bg[scr]); - } cursor = (Cursor*)calloc(xinfo->nr_screens, sizeof(Cursor)); color_bg = (XColor*)calloc(xinfo->nr_screens, sizeof(XColor)); color_fg = (XColor*)calloc(xinfo->nr_screens, sizeof(XColor)); - free(color_fg_name); - free(color_bg_name); + for (scr = 0; scr < xinfo->nr_screens; scr++) { - for (scr = 0; xinfo->nr_screens; scr++) { + alock_alloc_color(xinfo, scr, color_fg_name, "white", &color_fg[scr]); + alock_alloc_color(xinfo, scr, color_bg_name, "blank", &color_bg[scr]); pixmap_cursor = XCreateBitmapFromData(xinfo->display, xinfo->root[scr], theme->bits, theme->width, theme->height); @@ -165,11 +163,17 @@ static int alock_cursor_theme_init(const char* args, struct aXInfo* xinfo) { &color_fg[scr], &color_bg[scr], theme->x_hot, theme->y_hot); - if (cursor) - xinfo->cursor = cursor; } + + if (cursor) + xinfo->cursor = cursor; + } + free(color_fg_name); + free(color_bg_name); + + return 1; }