[client,SDL] Fix properly handle smart-sizing

* In fullscreen set desktop resolution to argument provided with
  /smart-sizing:<width>x<height>
* In window mode set the window size to /size:<width>x<height> and the
  remote resolution to /smart-sizing:<width>x<height>
* Ignore and print a warning if /multimon is in use (currently not
  defined)
This commit is contained in:
2026-02-13 12:22:13 +09:00
committed by Armin Novak
parent 341b25d508
commit 14c66c8bfc
2 changed files with 40 additions and 4 deletions

View File

@@ -173,6 +173,33 @@ BOOL SdlContext::preConnect(freerdp* instance)
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, maxHeight))
return FALSE;
}
/**
* If /f is specified in combination with /smart-sizing:widthxheight then
* we run the session in the /smart-sizing dimensions scaled to full screen
*/
const uint32_t sw = freerdp_settings_get_uint32(settings, FreeRDP_SmartSizingWidth);
const uint32_t sh = freerdp_settings_get_uint32(settings, FreeRDP_SmartSizingHeight);
const BOOL sm = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
if (sm && (sw > 0) && (sh > 0))
{
const BOOL mm = freerdp_settings_get_bool(settings, FreeRDP_UseMultimon);
if (mm)
WLog_Print(sdl->getWLog(), WLOG_WARN,
"/smart-sizing and /multimon are currently not supported, ignoring "
"/smart-sizing!");
else
{
sdl->_windowWidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
sdl->_windowHeigth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, sw))
return FALSE;
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, sh))
return FALSE;
}
}
}
else
{
@@ -387,13 +414,20 @@ bool SdlContext::createWindows()
auto monitor = static_cast<rdpMonitor*>(
freerdp_settings_get_pointer_array_writable(settings, FreeRDP_MonitorDefArray, x));
auto w = WINPR_ASSERTING_INT_CAST(Uint32, monitor->width);
auto h = WINPR_ASSERTING_INT_CAST(Uint32, monitor->height);
Uint32 w = WINPR_ASSERTING_INT_CAST(Uint32, monitor->width);
Uint32 h = WINPR_ASSERTING_INT_CAST(Uint32, monitor->height);
if (!(freerdp_settings_get_bool(settings, FreeRDP_UseMultimon) ||
freerdp_settings_get_bool(settings, FreeRDP_Fullscreen)))
{
w = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
h = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
if (_windowWidth > 0)
w = _windowWidth;
else
w = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
if (_windowHeigth > 0)
h = _windowHeigth;
else
h = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
}
Uint32 flags = SDL_WINDOW_HIGH_PIXEL_DENSITY;

View File

@@ -208,6 +208,8 @@ class SdlContext
std::map<Uint32, SdlWindow> _windows;
uint32_t _windowWidth = 0;
uint32_t _windowHeigth = 0;
WinPREvent _windowsCreatedEvent;
std::thread _thread;
};