Blame SOURCES/0002-main-Do-not-update-the-display-on-backspace-when-the.patch

ff210d
From da27e42316962be6f6b8ba2afb49760d9704d070 Mon Sep 17 00:00:00 2001
ff210d
From: Hans de Goede <hdegoede@redhat.com>
ff210d
Date: Sun, 21 Jan 2018 14:07:39 +0100
ff210d
Subject: [PATCH 2/6] main: Do not update the display on backspace when there
ff210d
 is no input to remove
ff210d
ff210d
On machines with a slow CPU (Atom) and a highres screen drawing the
ff210d
diskcrypt dialog may take longer then the keyrepeat speed, this leads to
ff210d
a long delay before showing keypresses when doing the following:
ff210d
ff210d
1) Type long password
ff210d
2) Realize it is wrong, press + hold backspace
ff210d
   the key-repeat will now generate backspace key presses faster then we
ff210d
   process them as main.c does an update_display for each press
ff210d
3) Users releases backspace when we've processed input-length backspace
ff210d
   key-presses, but since we were drawing slower then key-presses were
ff210d
   coming in many more backspace keypresses are in the keyboard buffer
ff210d
4) User types first character of the right password, this shows up up to
ff210d
   a couple of seconds later because first we are still processing all
ff210d
   the queued up backspace presses and doing a redraw for each.
ff210d
ff210d
This commit fixes this by skipping the redraws in on_backspace when there
ff210d
is no more input left in the input buffer.
ff210d
ff210d
https://bugs.freedesktop.org/show_bug.cgi?id=104714
ff210d
---
ff210d
 src/main.c | 2 ++
ff210d
 1 file changed, 2 insertions(+)
ff210d
ff210d
diff --git a/src/main.c b/src/main.c
ff210d
index 08c7fe1..f1e0fa7 100644
ff210d
--- a/src/main.c
ff210d
+++ b/src/main.c
ff210d
@@ -1570,6 +1570,8 @@ on_backspace (state_t *state)
ff210d
 
ff210d
         bytes = ply_buffer_get_bytes (state->entry_buffer);
ff210d
         size = ply_buffer_get_size (state->entry_buffer);
ff210d
+        if (size == 0)
ff210d
+                return;
ff210d
 
ff210d
         bytes_to_remove = MIN (size, PLY_UTF8_CHARACTER_SIZE_MAX);
ff210d
         while ((previous_character_size = ply_utf8_character_get_size (bytes + size - bytes_to_remove, bytes_to_remove)) < bytes_to_remove) {
ff210d
-- 
ff210d
2.17.0
ff210d