Qt: Don't steal focus when a modal dialog is open

This commit is contained in:
Ty Lamontagne
2026-02-08 09:28:05 -05:00
committed by Ty
parent 6accade0d5
commit 2557c2e887
+8 -1
View File
@@ -479,8 +479,15 @@ bool DisplaySurface::eventFilter(QObject* object, QEvent* event)
// macOS: When we (the display window) get focus from another window with a toolbar we update to the MainWindow toolbar.
// This is because we are a different native window from our MainWindow. So, whenever we get focus, focus our MainWindow.
// That way macOS will show the MainWindow toolbar when you click from the debugger / log window to the game.
if (auto* w = qobject_cast<QWidget*>(object))
// Don't try to steal focus when we're showing a modal dialog
// We end up ping ponging focus in a feedback loop
if (QApplication::activeModalWidget() != nullptr)
return false;
if (const auto* w = qobject_cast<QWidget*>(object))
w->window()->activateWindow();
return false;
default:
return false;