From b73f678ee82a6f3fae36ed39dfc4cfc27c64a871 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Fri, 15 May 2020 16:22:27 -0400 Subject: frontend: Set minimum window size to 640x360 instead of 1280x720 (#3413) --- src/core/frontend/emu_window.cpp | 2 +- src/core/frontend/framebuffer_layout.h | 5 +++++ src/yuzu/loading_screen.cpp | 3 ++- src/yuzu/main.cpp | 21 ++++++++++++++++++--- src/yuzu/main.h | 1 + src/yuzu/main.ui | 12 +++++++++--- 6 files changed, 36 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index eda466a5d..9a081fbd4 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -46,7 +46,7 @@ private: EmuWindow::EmuWindow() { // TODO: Find a better place to set this. config.min_client_area_size = - std::make_pair(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height); + std::make_pair(Layout::MinimumSize::Width, Layout::MinimumSize::Height); active_config = config; touch_state = std::make_shared(); Input::RegisterFactory("emu_window", touch_state); diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index 15ecfb13d..91ecc30ab 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -8,6 +8,11 @@ namespace Layout { +namespace MinimumSize { +constexpr u32 Width = 640; +constexpr u32 Height = 360; +} // namespace MinimumSize + namespace ScreenUndocked { constexpr u32 Width = 1280; constexpr u32 Height = 720; diff --git a/src/yuzu/loading_screen.cpp b/src/yuzu/loading_screen.cpp index 2a6483370..ae842306c 100644 --- a/src/yuzu/loading_screen.cpp +++ b/src/yuzu/loading_screen.cpp @@ -19,6 +19,7 @@ #include #include #include "common/logging/log.h" +#include "core/frontend/framebuffer_layout.h" #include "core/loader/loader.h" #include "ui_loading_screen.h" #include "video_core/rasterizer_interface.h" @@ -61,7 +62,7 @@ LoadingScreen::LoadingScreen(QWidget* parent) : QWidget(parent), ui(std::make_unique()), previous_stage(VideoCore::LoadCallbackStage::Complete) { ui->setupUi(this); - setMinimumSize(1280, 720); + setMinimumSize(Layout::MinimumSize::Width, Layout::MinimumSize::Height); // Create a fade out effect to hide this loading screen widget. // When fading opacity, it will fade to the parent widgets background color, which is why we diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 86e8a1d49..dd6e5173e 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(Settings::values.aspect_ratio), + static_cast(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; diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 60b17c54a..4bff4330c 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -208,6 +208,7 @@ private slots: void ShowFullscreen(); void HideFullscreen(); void ToggleWindowMode(); + void ResetWindowSize(); void OnCaptureScreenshot(); void OnCoreError(Core::System::ResultStatus, std::string); void OnReinitializeKeys(ReinitializeKeyBehavior behavior); diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index ae414241e..97c90f50b 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -6,8 +6,8 @@ 0 0 - 1081 - 730 + 1280 + 720 @@ -44,7 +44,7 @@ 0 0 - 1081 + 1280 21 @@ -96,6 +96,7 @@ + @@ -215,6 +216,11 @@ Show Status Bar + + + Reset Window Size + + true -- cgit v1.2.3