summaryrefslogtreecommitdiff
path: root/src/ui/touch.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-19 13:15:08 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-19 13:15:08 +0200
commit7a0980fd58308f7333254a1276e6dd5072326d98 (patch)
tree8431dfd498762a90944bb5e595f61ea2af914a81 /src/ui/touch.c
parent63dc07ddbecfdf0be7c0bd98c53e492628dda98b (diff)
iOS: Adjusting the UI for a tablet screen
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r--src/ui/touch.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 9b47d0fe..d7d2bca1 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -187,6 +187,19 @@ static void update_TouchState_(void *ptr) {
187 } 187 }
188} 188}
189 189
190static void dispatchButtonUp_Touch_(iFloat3 pos) {
191 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &(SDL_MouseButtonEvent){
192 .type = SDL_MOUSEBUTTONUP,
193 .timestamp = SDL_GetTicks(),
194 .clicks = 1,
195 .state = SDL_RELEASED,
196 .which = SDL_TOUCH_MOUSEID,
197 .button = SDL_BUTTON_LEFT,
198 .x = x_F3(pos),
199 .y = y_F3(pos)
200 });
201}
202
190iBool processEvent_Touch(const SDL_Event *ev) { 203iBool processEvent_Touch(const SDL_Event *ev) {
191 /* We only handle finger events here. */ 204 /* We only handle finger events here. */
192 if (ev->type != SDL_FINGERDOWN && ev->type != SDL_FINGERMOTION && ev->type != SDL_FINGERUP) { 205 if (ev->type != SDL_FINGERDOWN && ev->type != SDL_FINGERMOTION && ev->type != SDL_FINGERUP) {
@@ -258,6 +271,13 @@ iBool processEvent_Touch(const SDL_Event *ev) {
258 }); 271 });
259 return iTrue; 272 return iTrue;
260 } 273 }
274 /*dispatchEvent_Widget(window->root, (SDL_Event *) &(SDL_MouseMotionEvent){
275 .type = SDL_MOUSEMOTION,
276 .timestamp = fing->timestamp,
277 .which = SDL_TOUCH_MOUSEID,
278 .x = x_F3(pos),
279 .y = y_F3(pos)
280 });*/
261 /* Update touch position. */ 281 /* Update touch position. */
262 pushPos_Touch_(touch, pos, nowTime); 282 pushPos_Touch_(touch, pos, nowTime);
263 const iFloat3 amount = add_F3(touch->remainder, 283 const iFloat3 amount = add_F3(touch->remainder,
@@ -304,16 +324,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
304 continue; 324 continue;
305 } 325 }
306 if (flags_Widget(touch->affinity) & touchDrag_WidgetFlag) { 326 if (flags_Widget(touch->affinity) & touchDrag_WidgetFlag) {
307 dispatchEvent_Widget(window->root, (SDL_Event *) &(SDL_MouseButtonEvent){ 327 dispatchButtonUp_Touch_(pos);
308 .type = SDL_MOUSEBUTTONUP,
309 .timestamp = fing->timestamp,
310 .clicks = 1,
311 .state = SDL_RELEASED,
312 .which = SDL_TOUCH_MOUSEID,
313 .button = SDL_BUTTON_LEFT,
314 .x = x_F3(pos),
315 .y = y_F3(pos)
316 });
317 remove_ArrayIterator(&i); 328 remove_ArrayIterator(&i);
318 continue; 329 continue;
319 } 330 }
@@ -357,6 +368,9 @@ iBool processEvent_Touch(const SDL_Event *ev) {
357 } 368 }
358 pushBack_Array(d->moms, &mom); 369 pushBack_Array(d->moms, &mom);
359 } 370 }
371 else {
372 dispatchButtonUp_Touch_(pos);
373 }
360 } 374 }
361 remove_ArrayIterator(&i); 375 remove_ArrayIterator(&i);
362 } 376 }