Blob Blame History Raw
From 2e5bee59d5444f84126df845bfb8e02cd252576f Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Thu, 10 Dec 2009 19:24:58 +0100
Subject: Skip keypresses without entering a password, they cause a delay

When suspending your system to RAM, a race-condition can occur which
causes many enter keypresses to be sent. These effectively delay
your login by 3 seconds times 50 times (or so), so we just skip empty
passwords. If your password is empty, you don’t need to lock your
screen anyway.
---
diff --git i3lock-1.0.orig/i3lock.c i3lock-1.0/i3lock.c
index d136ad2..de880c3 100644
--- i3lock-1.0.orig/i3lock.c
+++ i3lock-1.0/i3lock.c
@@ -335,6 +335,9 @@ int main(int argc, char *argv[])
                 switch(ksym) {
                 case XK_Return:
                         passwd[len] = 0;
+                        /* Skip empty passwords */
+                        if (len == 0)
+                                continue;
                         if ((ret = pam_authenticate(handle, 0)) == PAM_SUCCESS)
                                 running = false;
                         else {
--
cgit v0.8.3