From 718f04af6dc0a22769fb643a1b68b3494ba2bb93 Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Tue, 21 Jan 2020 13:32:51 -0300 Subject: [PATCH] Correctly treat cases when current size is smaller than the minimum defined by the layout --- src/core/frontend/emu_window.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 641512891d..cfc13c2df3 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -152,29 +152,29 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) } else { switch (Settings::values.layout_option) { case Settings::LayoutOption::SingleScreen: - layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen, - Settings::values.upright_screen); min_width = Settings::values.swap_screen ? Core::kScreenBottomWidth : Core::kScreenTopWidth; min_height = Core::kScreenBottomHeight; + layout = Layout::SingleFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen, + Settings::values.upright_screen); break; case Settings::LayoutOption::LargeScreen: - layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen, - Settings::values.upright_screen); min_width = Settings::values.swap_screen ? Core::kScreenTopWidth/4 + Core::kScreenBottomWidth : Core::kScreenTopWidth + Core::kScreenBottomWidth/4; min_height = Core::kScreenBottomHeight; + layout = Layout::LargeFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen, + Settings::values.upright_screen); break; case Settings::LayoutOption::SideScreen: - layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen, - Settings::values.upright_screen); min_width = Core::kScreenTopWidth + Core::kScreenBottomWidth; min_height = Core::kScreenBottomHeight; + layout = Layout::SideFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen, + Settings::values.upright_screen); break; case Settings::LayoutOption::Default: default: - layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen, - Settings::values.upright_screen); min_width = Core::kScreenTopWidth; min_height = Core::kScreenTopHeight + Core::kScreenBottomHeight; + layout = Layout::DefaultFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen, + Settings::values.upright_screen); break; } if(Settings::values.upright_screen){