sites

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

slock-unlock_screen-1.4.diff (1601B)


      1 From ccfc4c1ab41826b4bac99e53a844ca244fcfb330 Mon Sep 17 00:00:00 2001
      2 From: Arif Roktim <aroktim@stuy.edu>
      3 Date: Wed, 25 Apr 2018 21:27:59 -0400
      4 Subject: [PATCH] Lock input but don't lock screen
      5 
      6 This patch keeps the screen unlocked but keeps the input locked. 
      7 That is, the screen is not affected by slock, but users will not
      8 be able to interact with the X session unless they enter the correct password.
      9 
     10 There's a lot of extraneous code that can be removed since the goal is
     11 for input to be locked while at the same time allowing the screen to be
     12 updated and viewable. But this patch just works (tm) and I don't want to
     13 potentially introduce bugs.
     14 ---
     15  slock.c | 3 +--
     16  1 file changed, 1 insertion(+), 2 deletions(-)
     17 
     18 diff --git a/slock.c b/slock.c
     19 index d2f0886..98f5d80 100644
     20 --- a/slock.c
     21 +++ b/slock.c
     22 @@ -254,7 +254,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
     23  			ptgrab = XGrabPointer(dpy, lock->root, False,
     24  			                      ButtonPressMask | ButtonReleaseMask |
     25  			                      PointerMotionMask, GrabModeAsync,
     26 -			                      GrabModeAsync, None, invisible, CurrentTime);
     27 +			                      GrabModeAsync, None, None, CurrentTime);
     28  		}
     29  		if (kbgrab != GrabSuccess) {
     30  			kbgrab = XGrabKeyboard(dpy, lock->root, True,
     31 @@ -263,7 +263,6 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
     32  
     33  		/* input is grabbed: we can lock the screen */
     34  		if (ptgrab == GrabSuccess && kbgrab == GrabSuccess) {
     35 -			XMapRaised(dpy, lock->win);
     36  			if (rr->active)
     37  				XRRSelectInput(dpy, lock->win, RRScreenChangeNotifyMask);
     38  
     39 -- 
     40 2.17.0
     41