From b1b9b50f7b77451088d8681320f55b0b32729f05 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Fri, 4 Jun 2021 20:53:11 -0400 Subject: [PATCH] Fixed logic issue so that the main window size is not saved if the screen is in full or maximize modes. Only save previous screen size to config if in normal window mode. This prevents the next start of fceux setting the initial window size to close to maximum. --- src/drivers/Qt/ConsoleVideoConf.cpp | 6 ++++++ src/drivers/Qt/ConsoleWindow.cpp | 26 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/drivers/Qt/ConsoleVideoConf.cpp b/src/drivers/Qt/ConsoleVideoConf.cpp index 8eebfd9e..5f190507 100644 --- a/src/drivers/Qt/ConsoleVideoConf.cpp +++ b/src/drivers/Qt/ConsoleVideoConf.cpp @@ -935,6 +935,12 @@ void ConsoleVideoConfDialog_t::applyChanges( void ) yscale = yScaleBox->value(); } + // Save desired scaling and window size to config. + g_config->setOption("SDL.XScale", xscale ); + g_config->setOption("SDL.YScale", yscale ); + g_config->setOption("SDL.WinSizeX", s.width() ); + g_config->setOption("SDL.WinSizeY", s.height() ); + if ( consoleWindow->viewport_GL ) { consoleWindow->viewport_GL->setLinearFilterEnable( gl_LF_chkBox->isChecked() ); diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index b18abd57..38175613 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -231,18 +231,24 @@ consoleWin_t::~consoleWin_t(void) // Save window size and image scaling parameters at app exit. w = consoleWindow->size(); - if ( viewport_GL != NULL ) + // Only Save window size if not fullscreen and not maximized + if ( !consoleWindow->isFullScreen() && !consoleWindow->isMaximized() ) { - g_config->setOption( "SDL.XScale", viewport_GL->getScaleX() ); - g_config->setOption( "SDL.YScale", viewport_GL->getScaleY() ); + // Scaling is only saved when applying video settings + //if ( viewport_GL != NULL ) + //{ + // g_config->setOption( "SDL.XScale", viewport_GL->getScaleX() ); + // g_config->setOption( "SDL.YScale", viewport_GL->getScaleY() ); + //} + //else if ( viewport_SDL != NULL ) + //{ + // g_config->setOption( "SDL.XScale", viewport_SDL->getScaleX() ); + // g_config->setOption( "SDL.YScale", viewport_SDL->getScaleY() ); + //} + + g_config->setOption( "SDL.WinSizeX", w.width() ); + g_config->setOption( "SDL.WinSizeY", w.height() ); } - else if ( viewport_SDL != NULL ) - { - g_config->setOption( "SDL.XScale", viewport_SDL->getScaleX() ); - g_config->setOption( "SDL.YScale", viewport_SDL->getScaleY() ); - } - g_config->setOption( "SDL.WinSizeX", w.width() ); - g_config->setOption( "SDL.WinSizeY", w.height() ); g_config->save(); // Signal Emulator Thread to Stop