| 118 | } |
| 119 | |
| 120 | static void preprocess_finger_down(SDL_Event *event) |
| 121 | { |
| 122 | // front (0) or back (1) panel |
| 123 | SDL_TouchID port = event->tfinger.touchId; |
| 124 | // id (for multitouch) |
| 125 | SDL_FingerID id = event->tfinger.fingerId; |
| 126 | |
| 127 | int x = mouse_x; |
| 128 | int y = mouse_y; |
| 129 | |
| 130 | if (direct_touch) { |
| 131 | x = event->tfinger.x * visible_width + x_borderwidth; |
| 132 | y = event->tfinger.y * visible_height + y_borderwidth; |
| 133 | dvl::OutputToLogical(&x, &y); |
| 134 | } |
| 135 | |
| 136 | // make sure each finger is not reported down multiple times |
| 137 | for (int i = 0; i < MAX_NUM_FINGERS; i++) { |
| 138 | if (finger[port][i].id != id) { |
| 139 | continue; |
| 140 | } |
| 141 | finger[port][i].id = NO_TOUCH; |
| 142 | } |
| 143 | |
| 144 | // we need the timestamps to decide later if the user performed a short tap (click) |
| 145 | // or a long tap (drag) |
| 146 | // we also need the last coordinates for each finger to keep track of dragging |
| 147 | for (int i = 0; i < MAX_NUM_FINGERS; i++) { |
| 148 | if (finger[port][i].id != NO_TOUCH) { |
| 149 | continue; |
| 150 | } |
| 151 | finger[port][i].id = id; |
| 152 | finger[port][i].time_last_down = event->tfinger.timestamp; |
| 153 | finger[port][i].last_down_x = event->tfinger.x; |
| 154 | finger[port][i].last_down_y = event->tfinger.y; |
| 155 | finger[port][i].last_x = x; |
| 156 | finger[port][i].last_y = y; |
| 157 | break; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | static void preprocess_finger_up(SDL_Event *event) |
| 162 | { |
no test coverage detected