From 1eb399bd4cba3eddf65a1e314937940d2e1dba6d Mon Sep 17 00:00:00 2001 From: kub Date: Thu, 22 Oct 2020 22:34:14 +0200 Subject: [PATCH] fix menu input handling (timeout non-working) --- input.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/input.c b/input.c index d0e4a4e..9d938ea 100644 --- a/input.c +++ b/input.c @@ -432,20 +432,12 @@ int in_menu_wait_any(char *charcode, int timeout_ms) { int keys_old = menu_key_state; int ret; + int is_down = 0, dev_id = 0; - while (1) - { - int code, is_down = 0, dev_id = 0; - - code = in_update_keycode(&dev_id, &is_down, charcode, timeout_ms); - if (code < 0) - break; + in_update_keycode(&dev_id, &is_down, charcode, timeout_ms); - if (keys_old != menu_key_state) { - menu_last_used_dev = dev_id; - break; - } - } + if (keys_old != menu_key_state) + menu_last_used_dev = dev_id; ret = menu_key_state; menu_key_state &= ~PBTN_CHAR; @@ -548,13 +540,13 @@ static int in_set_blocking(int is_blocking) } } - menu_key_state = 0; - /* flush events */ do { ret = in_update_keycode(NULL, NULL, NULL, 0); } while (ret >= 0); + menu_key_state = 0; + return 0; } -- 2.39.5