VideoCommon: Pass WindowSystemInfo to InitBackendInfo

This commit is contained in:
Pokechu22
2023-03-25 17:16:53 -07:00
parent 7845fb00ee
commit c63f0f37cd
21 changed files with 76 additions and 57 deletions

View File

@ -24,7 +24,7 @@
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent)
GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent), m_main_window(parent)
{
CreateMainLayout();
@ -68,7 +68,7 @@ void GraphicsWindow::CreateMainLayout()
void GraphicsWindow::OnBackendChanged(const QString& backend_name)
{
Config::SetBase(Config::MAIN_GFX_BACKEND, backend_name.toStdString());
VideoBackendBase::PopulateBackendInfoFromUI();
VideoBackendBase::PopulateBackendInfoFromUI(m_main_window->GetWindowSystemInfo());
setWindowTitle(
tr("%1 Graphics Configuration").arg(tr(g_video_backend->GetDisplayName().c_str())));

View File

@ -28,4 +28,6 @@ signals:
private:
void CreateMainLayout();
void OnBackendChanged(const QString& backend);
MainWindow* const m_main_window;
};

View File

@ -343,12 +343,17 @@ MainWindow::~MainWindow()
Config::Save();
}
WindowSystemInfo MainWindow::GetWindowSystemInfo() const
{
return ::GetWindowSystemInfo(m_render_widget->windowHandle());
}
void MainWindow::InitControllers()
{
if (g_controller_interface.IsInit())
return;
UICommon::InitControllers(GetWindowSystemInfo(windowHandle()));
UICommon::InitControllers(::GetWindowSystemInfo(windowHandle()));
m_hotkey_scheduler = new HotkeyScheduler();
m_hotkey_scheduler->Start();
@ -1098,7 +1103,7 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
// Boot up, show an error if it fails to load the game.
if (!BootManager::BootCore(std::move(parameters),
GetWindowSystemInfo(m_render_widget->windowHandle())))
::GetWindowSystemInfo(m_render_widget->windowHandle())))
{
ModalMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
HideRenderWidget();
@ -1206,7 +1211,7 @@ void MainWindow::HideRenderWidget(bool reinit, bool is_exit)
// The controller interface will still be registered to the old render widget, if the core
// has booted. Therefore, we should re-bind it to the main window for now. When the core
// is next started, it will be swapped back to the new render widget.
g_controller_interface.ChangeWindow(GetWindowSystemInfo(windowHandle()).render_window,
g_controller_interface.ChangeWindow(::GetWindowSystemInfo(windowHandle()).render_window,
is_exit ? ControllerInterface::WindowChangeReason::Exit :
ControllerInterface::WindowChangeReason::Other);
}

View File

@ -50,6 +50,7 @@ class ThreadWidget;
class ToolBar;
class WatchWidget;
class WiiTASInputWindow;
struct WindowSystemInfo;
namespace DiscIO
{
@ -76,6 +77,7 @@ public:
~MainWindow();
void Show();
WindowSystemInfo GetWindowSystemInfo() const;
bool eventFilter(QObject* object, QEvent* event) override;