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.

Pick-to: 6.0 6.1 5.15
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>
This commit is contained in:
Volker Hilsheimer 2021-02-12 00:03:14 +01:00
parent 3fa50b7b41
commit 24b07b2b2d
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

@ -266,7 +266,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