Do not try to validate an empty password with XF86ScreenSaver
Patch status: superseded
Patch by Vincent Bernat
Long description:
When the XF86ScreenSaver key is used to put a laptop to sleep (or to trigger the screensaver), the key may "bounce" on resume. This is annoying as i3lock will try to validate several empty passwords and wait several seconds before accepting a legit password. Some users may want to validate an empty password: PAM may rely on other sources to unlock the screen, like the presence of a token or the proximity of some Bluetooth device. Hence, we don't forbid this possibility. The intersection of the users validating their password with XF86ScreenSaver and those using a device for password validation should be small enough to not exist until they come up with another patch.
To apply this patch, use:
curl http://cr.i3wm.org/patch/206/raw.patch | git am
b/i3lock.c
27 |
@@ -264,9 +264,14 @@ static void handle_key_press(xcb_key_press_event_t *event) { |
28 |
n = xkb_keysym_to_utf8(ksym, buffer, sizeof(buffer)); |
29 |
|
30 |
switch (ksym) { |
31 |
+ case XKB_KEY_XF86ScreenSaver: |
32 |
+ if (input_position == 0) { |
33 |
+ clear_input(); |
34 |
+ return; |
35 |
+ } |
36 |
+ /* Otherwise, continue below... */ |
37 |
case XKB_KEY_Return: |
38 |
case XKB_KEY_KP_Enter: |
39 |
- case XKB_KEY_XF86ScreenSaver: |
40 |
password[input_position] = '\0'; |
41 |
unlock_state = STATE_KEY_PRESSED; |
42 |
redraw_screen(); |