summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 4c8a16b0bc..c8d0f823f6 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -183,12 +183,6 @@
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
- QWindow *window = m_qioswindow->window();
-
- // Transfer focus to the touched window:
- if (window != QGuiApplication::focusWindow())
- m_qioswindow->requestActivateWindow();
-
// UIKit generates [Began -> Moved -> Ended] event sequences for
// each touch point. Internally we keep a hashmap of active UITouch
// points to QWindowSystemInterface::TouchPoints, and assigns each TouchPoint
@@ -210,6 +204,14 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
+ QWindow *window = m_qioswindow->window();
+ if (window != QGuiApplication::focusWindow() && m_activeTouches.size() == 1) {
+ // Activate the touched window if the last touch was released inside it:
+ UITouch *touch = static_cast<UITouch *>([[touches allObjects] lastObject]);
+ if (CGRectContainsPoint([self bounds], [touch locationInView:self]))
+ m_qioswindow->requestActivateWindow();
+ }
+
[self updateTouchList:touches withState:Qt::TouchPointReleased];
[self sendTouchEventWithTimestamp:ulong(event.timestamp * 1000)];