From 2d1c3aa9651a8014678171fe33c9178ddfca26da Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sun, 20 Jun 2021 22:38:45 +0100 Subject: [PATCH] Further fixes to keyboard handling --- src/uxnemu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uxnemu.c b/src/uxnemu.c index 0e8a35d..e1c6485 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -209,11 +209,12 @@ doctrl(Uxn *u, SDL_Event *event, int z) case SDLK_DOWN: flag = 0x20; break; case SDLK_LEFT: flag = 0x40; break; case SDLK_RIGHT: flag = 0x80; break; - case SDLK_DELETE: devctrl->dat[3] = z ? 0x7f : 0x00; break; } - if(z) + if(z) { devctrl->dat[2] |= flag; - else + if(event->key.keysym.sym < 0x20 || event->key.keysym.sym == SDLK_DELETE) + devctrl->dat[3] = event->key.keysym.sym; + } else devctrl->dat[2] &= ~flag; } @@ -360,7 +361,7 @@ start(Uxn *u) quit(); break; case SDL_TEXTINPUT: - devctrl->dat[3] = event.text.text[0]; + devctrl->dat[3] = event.text.text[0]; /* fall-thru */ case SDL_KEYDOWN: case SDL_KEYUP: doctrl(u, &event, event.type == SDL_KEYDOWN);