diff options
Diffstat (limited to 'slock/patches/slock-foreground-image-20211210.diff')
| -rw-r--r-- | slock/patches/slock-foreground-image-20211210.diff | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/slock/patches/slock-foreground-image-20211210.diff b/slock/patches/slock-foreground-image-20211210.diff deleted file mode 100644 index 83d807a..0000000 --- a/slock/patches/slock-foreground-image-20211210.diff +++ /dev/null @@ -1,81 +0,0 @@ -From: Viliam Kováč <viliamkovac1223@gmail.com> -Date: Fri, 10 Dec 2021 17:22:00 -Subject: [PATCH] Add a image foreground -diff --git a/config.def.h b/config.def.h -index 9855e21..dfa61d6 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -10,3 +10,10 @@ static const char *colorname[NUMCOLS] = { - - /* treat a cleared input like a wrong password (color) */ - static const int failonclear = 1; -+ -+static const char *imgpath = "img.xpm"; -+static const int imgwidth = 1920; -+static const int imgheight = 1080; -+static const int imgoffsetx = 0; -+static const int imgoffsety = 0; -+static const int showimgonlyatstart = 1; -diff --git a/config.mk b/config.mk -index 74429ae..6145285 100644 ---- a/config.mk -+++ b/config.mk -@@ -12,7 +12,7 @@ X11LIB = /usr/X11R6/lib - - # includes and libs - INCS = -I. -I/usr/include -I${X11INC} --LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr -+LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr -lXpm - - # flags - CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H -diff --git a/slock.c b/slock.c -index 5ae738c..b36c347 100644 ---- a/slock.c -+++ b/slock.c -@@ -18,6 +18,7 @@ - #include <X11/keysym.h> - #include <X11/Xlib.h> - #include <X11/Xutil.h> -+#include <X11/xpm.h> - - #include "arg.h" - #include "util.h" -@@ -124,6 +125,19 @@ gethash(void) - return hash; - } - -+static void -+showimage(Display *dpy, Window win) -+{ -+ XImage *ximage; -+ -+ if (!XpmReadFileToImage (dpy, imgpath, &ximage, NULL, NULL)) { -+ XSelectInput(dpy, win, ButtonPressMask|ExposureMask); -+ XMapWindow(dpy, win); -+ -+ XPutImage(dpy, win, DefaultGC(dpy, 0), ximage, 0, 0, imgoffsetx, imgoffsety, imgwidth, imgheight); -+ } -+} -+ - static void - readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, - const char *hash) -@@ -194,6 +208,8 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, - locks[screen]->win, - locks[screen]->colors[color]); - XClearWindow(dpy, locks[screen]->win); -+ if (showimgonlyatstart != 1) -+ showimage(dpy, locks[screen]->win); - } - oldc = color; - } -@@ -256,6 +272,8 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) - &color, &color, 0, 0); - XDefineCursor(dpy, lock->win, invisible); - -+ showimage(dpy, lock->win); -+ - /* Try to grab mouse pointer *and* keyboard for 600ms, else fail the lock */ - for (i = 0, ptgrab = kbgrab = -1; i < 6; i++) { - if (ptgrab != GrabSuccess) { |
