getkey: gracefully take command after other keyboard primitives

This commit is contained in:
Lephe 2020-02-20 21:09:39 +01:00
parent d655aa934f
commit b6f545e63c
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,15 @@ key_event_t getkey_opt(int opt, volatile int *timeout)
/* Keyboard time when the key was pressed */
static int rep_time = 0;
/* Reset the state if the repeated key went up due to different
graphical primitives being used */
if(rep_key && !keydown(rep_key))
{
rep_key = 0;
rep_count = 0;
rep_time = 0;
}
while(1) switch((ev = pollevent()).type)
{
/* Key press: handle modifiers or return an event */