mirror of https://github.com/PCSX2/pcsx2.git
Qt: Fix Host::GetTopLevelWindowInfo() in nogui mode
This commit is contained in:
parent
4e5692e935
commit
f83fc9ba27
|
@ -1295,7 +1295,12 @@ void MainWindow::checkForSettingChanges()
|
|||
|
||||
std::optional<WindowInfo> 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()
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include <array>
|
||||
#include <map>
|
||||
|
||||
#include "common/Console.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "common/RedtapeWindows.h"
|
||||
#elif !defined(APPLE)
|
||||
|
@ -222,6 +224,12 @@ namespace QtUtils
|
|||
|
||||
std::optional<WindowInfo> 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
|
||||
|
|
Loading…
Reference in New Issue