[client] win: add new option win:shrinkOnUpscale

This option constrains the client's window dimensions to the guest's resolution when 'dontUpscale' is also enabled
This commit is contained in:
A.J. Ruckman 2021-03-28 15:28:56 -04:00 committed by Geoffrey McRae
parent 60feb3050c
commit dec4c8533c
4 changed files with 24 additions and 0 deletions

View File

@ -126,6 +126,7 @@ Command line arguments will override any options loaded from the config files.
| win:keepAspect | -r | yes | Maintain the correct aspect ratio | | win:keepAspect | -r | yes | Maintain the correct aspect ratio |
| win:forceAspect | | yes | Force the window to maintain the aspect ratio | | win:forceAspect | | yes | Force the window to maintain the aspect ratio |
| win:dontUpscale | | no | Never try to upscale the window | | win:dontUpscale | | no | Never try to upscale the window |
| win:shrinkOnUpscale | | no | Limit the window dimensions when dontUpscale is enabled |
| win:borderless | -d | no | Borderless mode | | win:borderless | -d | no | Borderless mode |
| win:fullScreen | -F | no | Launch in fullscreen borderless mode | | win:fullScreen | -F | no | Launch in fullscreen borderless mode |
| win:maximize | -T | no | Launch window maximized | | win:maximize | -T | no | Launch window maximized |

View File

@ -161,6 +161,13 @@ static struct Option options[] =
.type = OPTION_TYPE_BOOL, .type = OPTION_TYPE_BOOL,
.value.x_bool = false, .value.x_bool = false,
}, },
{
.module = "win",
.name = "shrinkOnUpscale",
.description = "Limit the window dimensions when dontUpscale is enabled",
.type = OPTION_TYPE_BOOL,
.value.x_bool = false,
},
{ {
.module = "win", .module = "win",
.name = "borderless", .name = "borderless",
@ -500,6 +507,7 @@ bool config_load(int argc, char * argv[])
g_params.keepAspect = option_get_bool ("win", "keepAspect" ); g_params.keepAspect = option_get_bool ("win", "keepAspect" );
g_params.forceAspect = option_get_bool ("win", "forceAspect" ); g_params.forceAspect = option_get_bool ("win", "forceAspect" );
g_params.dontUpscale = option_get_bool ("win", "dontUpscale" ); g_params.dontUpscale = option_get_bool ("win", "dontUpscale" );
g_params.shrinkOnUpscale = option_get_bool ("win", "shrinkOnUpscale");
g_params.borderless = option_get_bool ("win", "borderless" ); g_params.borderless = option_get_bool ("win", "borderless" );
g_params.fullscreen = option_get_bool ("win", "fullScreen" ); g_params.fullscreen = option_get_bool ("win", "fullScreen" );
g_params.maximize = option_get_bool ("win", "maximize" ); g_params.maximize = option_get_bool ("win", "maximize" );

View File

@ -238,6 +238,20 @@ void core_updatePositionInfo(void)
g_state.dstRect.y = (g_state.windowH >> 1) - (g_state.dstRect.h >> 1); g_state.dstRect.y = (g_state.windowH >> 1) - (g_state.dstRect.h >> 1);
} }
if (g_params.dontUpscale && g_params.shrinkOnUpscale)
{
if (g_state.windowW > srcW)
{
force = true;
g_state.dstRect.w = srcW;
}
if (g_state.windowH > srcH)
{
force = true;
g_state.dstRect.h = srcH;
}
}
if (force && g_params.forceAspect) if (force && g_params.forceAspect)
{ {
g_state.resizeTimeout = microtime() + RESIZE_TIMEOUT; g_state.resizeTimeout = microtime() + RESIZE_TIMEOUT;

View File

@ -106,6 +106,7 @@ struct AppParams
bool keepAspect; bool keepAspect;
bool forceAspect; bool forceAspect;
bool dontUpscale; bool dontUpscale;
bool shrinkOnUpscale;
bool borderless; bool borderless;
bool fullscreen; bool fullscreen;
bool maximize; bool maximize;