| 87 | } |
| 88 | |
| 89 | static void preprocess_events(SDL_Event *event) |
| 90 | { |
| 91 | // Supported touch gestures: |
| 92 | // left mouse click: single finger short tap |
| 93 | // right mouse click: second finger short tap while first finger is still down |
| 94 | // pointer motion: single finger drag |
| 95 | // left button drag and drop: dual finger drag |
| 96 | // right button drag and drop: triple finger drag |
| 97 | if (event->type != SDL_FINGERDOWN && event->type != SDL_FINGERUP && event->type != SDL_FINGERMOTION) { |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | // front (0) or back (1) panel |
| 102 | SDL_TouchID port = event->tfinger.touchId; |
| 103 | if (port != 0) { |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | switch (event->type) { |
| 108 | case SDL_FINGERDOWN: |
| 109 | preprocess_finger_down(event); |
| 110 | break; |
| 111 | case SDL_FINGERUP: |
| 112 | preprocess_finger_up(event); |
| 113 | break; |
| 114 | case SDL_FINGERMOTION: |
| 115 | preprocess_finger_motion(event); |
| 116 | break; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | static void preprocess_finger_down(SDL_Event *event) |
| 121 | { |
no test coverage detected