mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-09-11 04:46:24 -05:00
Original position restored from Fullscreen
When using a separate window, the window position is now saved after exiting fullscreen. Subsequent exits from fullscreen will restore the window to this saved position. Additional coding style issues have been fixed. Changed "primary monitor" to "default monitor"
This commit is contained in:
@@ -94,7 +94,7 @@ void GeneralWidget::CreateWidgets()
|
||||
video_layout->addWidget(m_custom_aspect_height, 3, 2);
|
||||
|
||||
m_monitor_combo = new ToolTipComboBox;
|
||||
m_monitor_combo->addItem(tr("Primary Monitor"));
|
||||
m_monitor_combo->addItem(tr("Default Monitor"));
|
||||
const QList<QScreen*> 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()));
|
||||
@@ -170,9 +170,8 @@ 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_DISPLAY_MONITOR, index);
|
||||
});
|
||||
connect(m_monitor_combo, &QComboBox::currentIndexChanged, this,
|
||||
[](int index) { Config::SetBaseOrCurrent(Config::MAIN_DISPLAY_MONITOR, index); });
|
||||
connect(m_aspect_combo, &QComboBox::currentIndexChanged, this,
|
||||
&GeneralWidget::ToggleCustomAspectRatio);
|
||||
}
|
||||
@@ -328,7 +327,7 @@ void GeneralWidget::AddDescriptions()
|
||||
m_monitor_combo->SetTitle(tr("Display Monitor"));
|
||||
m_monitor_combo->SetDescription(
|
||||
tr("Selects which display to use when rendering.<br><br>"
|
||||
"<dolphin_emphasis>If unsure, select Primary Monitor.</dolphin_emphasis>"));
|
||||
"<dolphin_emphasis>If unsure, select Default Monitor.</dolphin_emphasis>"));
|
||||
|
||||
m_aspect_combo->SetTitle(tr("Aspect Ratio"));
|
||||
m_aspect_combo->SetDescription(tr(TR_ASPECT_RATIO_DESCRIPTION));
|
||||
|
||||
@@ -1088,7 +1088,7 @@ void MainWindow::FullScreen()
|
||||
|
||||
if (was_fullscreen)
|
||||
{
|
||||
ShowRenderWidget();
|
||||
ShowRenderWidget(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1246,23 +1246,22 @@ void MainWindow::SetFullScreenResolution(bool fullscreen)
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::ShowRenderWidget()
|
||||
void MainWindow::ShowRenderWidget(bool from_fullscreen)
|
||||
{
|
||||
SetFullScreenResolution(false);
|
||||
Host::GetInstance()->SetRenderFullscreen(false);
|
||||
|
||||
const int monitor_index = Config::Get(Config::MAIN_DISPLAY_MONITOR);
|
||||
const QList<QScreen*> screens = QGuiApplication::screens();
|
||||
QScreen* const target_screen = (monitor_index > 0 && monitor_index <= screens.size())
|
||||
? screens[monitor_index - 1]
|
||||
: QGuiApplication::primaryScreen();
|
||||
QScreen* const target_screen = (monitor_index > 0 && monitor_index <= screens.size()) ?
|
||||
screens[monitor_index - 1] :
|
||||
QGuiApplication::primaryScreen();
|
||||
|
||||
if (Config::Get(Config::MAIN_RENDER_TO_MAIN))
|
||||
{
|
||||
// Move the main window to the selected monitor if it isn't already there.
|
||||
// Guard with isEmpty() so fullscreen toggles don't overwrite the saved geometry.
|
||||
if (monitor_index > 0 && screen() != target_screen &&
|
||||
m_pre_game_main_window_geometry.isEmpty())
|
||||
if (monitor_index > 0 && screen() != target_screen && m_pre_game_main_window_geometry.isEmpty())
|
||||
{
|
||||
m_pre_game_main_window_geometry = saveGeometry();
|
||||
const QRect geo = target_screen->availableGeometry();
|
||||
@@ -1281,12 +1280,14 @@ void MainWindow::ShowRenderWidget()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Separate window: restore saved size, then center on the selected monitor if one is set.
|
||||
// Separate window: restore saved size and position. Only center on the selected monitor
|
||||
// when first showing the window; skip when returning from fullscreen so the saved position
|
||||
// is preserved.
|
||||
m_rendering_to_main = false;
|
||||
|
||||
m_render_widget->showNormal();
|
||||
m_render_widget->restoreGeometry(m_render_widget_geometry);
|
||||
if (monitor_index > 0)
|
||||
if (monitor_index > 0 && !from_fullscreen)
|
||||
{
|
||||
const QRect geo = target_screen->availableGeometry();
|
||||
m_render_widget->move(geo.x() + (geo.width() - m_render_widget->width()) / 2,
|
||||
|
||||
@@ -163,7 +163,7 @@ private:
|
||||
void StartGame(const std::vector<std::string>& paths,
|
||||
std::unique_ptr<BootSessionData> boot_session_data = nullptr);
|
||||
void StartGame(std::unique_ptr<BootParameters>&& parameters);
|
||||
void ShowRenderWidget();
|
||||
void ShowRenderWidget(bool from_fullscreen = false);
|
||||
void HideRenderWidget(bool reinit = true, bool is_exit = false);
|
||||
|
||||
void ShowSettingsWindow();
|
||||
|
||||
Reference in New Issue
Block a user