| 37 | } |
| 38 | |
| 39 | bool FetchMessage_Real(SDL_Event *event, uint16_t *modState) |
| 40 | { |
| 41 | #ifdef __SWITCH__ |
| 42 | HandleDocking(); |
| 43 | #endif |
| 44 | |
| 45 | SDL_Event e; |
| 46 | if (PollEvent(&e) == 0) { |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | event->type = static_cast<SDL_EventType>(0); |
| 51 | *modState = SDL_GetModState(); |
| 52 | |
| 53 | #ifdef __vita__ |
| 54 | HandleTouchEvent(&e, MousePosition); |
| 55 | #elif !defined(USE_SDL1) |
| 56 | HandleTouchEvent(e); |
| 57 | #endif |
| 58 | |
| 59 | if (e.type == SDL_QUIT || IsCustomEvent(e.type)) { |
| 60 | *event = e; |
| 61 | return true; |
| 62 | } |
| 63 | |
| 64 | if (IsAnyOf(e.type, SDL_KEYUP, SDL_KEYDOWN) && e.key.keysym.sym == SDLK_UNKNOWN) { |
| 65 | // Erroneous events generated by RG350 kernel. |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | #if !defined(USE_SDL1) && !defined(__vita__) |
| 70 | if (!movie_playing) { |
| 71 | // SDL generates mouse events from touch-based inputs to provide basic |
| 72 | // touchscreeen support for apps that don't explicitly handle touch events |
| 73 | if (IsAnyOf(e.type, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP) && e.button.which == SDL_TOUCH_MOUSEID) |
| 74 | return true; |
| 75 | if (e.type == SDL_MOUSEMOTION && e.motion.which == SDL_TOUCH_MOUSEID) |
| 76 | return true; |
| 77 | if (e.type == SDL_MOUSEWHEEL && e.wheel.which == SDL_TOUCH_MOUSEID) |
| 78 | return true; |
| 79 | } |
| 80 | #endif |
| 81 | |
| 82 | #ifdef USE_SDL1 |
| 83 | if (e.type == SDL_MOUSEMOTION) { |
| 84 | OutputToLogical(&e.motion.x, &e.motion.y); |
| 85 | } else if (IsAnyOf(e.type, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP)) { |
| 86 | OutputToLogical(&e.button.x, &e.button.y); |
| 87 | } |
| 88 | #endif |
| 89 | |
| 90 | if (HandleControllerAddedOrRemovedEvent(e)) |
| 91 | return true; |
| 92 | |
| 93 | switch (e.type) { |
| 94 | #if SDL_VERSION_ATLEAST(2, 0, 0) |
| 95 | case SDL_CONTROLLERAXISMOTION: |
| 96 | case SDL_CONTROLLERBUTTONDOWN: |
no test coverage detected