summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioswindow.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-02-04 14:53:15 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-14 00:34:25 +0100
commit3475dba53c34f986776b3c8b2a11e322c3ad4d71 (patch)
tree94b1ba9c591520f2696fa1ffffd800dac6e6d4e1 /src/plugins/platforms/ios/qioswindow.mm
parente33eb158116421b0ef87bbae25cecabdb84a2509 (diff)
iOS: activate window on touchesBegan
We need to activate a window on touchesBegan instead of touchesEnded. The reason we used to do this on touchesEnded was to delay activating a window in case the user started e.g a flick. But delaying the activation can cause problems if the app activates a different window on press. We will then cancel this out on release since we then raise the pressed window instead. This is e.g typical when opening popups, and will cause focus to not be restored properly when later closing the popup again. Change-Id: I709b2f2e2633c9dc85c2761b0b176cd23c2f6b36 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qioswindow.mm')
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 41a253e605..f0f436f405 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -247,6 +247,9 @@
m_activeTouches[touch].id = m_nextTouchId++;
}
+ if (m_activeTouches.size() == 1 && m_qioswindow->window() != QGuiApplication::focusWindow())
+ m_qioswindow->requestActivateWindow();
+
[self updateTouchList:touches withState:Qt::TouchPointPressed];
[self sendTouchEventWithTimestamp:ulong(event.timestamp * 1000)];
}
@@ -259,14 +262,6 @@
- (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)];