From d8667dca0b03383e6f3f91af4e5acaf281597a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Sat, 25 Dec 2021 22:58:10 +0100 Subject: [PATCH] emu event loop: peek for a key up only on key down event --- src/uxnemu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uxnemu.c b/src/uxnemu.c index ff1faf4..6979c2c 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -502,9 +502,11 @@ run(Uxn *u) uxn_eval(u, devctrl->vector); devctrl->dat[3] = 0; - ksym = event.key.keysym.sym; - if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) - goto breakout; + if(event.type == SDL_KEYDOWN) { + ksym = event.key.keysym.sym; + if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) + goto breakout; + } break; case SDL_MOUSEWHEEL: case SDL_MOUSEBUTTONUP: