sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

slock-keep_screen-20241127-0751fda.diff (2052B)


      1 From 0751fda0e682c1f60599a6e0afcd512861ee6297 Mon Sep 17 00:00:00 2001
      2 From: agarrigu <83713047+agarrigu@users.noreply.github.com>
      3 Date: Wed, 27 Nov 2024 18:59:56 +0000
      4 Subject: [PATCH] [slock][patch][keep screen] Add patch
      5 
      6 Don't create a background pixel or image, keep the screen as-is before
      7 lock (including keeping any moving parts moving)
      8 ---
      9  slock.c | 15 ++-------------
     10  1 file changed, 2 insertions(+), 13 deletions(-)
     11 
     12 diff --git a/slock.c b/slock.c
     13 index b2f14e3..19a688e 100644
     14 --- a/slock.c
     15 +++ b/slock.c
     16 @@ -188,15 +188,6 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
     17  				break;
     18  			}
     19  			color = len ? INPUT : ((failure || failonclear) ? FAILED : INIT);
     20 -			if (running && oldc != color) {
     21 -				for (screen = 0; screen < nscreens; screen++) {
     22 -					XSetWindowBackground(dpy,
     23 -					                     locks[screen]->win,
     24 -					                     locks[screen]->colors[color]);
     25 -					XClearWindow(dpy, locks[screen]->win);
     26 -				}
     27 -				oldc = color;
     28 -			}
     29  		} else if (rr->active && ev.type == rr->evbase + RRScreenChangeNotify) {
     30  			rre = (XRRScreenChangeNotifyEvent*)&ev;
     31  			for (screen = 0; screen < nscreens; screen++) {
     32 @@ -243,14 +234,12 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
     33  
     34  	/* init */
     35  	wa.override_redirect = 1;
     36 -	wa.background_pixel = lock->colors[INIT];
     37  	lock->win = XCreateWindow(dpy, lock->root, 0, 0,
     38  	                          DisplayWidth(dpy, lock->screen),
     39  	                          DisplayHeight(dpy, lock->screen),
     40 -	                          0, DefaultDepth(dpy, lock->screen),
     41 -	                          CopyFromParent,
     42 +	                          0, 0, InputOnly,
     43  	                          DefaultVisual(dpy, lock->screen),
     44 -	                          CWOverrideRedirect | CWBackPixel, &wa);
     45 +	                          CWOverrideRedirect, &wa);
     46  	lock->pmap = XCreateBitmapFromData(dpy, lock->win, curs, 8, 8);
     47  	invisible = XCreatePixmapCursor(dpy, lock->pmap, lock->pmap,
     48  	                                &color, &color, 0, 0);
     49 -- 
     50 2.45.2
     51