macOS: don't let windows that are transparent for input become key window

Such windows are typically used as mostly transparent overlays on top
of other windows underneath. Letting such an overlay become the key
window breaks cursor updates and focus handling.

Fixes: QTBUG-83632
Change-Id: I192d419a5bdb8dfa0e9223e9fbbd7876c62fe743
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 24b07b2b2d367c61b911c8f3a72f7209ef7e00d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2021-02-12 00:03:14 +01:00 committed by Qt Cherry-pick Bot
parent aebbf928fa
commit e1cc406ea4
2 changed files with 3 additions and 2 deletions

View File

@ -1857,7 +1857,7 @@ bool QCocoaWindow::shouldRefuseKeyWindowAndFirstResponder()
// This function speaks up if there's any reason
// to refuse key window or first responder state.
if (window()->flags() & Qt::WindowDoesNotAcceptFocus)
if (window()->flags() & (Qt::WindowDoesNotAcceptFocus | Qt::WindowTransparentForInput))
return true;
if (m_inSetVisible) {

View File

@ -265,7 +265,8 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
- (BOOL)canBecomeFirstResponder
{
return !(self.platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus);
return !(self.platformWindow->window()->flags() & (Qt::WindowDoesNotAcceptFocus
| Qt::WindowTransparentForInput));
}
- (BOOL)becomeFirstResponder