From 0150dcfd4428a85212628685f1c344afa0a97fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 17 Apr 2021 12:07:40 +0200 Subject: [PATCH] Change pointer ID allocation on iOS. Fixes part of #14240 The dialog code checks for touch.id != 0 to decide whether to close. Not sure if really necessary, but keeping it and just changing the IDs. --- Common/UI/UIScreen.cpp | 3 ++- ios/ViewController.mm | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index 156eea5c35..98518c703e 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -226,8 +226,9 @@ bool PopupScreen::touch(const TouchInput &touch) { return UIDialogScreen::touch(touch); } - if (!box_->GetBounds().Contains(touch.x, touch.y)) + if (!box_->GetBounds().Contains(touch.x, touch.y)) { TriggerFinish(DR_BACK); + } return UIDialogScreen::touch(touch); } diff --git a/ios/ViewController.mm b/ios/ViewController.mm index a0d89b5959..55a13e58d8 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -386,8 +386,8 @@ static LocationHelper *locationHelper; } int ToTouchID(UITouch *uiTouch, bool allowAllocate) { - // Find the id for the touch. Avoid 0 (mouse.) - for (int localId = 1; localId < (int)ARRAY_SIZE(g_touches); ++localId) { + // Find the id for the touch. + for (int localId = 0; localId < (int)ARRAY_SIZE(g_touches); ++localId) { if (g_touches[localId] == uiTouch) { return localId; } @@ -395,7 +395,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { // Allocate a new one, perhaps? if (allowAllocate) { - for (int localId = 1; localId < (int)ARRAY_SIZE(g_touches); ++localId) { + for (int localId = 0; localId < (int)ARRAY_SIZE(g_touches); ++localId) { if (g_touches[localId] == 0) { g_touches[localId] = uiTouch; return localId;