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()
|
std::optional<WindowInfo> MainWindow::getWindowInfo()
|
||||||
{
|
{
|
||||||
|
if (isRenderingToMain())
|
||||||
return QtUtils::GetWindowInfoForWidget(this);
|
return QtUtils::GetWindowInfoForWidget(this);
|
||||||
|
else if (QWidget* widget = getDisplayContainer())
|
||||||
|
return QtUtils::GetWindowInfoForWidget(widget);
|
||||||
|
else
|
||||||
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::InvalidateSaveStateCache()
|
void Host::InvalidateSaveStateCache()
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include "common/Console.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
#elif !defined(APPLE)
|
#elif !defined(APPLE)
|
||||||
|
@ -222,6 +224,12 @@ namespace QtUtils
|
||||||
|
|
||||||
std::optional<WindowInfo> GetWindowInfoForWidget(QWidget* widget)
|
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;
|
WindowInfo wi;
|
||||||
|
|
||||||
// Windows and Apple are easy here since there's no display connection.
|
// Windows and Apple are easy here since there's no display connection.
|
||||||
|
@ -248,7 +256,7 @@ namespace QtUtils
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical() << "Unknown PNI platform " << platform_name;
|
Console.WriteLn("Unknown PNI platform '%s'.", platform_name.toUtf8().constData());
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue