diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-11-20 13:10:25 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-11-23 02:37:12 +0100 |
commit | 8723daf6969c682043a7080a2eaa9106463bb492 (patch) | |
tree | 01f975fd2bce52218d0ae042fac06ee089d20e83 /src/plugins/platforms/cocoa | |
parent | 5ab2b8b95156f74210f9d6cc49a62f9e3a82c9ec (diff) |
Rename QWSI::handleWindowActivated to QWSI::handleFocusWindowChanged
A single QWindow is QGuiApplication::focusWindow() at a time, and this
window is typically also QWindow::isActive(), but other windows may also
be QWindow::isActive(). For example, we treat any sibling or ancestor
of the focusWindow as being QWindow::isActive() as well.
In addition, in the case of non-QWindow child windows, we may have to
query the platform for the activation state, which means we also need
a way for the platform to reflect changes in this state through QWSI.
The current API for this, QWSI::handleWindowActivated, is in practice
a focus window change API, so as a first step let's rename it to better
reflect what it's doing.
Task-number: QTBUG-119287
Change-Id: I381baf8505dd13a4a829c961095a8d2ed120092b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 6 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 05b9f19fec..0533a6e1e9 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1261,8 +1261,8 @@ void QCocoaWindow::windowDidBecomeKey() return; // See also [QNSView becomeFirstResponder] - QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>( - focusCocoaWindow->window(), Qt::ActiveWindowFocusReason); + QWindowSystemInterface::handleFocusWindowChanged<QWindowSystemInterface::SynchronousDelivery>( + window(), Qt::ActiveWindowFocusReason); } void QCocoaWindow::windowDidResignKey() @@ -1288,7 +1288,7 @@ void QCocoaWindow::windowDidResignKey() // Lost key window, go ahead and set the active window to zero if (!windowIsPopupType()) { - QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>( + QWindowSystemInterface::handleFocusWindowChanged<QWindowSystemInterface::SynchronousDelivery>( nullptr, Qt::ActiveWindowFocusReason); } } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index faeb75ed2e..b3b3ec40cd 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -328,7 +328,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper); // QWindow activation from QCocoaWindow::windowDidBecomeKey instead. The only // exception is if the window can never become key, in which case we naturally // cannot wait for that to happen. - QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>( + QWindowSystemInterface::handleFocusWindowChanged<QWindowSystemInterface::SynchronousDelivery>( [self topLevelWindow], Qt::ActiveWindowFocusReason); } |