Introduction
Introduction Statistics Contact Development Disclaimer Help
slock-squares-password-1.5.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
slock-squares-password-1.5.diff (3022B)
---
1 diff -up ./config.def.h ../config.def.h
2 --- ./config.def.h 2025-04-15 00:55:12.710000000 -0400
3 +++ ../config.def.h 2025-04-15 00:55:54.790000000 -0400
4 @@ -10,3 +10,6 @@ static const int failonclear = 1;
5
6 /* size of square in px */
7 static const int squaresize = 50;
8 +
9 +/* spacing between squares in px */
10 +static const int squarespacing = 10;
11 diff -up ./slock.c ../slock.c
12 --- ./slock.c 2025-04-15 00:55:12.710000000 -0400
13 +++ ../slock.c 2025-04-15 00:54:09.660000000 -0400
14 @@ -130,7 +130,7 @@ gethash(void)
15
16 static void
17 draw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
18 - unsigned int color)
19 + unsigned int len, unsigned int color)
20 {
21 int screen, crtc;
22 XRRCrtcInfo* rrci;
23 @@ -145,14 +145,19 @@ draw(Display *dpy, struct xrandr *rr, st
24 locks[screen]->rr…
25 locks[screen]->rr…
26 /* skip disabled crtc */
27 - if (rrci->noutput > 0)
28 - XFillRectangle(dpy,
29 - locks[screen]->w…
30 - locks[screen]->g…
31 - rrci->x + (rrci-…
32 - rrci->y + (rrci-…
33 - squaresize,
34 - squaresize);
35 + if (rrci->noutput > 0) {
36 + if (len < 1)
37 + len = 1;
38 + int xoffset = (int) ((squaresiz…
39 + for (int i = 0; i < len; i++)
40 + XFillRectangle(dpy,
41 + locks[sc…
42 + locks[sc…
43 + rrci->x …
44 + rrci->y …
45 + squaresi…
46 + squaresi…
47 + }
48 XRRFreeCrtcInfo(rrci);
49 }
50 }
51 @@ -172,7 +177,7 @@ readpw(Display *dpy, struct xrandr *rr,
52 {
53 XRRScreenChangeNotifyEvent *rre;
54 char buf[32], passwd[256], *inputhash;
55 - int num, screen, running, failure, oldc;
56 + int num, screen, running, failure;
57 unsigned int len, color;
58 KeySym ksym;
59 XEvent ev;
60 @@ -180,7 +185,6 @@ readpw(Display *dpy, struct xrandr *rr,
61 len = 0;
62 running = 1;
63 failure = 0;
64 - oldc = INIT;
65
66 while (running && !XNextEvent(dpy, &ev)) {
67 if (ev.type == KeyPress) {
68 @@ -230,9 +234,8 @@ readpw(Display *dpy, struct xrandr *rr,
69 break;
70 }
71 color = len ? INPUT : ((failure || failonclear)…
72 - if (running && oldc != color) {
73 - draw(dpy, rr, locks, nscreens, color);
74 - oldc = color;
75 + if (running) {
76 + draw(dpy, rr, locks, nscreens, len, col…
77 }
78 } else if (rr->active && ev.type == rr->evbase + RRScre…
79 rre = (XRRScreenChangeNotifyEvent*)&ev;
80 @@ -428,7 +431,7 @@ main(int argc, char **argv) {
81 }
82
83 /* draw the initial rectangle */
84 - draw(dpy, &rr, locks, nscreens, INIT);
85 + draw(dpy, &rr, locks, nscreens, 0, INIT);
86
87 /* everything is now blank. Wait for the correct password */
88 readpw(dpy, &rr, locks, nscreens, hash);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.