diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index 8d424a963b..2816862892 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -1295,7 +1295,12 @@ void MainWindow::checkForSettingChanges() std::optional MainWindow::getWindowInfo() { - return QtUtils::GetWindowInfoForWidget(this); + if (isRenderingToMain()) + return QtUtils::GetWindowInfoForWidget(this); + else if (QWidget* widget = getDisplayContainer()) + return QtUtils::GetWindowInfoForWidget(widget); + else + return std::nullopt; } void Host::InvalidateSaveStateCache() diff --git a/pcsx2-qt/QtUtils.cpp b/pcsx2-qt/QtUtils.cpp index 4a7d89fe26..2451b0d9a5 100644 --- a/pcsx2-qt/QtUtils.cpp +++ b/pcsx2-qt/QtUtils.cpp @@ -40,6 +40,8 @@ #include #include +#include "common/Console.h" + #if defined(_WIN32) #include "common/RedtapeWindows.h" #elif !defined(APPLE) @@ -222,6 +224,12 @@ namespace QtUtils std::optional GetWindowInfoForWidget(QWidget* widget) { + if (!widget->isVisible()) + { + Console.WriteLn("Returning null window info for widget because it is not visible."); + return std::nullopt; + } + WindowInfo wi; // Windows and Apple are easy here since there's no display connection. @@ -248,7 +256,7 @@ namespace QtUtils } else { - qCritical() << "Unknown PNI platform " << platform_name; + Console.WriteLn("Unknown PNI platform '%s'.", platform_name.toUtf8().constData()); return std::nullopt; } #endif