diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-05-15 16:22:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 22:22:27 +0200 |
commit | b73f678ee82a6f3fae36ed39dfc4cfc27c64a871 (patch) | |
tree | c87d2dc03d7ef150c49f694af33b1ad1c6f1ea7f /src/yuzu/main.cpp | |
parent | 024c84d2db68584dac144175fa85aaa87ef7acc5 (diff) |
frontend: Set minimum window size to 640x360 instead of 1280x720 (#3413)
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 86e8a1d491..dd6e5173e5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -724,13 +724,13 @@ void GMainWindow::InitializeHotkeys() { } void GMainWindow::SetDefaultUIGeometry() { - // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half + // geometry: 53% of the window contents are in the upper screen half, 47% in the lower half const QRect screenRect = QApplication::desktop()->screenGeometry(this); const int w = screenRect.width() * 2 / 3; - const int h = screenRect.height() / 2; + const int h = screenRect.height() * 2 / 3; const int x = (screenRect.x() + screenRect.width()) / 2 - w / 2; - const int y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100; + const int y = (screenRect.y() + screenRect.height()) / 2 - h * 53 / 100; setGeometry(x, y, w, h); } @@ -831,6 +831,7 @@ void GMainWindow::ConnectMenuEvents() { &GMainWindow::OnDisplayTitleBars); connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); + connect(ui.action_Reset_Window_Size, &QAction::triggered, this, &GMainWindow::ResetWindowSize); // Fullscreen ui.action_Fullscreen->setShortcut( @@ -1829,6 +1830,20 @@ void GMainWindow::ToggleWindowMode() { } } +void GMainWindow::ResetWindowSize() { + const auto aspect_ratio = Layout::EmulationAspectRatio( + static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio), + static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width); + if (!ui.action_Single_Window_Mode->isChecked()) { + render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio, + Layout::ScreenUndocked::Height); + } else { + resize(Layout::ScreenUndocked::Height / aspect_ratio, + Layout::ScreenUndocked::Height + menuBar()->height() + + (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0)); + } +} + void GMainWindow::OnConfigure() { const auto old_theme = UISettings::values.theme; const bool old_discord_presence = UISettings::values.enable_discord_presence; |