1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Minor inputwin.c refactoring/cleanup

Function `inp_nonblocking` is changed
to fetch the `inpbloc` pref only once.

`inp_win_resize` cleaned up a bit.
This commit is contained in:
John Hernandez 2023-11-13 12:09:03 +01:00
parent 08d2a51ae4
commit 3dcca35f34

View File

@ -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;
}
}
}