Change min_client_area_size based on layout

This commit is contained in:
Vitor Kiguchi 2020-01-04 08:59:09 -03:00
parent a0f9c795c8
commit 64737afdbc
3 changed files with 23 additions and 0 deletions

View file

@ -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();
}

View file

@ -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);
}

View file

@ -215,6 +215,13 @@ private:
* Clip the provided coordinates to be inside the touchscreen area.
*/
std::tuple<unsigned, unsigned> 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