From 64737afdbc7ef324cbe63ea713fb5a911108ed19 Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Sat, 4 Jan 2020 08:59:09 -0300 Subject: [PATCH] Change min_client_area_size based on layout --- src/citra_qt/bootmanager.cpp | 1 + src/core/frontend/emu_window.cpp | 15 +++++++++++++++ src/core/frontend/emu_window.h | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index f28fcdf10..e32aac670 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -374,6 +374,7 @@ void GRenderWindow::InitRenderTarget() { core_context = CreateSharedContext(); resize(Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight); OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); + OnFramebufferSizeChanged(); BackupGeometry(); } diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 23c33f627..d35255117 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -145,6 +145,7 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) { void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { Layout::FramebufferLayout layout; + unsigned int min_width, min_height; if (Settings::values.custom_layout == true) { layout = Layout::CustomFrameLayout(width, height); } else { @@ -152,21 +153,35 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) case Settings::LayoutOption::SingleScreen: layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen, Settings::values.upright_screen); + min_width = Settings::values.swap_screen ? 320u : 400u; + min_height = 240u; break; case Settings::LayoutOption::LargeScreen: layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen, Settings::values.upright_screen); + min_width = Settings::values.swap_screen ? 420u : 480u; + min_height = 240u; break; case Settings::LayoutOption::SideScreen: layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen, Settings::values.upright_screen); + min_width = 720u; + min_height = 240u; break; case Settings::LayoutOption::Default: default: layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen, Settings::values.upright_screen); + min_width = 400u; + min_height = 480u; break; } + if(Settings::values.upright_screen){ + UpdateMinimumWindowSize(min_height, min_width); + } + else{ + UpdateMinimumWindowSize(min_width, min_height); + } } NotifyFramebufferLayoutChanged(layout); } diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h index df6203842..ce6913c63 100644 --- a/src/core/frontend/emu_window.h +++ b/src/core/frontend/emu_window.h @@ -215,6 +215,13 @@ private: * Clip the provided coordinates to be inside the touchscreen area. */ std::tuple ClipToTouchScreen(unsigned new_x, unsigned new_y) const; + + void UpdateMinimumWindowSize(unsigned int min_width, unsigned int min_height){ + WindowConfig new_config = config; + new_config.min_client_area_size = std::make_pair(min_width, min_height); + SetConfig(new_config); + ProcessConfigurationChanges(); + } }; } // namespace Frontend