Clear up SDL_KEYDOWN/SDL_TEXTINPUT logic

This commit is contained in:
Andrew Alderwick 2022-01-04 01:12:03 +00:00
parent 4789d8ccef
commit 205f63cc43
1 changed files with 8 additions and 9 deletions

View File

@ -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)
else if(event.type == SDL_TEXTINPUT)
controller_key(devctrl, event.text.text[0]);
else if(get_key(&event))
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;
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) {