summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-04-28 17:22:53 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-04-29 22:28:56 +0000
commit1337e8fe46ac7934f80b8a95b84b5cb61707f8e4 (patch)
treeafcab092c06f4745508dae058beb4b368c90abc6 /src
parent062b50abff6a3cb2319ade41dddf76caa36f27e3 (diff)
macOS/iOS: set focus reason when handling window deactivation
Otherwise, the focusOutEvent to e.g. a QQuickItem losting focus will be OtherFocusReason when the window it's becomes inactive. Task-number: QTBUG-70319 Change-Id: Ic3762e68d92a88becd2b35612b14f6af64ee934e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm2
-rw-r--r--src/plugins/platforms/ios/quiview.mm4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index f387c0d093..e471d2af28 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1199,7 +1199,8 @@ void QCocoaWindow::windowDidBecomeKey()
}
if (!windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(window());
+ QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
+ window(), Qt::ActiveWindowFocusReason);
}
void QCocoaWindow::windowDidResignKey()
@@ -1217,7 +1218,8 @@ void QCocoaWindow::windowDidResignKey()
if (!keyWindow || keyWindow == m_view.window) {
// No new key window, go ahead and set the active window to zero
if (!windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(0);
+ QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
+ nullptr, Qt::ActiveWindowFocusReason);
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index a6e5ca5f7b..bae839b38c 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -308,7 +308,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMouseMoveHelper);
if ([self isTransparentForUserInput])
return NO;
if (!m_platformWindow->windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated([self topLevelWindow]);
+ QWindowSystemInterface::handleWindowActivated([self topLevelWindow], Qt::ActiveWindowFocusReason);
return YES;
}
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index 6254b43dc1..f937f7874b 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -286,7 +286,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
}
if (qGuiApp->focusWindow() != self.platformWindow->window())
- QWindowSystemInterface::handleWindowActivated(self.platformWindow->window());
+ QWindowSystemInterface::handleWindowActivated(self.platformWindow->window(), Qt::ActiveWindowFocusReason);
else
qImDebug() << self.platformWindow->window() << "already active, not sending window activation";
@@ -323,7 +323,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
UIResponder *newResponder = FirstResponderCandidate::currentCandidate();
if ([self responderShouldTriggerWindowDeactivation:newResponder])
- QWindowSystemInterface::handleWindowActivated(0);
+ QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason);
return YES;
}