summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-01-21 14:07:39 +0100
committerRay Strode <rstrode@redhat.com>2018-04-10 11:32:52 -0400
commitda27e42316962be6f6b8ba2afb49760d9704d070 (patch)
treecfca1a6c50987b93ec94f1ae975bf6321a6474df
parent6e9e95dc0fe89a3c52f50e44ff0096a6e65e46a6 (diff)
main: Do not update the display on backspace when there is no input to remove
On machines with a slow CPU (Atom) and a highres screen drawing the diskcrypt dialog may take longer then the keyrepeat speed, this leads to a long delay before showing keypresses when doing the following: 1) Type long password 2) Realize it is wrong, press + hold backspace the key-repeat will now generate backspace key presses faster then we process them as main.c does an update_display for each press 3) Users releases backspace when we've processed input-length backspace key-presses, but since we were drawing slower then key-presses were coming in many more backspace keypresses are in the keyboard buffer 4) User types first character of the right password, this shows up up to a couple of seconds later because first we are still processing all the queued up backspace presses and doing a redraw for each. This commit fixes this by skipping the redraws in on_backspace when there is no more input left in the input buffer. https://bugs.freedesktop.org/show_bug.cgi?id=104714
-rw-r--r--src/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 08c7fe1a..f1e0fa7c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1570,6 +1570,8 @@ on_backspace (state_t *state)
bytes = ply_buffer_get_bytes (state->entry_buffer);
size = ply_buffer_get_size (state->entry_buffer);
+ if (size == 0)
+ return;
bytes_to_remove = MIN (size, PLY_UTF8_CHARACTER_SIZE_MAX);
while ((previous_character_size = ply_utf8_character_get_size (bytes + size - bytes_to_remove, bytes_to_remove)) < bytes_to_remove) {