From 3dcca35f34bcdbaeac0fe8393940f7da8ba52184 Mon Sep 17 00:00:00 2001 From: John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:09:03 +0100 Subject: [PATCH] Minor `inputwin.c` refactoring/cleanup Function `inp_nonblocking` is changed to fetch the `inpbloc` pref only once. `inp_win_resize` cleaned up a bit. --- src/ui/inputwin.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 3966daca..5ceddd62 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -237,15 +237,16 @@ inp_win_resize(void) } wbkgd(inp_win, theme_attrs(THEME_INPUT_TEXT)); - ; + _inp_win_update_virtual(); } void inp_nonblocking(gboolean reset) { + gint inpblock = prefs_get_inpblock(); if (!prefs_get_boolean(PREF_INPBLOCK_DYNAMIC)) { - inp_timeout = prefs_get_inpblock(); + inp_timeout = inpblock; return; } @@ -254,14 +255,14 @@ inp_nonblocking(gboolean reset) no_input_count = 0; } - if (inp_timeout < prefs_get_inpblock()) { + if (inp_timeout < inpblock) { no_input_count++; if (no_input_count % 10 == 0) { inp_timeout += no_input_count; - if (inp_timeout > prefs_get_inpblock()) { - inp_timeout = prefs_get_inpblock(); + if (inp_timeout > inpblock) { + inp_timeout = inpblock; } } }