From cfb944b0caece91f13de0adc0d5aff958ae733e2 Mon Sep 17 00:00:00 2001 From: jasaaved Date: Wed, 25 Mar 2026 00:03:14 -0700 Subject: [PATCH] Add Fullscreen Monitor Selector Under graphics settings, the user can now choose which screen the game will launch on --- Source/Core/Core/Config/MainSettings.cpp | 1 + Source/Core/Core/Config/MainSettings.h | 1 + .../Config/Graphics/GeneralWidget.cpp | 22 +++++++++++++++++++ .../DolphinQt/Config/Graphics/GeneralWidget.h | 1 + Source/Core/DolphinQt/RenderWidget.cpp | 8 +++++++ 5 files changed, 33 insertions(+) diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 147aeedf50..f9c0a14a98 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -294,6 +294,7 @@ const Info MAIN_WII_NUS_SHOP_URL{{System::Main, "Core", "WiiNusShop const Info MAIN_FULLSCREEN_DISPLAY_RES{ {System::Main, "Display", "FullscreenDisplayRes"}, "Auto"}; const Info MAIN_FULLSCREEN{{System::Main, "Display", "Fullscreen"}, false}; +const Info MAIN_FULLSCREEN_MONITOR{{System::Main, "Display", "FullscreenMonitor"}, 0}; const Info MAIN_RENDER_TO_MAIN{{System::Main, "Display", "RenderToMain"}, false}; const Info MAIN_RENDER_WINDOW_XPOS{{System::Main, "Display", "RenderWindowXPos"}, -1}; const Info MAIN_RENDER_WINDOW_YPOS{{System::Main, "Display", "RenderWindowYPos"}, -1}; diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index a1baf26242..a4788ad495 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -191,6 +191,7 @@ bool ShouldUseDPL2Decoder(); extern const Info MAIN_FULLSCREEN_DISPLAY_RES; extern const Info MAIN_FULLSCREEN; +extern const Info MAIN_FULLSCREEN_MONITOR; extern const Info MAIN_RENDER_TO_MAIN; extern const Info MAIN_RENDER_WINDOW_XPOS; extern const Info MAIN_RENDER_WINDOW_YPOS; diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp index 9ade7dfe0e..fc18cbd57a 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp @@ -7,9 +7,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -91,6 +93,18 @@ void GeneralWidget::CreateWidgets() video_layout->addWidget(m_custom_aspect_width, 3, 1); video_layout->addWidget(m_custom_aspect_height, 3, 2); + m_monitor_combo = new ToolTipComboBox; + m_monitor_combo->addItem(tr("Primary Monitor")); + const QList screens = QGuiApplication::screens(); + for (int i = 0; i < screens.size(); i++) + m_monitor_combo->addItem(tr("Monitor %1: %2").arg(i + 1).arg(screens[i]->name())); + const int monitor_index = Config::Get(Config::MAIN_FULLSCREEN_MONITOR); + if (monitor_index < m_monitor_combo->count()) + m_monitor_combo->setCurrentIndex(monitor_index); + + video_layout->addWidget(new QLabel(tr("Fullscreen Monitor:")), 4, 0); + video_layout->addWidget(m_monitor_combo, 4, 1, 1, -1); + auto* const basic_grid = new QGridLayout; video_layout->addLayout(basic_grid, video_layout->rowCount(), 0, 1, -1); basic_grid->addWidget(m_enable_vsync, 0, 0); @@ -156,6 +170,9 @@ void GeneralWidget::ConnectWidgets() Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND))); }); + connect(m_monitor_combo, &QComboBox::currentIndexChanged, this, [](int index) { + Config::SetBaseOrCurrent(Config::MAIN_FULLSCREEN_MONITOR, index); + }); connect(m_aspect_combo, &QComboBox::currentIndexChanged, this, &GeneralWidget::ToggleCustomAspectRatio); } @@ -308,6 +325,11 @@ void GeneralWidget::AddDescriptions() m_adapter_combo->SetTitle(tr("Adapter")); + m_monitor_combo->SetTitle(tr("Fullscreen Monitor")); + m_monitor_combo->SetDescription( + tr("Selects which display to use for fullscreen.

" + "If unsure, select Primary Monitor.")); + m_aspect_combo->SetTitle(tr("Aspect Ratio")); m_aspect_combo->SetDescription(tr(TR_ASPECT_RATIO_DESCRIPTION)); diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h index 50f7346daa..e92b8776ea 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h @@ -44,6 +44,7 @@ private: // Video ConfigStringChoice* m_backend_combo; ToolTipComboBox* m_adapter_combo; + ToolTipComboBox* m_monitor_combo; ConfigChoice* m_aspect_combo; QLabel* m_custom_aspect_label; ConfigInteger* m_custom_aspect_width; diff --git a/Source/Core/DolphinQt/RenderWidget.cpp b/Source/Core/DolphinQt/RenderWidget.cpp index 9b5026d5fb..37ebe5a0be 100644 --- a/Source/Core/DolphinQt/RenderWidget.cpp +++ b/Source/Core/DolphinQt/RenderWidget.cpp @@ -206,6 +206,14 @@ void RenderWidget::HandleCursorTimer() void RenderWidget::showFullScreen() { + const int monitor_index = Config::Get(Config::MAIN_FULLSCREEN_MONITOR); + const QList screens = QGuiApplication::screens(); + QScreen* const target_screen = (monitor_index > 0 && monitor_index <= screens.size()) + ? screens[monitor_index - 1] + : QGuiApplication::primaryScreen(); + if (monitor_index > 0) + move(target_screen->availableGeometry().topLeft()); + QWidget::showFullScreen(); QScreen* screen = window()->windowHandle()->screen();