On Aug 27 17:38, Eric Pruitt wrote:
> On Tue, Aug 28, 2018 at 10:24:43AM +1200, David Phillips wrote:
> > The patch Michael Buch linked should work for you. For background, I
> > created it because previous discussion hereabout 2 years ago showed
> > that the community rather keep slock extremely paranoid and ready to
> > trip to the failed state at any keypress in order to indicate any
> > form of tampering.
>
> I wrote a patch (attached) for similar reasons, but instead of
> completely ignoring shift, it waits until it's released to change the
> screen. The patch won't apply cleanly because it depends on another
> patch I wrote, but it's a relatively simple change.
>
> Eric
> Title: Improved Modifier Handling
> Author: Eric Pruitt (https://www.codevat.com/, https://github.com/ericpruitt/)
>
> With this patch, modifier keys only cause the screen to display the failure
> color when they are released without pressing a complementary key.
>
> This patch depends on "slock-00-pam-authentication.diff".
>
> --- a/slock.c
> +++ b/slock.c
> _AT_@ -226,6 +226,7 @@ readpw(struct xrandr *rr, int nscreens, const char *hash)
> unsigned int len, color;
> KeySym ksym;
> XEvent ev;
> + int seenkeypress = 0;
>
> len = 0;
> running = 1;
> _AT_@ -233,9 +234,14 @@ readpw(struct xrandr *rr, int nscreens, const char *hash)
> * utility. This way the user can easily set a customized DPMS
> * timeout. */
> while (running && !XNextEvent(dpy, &ev)) {
> - if (ev.type == KeyPress) {
> + if (ev.type == KeyPress || ev.type == KeyRelease) {
> explicit_bzero(&buf, sizeof(buf));
> num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0);
> + seenkeypress |= ev.type == KeyPress;
> + if ((ev.type == KeyRelease && (num || !seenkeypress)) ||
> + (ev.type == KeyPress && !num)) {
> + continue;
> + }
> if (IsKeypadKey(ksym)) {
> if (ksym == XK_KP_Enter)
> ksym = XK_Return;
Great, this is another way to solve the problem. Wait until shift
key is released before showing the failure screen. Either way works.
I thought I would push my patch, but didn't know exactly how the
developers of slock would like it fixed. Or even if they did.
Received on Tue Aug 28 2018 - 02:53:33 CEST