X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=8f595ecef284cc199912d6f8023f015912a1fc13;hb=ccbc62287e20cd3776b95980a77be3fee5ad7053;hp=122311d1a527345b924ce8bca12673dca7d216e8;hpb=3ae70b9d27b4b2c038f35b0aa5985c368542a486;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 122311d1..8f595ece 100644 --- a/src/events.c +++ b/src/events.c @@ -39,7 +39,7 @@ static unsigned int playfield_cursor_delay = 0; /* event filter addition for SDL2: as SDL2 does not have a function to enable or disable keyboard auto-repeat, filter repeated keyboard events instead */ -int FilterEvents(const Event *event) +static int FilterEventsExt(const Event *event) { MotionEvent *motion; @@ -74,6 +74,18 @@ int FilterEvents(const Event *event) return 1; } +#if defined(TARGET_SDL2) +int FilterEvents(void *userdata, Event *event) +{ + return FilterEventsExt(event); +} +#else +int FilterEvents(const Event *event) +{ + return FilterEventsExt(event); +} +#endif + /* to prevent delay problems, skip mouse motion events if the very next event is also a mouse motion event (and therefore effectively only handling the last of a row of mouse motion events in the event queue) */ @@ -115,7 +127,7 @@ static boolean NextValidEvent(Event *event) NextEvent(event); - if (FilterMouseMotionEvents(event)) + if (FilterEventsExt(event)) handle_this_event = TRUE; if (SkipPressedMouseMotionEvent(event)) @@ -140,6 +152,13 @@ void EventLoop(void) { switch (event.type) { +#if defined(PLATFORM_ANDROID) + // !!! TEST ONLY !!! + case SDL_QUIT: + case SDL_FINGERDOWN: + CloseAllAndExit(0); +#endif + case EVENT_BUTTONPRESS: case EVENT_BUTTONRELEASE: HandleButtonEvent((ButtonEvent *) &event);