From 22c6e07fca0955214f2ce94a9817a02473a8c3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Wed, 29 Dec 2021 23:31:08 +0100 Subject: [PATCH] emu: make sure to handle key down event if the same key is up at the same frame --- src/uxnemu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/uxnemu.c b/src/uxnemu.c index 5555e11..aec8b61 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -466,6 +466,11 @@ run(Uxn *u) controller_down(devctrl, get_button(&event)); else do_shortcut(u, &event); + if(event.type == SDL_KEYDOWN) { + int ksym = event.key.keysym.sym; + if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) + break; + } } else if(event.type == SDL_KEYUP) controller_up(devctrl, get_button(&event)); else if(event.type == SDL_JOYAXISMOTION) {