summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/quiview.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-03-13 11:19:29 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-03-16 13:52:40 +0000
commitbf1e0b6008227f3a0c0e5dce4cde64c57c4a6839 (patch)
tree2ad581271038ad1803f15c1a874cffb386eed490 /src/plugins/platforms/ios/quiview.mm
parent60cdc6035d25441fd99a7d341892ee2fb1002741 (diff)
iOS: Check if window was active on setVisible(false) through native APIs
When a QWindow is closed and destroyed it resets QGuiApp::focus_window before calling setVisible(false) on the platform window, so we don't have the needed information anymore to check if the window we are hiding was the focus-window. To work around this we use the native state instead, which should still be valid if the window was the focus window. Change-Id: I98057e6393411471f03668e3e5ce544f6b49c01d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/ios/quiview.mm')
-rw-r--r--src/plugins/platforms/ios/quiview.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index a56db1d6f5..8be3515cb5 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -261,6 +261,23 @@
return YES;
}
+- (BOOL)isActiveWindow
+{
+ // Normally this is determined exclusivly by being firstResponder, but
+ // since we employ a separate first responder for text input we need to
+ // handle both cases as this view being the active Qt window.
+
+ if ([self isFirstResponder])
+ return YES;
+
+ UIResponder *firstResponder = [UIResponder currentFirstResponder];
+ if ([firstResponder isKindOfClass:[QIOSTextInputResponder class]]
+ && [firstResponder nextResponder] == self)
+ return YES;
+
+ return NO;
+}
+
// -------------------------------------------------------------------------