uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 205f63cc431d6c7e1e9efa4ef8a6efeb71feafc9
parent 4789d8cceff9db2381ba380dedaeb51418543e3a
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Tue,  4 Jan 2022 01:12:03 +0000

Clear up SDL_KEYDOWN/SDL_TEXTINPUT logic

Diffstat:
Msrc/uxnemu.c | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -465,20 +465,19 @@ run(Uxn *u) else if(event.type == SDL_MOUSEWHEEL) mouse_scroll(devmouse, event.wheel.x, event.wheel.y); /* Controller */ - else if(event.type == SDL_KEYDOWN || event.type == SDL_TEXTINPUT) { - if(event.type == SDL_TEXTINPUT) - controller_key(devctrl, event.text.text[0]); - else if(get_key(&event)) + else if(event.type == SDL_TEXTINPUT) + controller_key(devctrl, event.text.text[0]); + else if(event.type == SDL_KEYDOWN) { + int ksym; + if(get_key(&event)) controller_key(devctrl, get_key(&event)); else if(get_button(&event)) 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; - } + 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) {