Clear up SDL_KEYDOWN/SDL_TEXTINPUT logic
This commit is contained in:
parent
4789d8ccef
commit
205f63cc43
17
src/uxnemu.c
17
src/uxnemu.c
|
@ -465,20 +465,19 @@ run(Uxn *u)
|
||||||
else if(event.type == SDL_MOUSEWHEEL)
|
else if(event.type == SDL_MOUSEWHEEL)
|
||||||
mouse_scroll(devmouse, event.wheel.x, event.wheel.y);
|
mouse_scroll(devmouse, event.wheel.x, event.wheel.y);
|
||||||
/* Controller */
|
/* Controller */
|
||||||
else if(event.type == SDL_KEYDOWN || event.type == SDL_TEXTINPUT) {
|
else if(event.type == SDL_TEXTINPUT)
|
||||||
if(event.type == SDL_TEXTINPUT)
|
controller_key(devctrl, event.text.text[0]);
|
||||||
controller_key(devctrl, event.text.text[0]);
|
else if(event.type == SDL_KEYDOWN) {
|
||||||
else if(get_key(&event))
|
int ksym;
|
||||||
|
if(get_key(&event))
|
||||||
controller_key(devctrl, get_key(&event));
|
controller_key(devctrl, get_key(&event));
|
||||||
else if(get_button(&event))
|
else if(get_button(&event))
|
||||||
controller_down(devctrl, get_button(&event));
|
controller_down(devctrl, get_button(&event));
|
||||||
else
|
else
|
||||||
do_shortcut(u, &event);
|
do_shortcut(u, &event);
|
||||||
if(event.type == SDL_KEYDOWN) {
|
ksym = event.key.keysym.sym;
|
||||||
int ksym = event.key.keysym.sym;
|
if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym)
|
||||||
if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym)
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if(event.type == SDL_KEYUP)
|
} else if(event.type == SDL_KEYUP)
|
||||||
controller_up(devctrl, get_button(&event));
|
controller_up(devctrl, get_button(&event));
|
||||||
else if(event.type == SDL_JOYAXISMOTION) {
|
else if(event.type == SDL_JOYAXISMOTION) {
|
||||||
|
|
Loading…
Reference in New Issue