[core,capabilities] Fix pointer cache size logic

This commit is contained in:
akallabeth 2022-11-22 17:26:25 +01:00 committed by akallabeth
parent f2545a2ad7
commit 6aa8253b6c

View File

@ -1075,11 +1075,28 @@ static BOOL rdp_apply_pointer_capability_set(rdpSettings* settings, const rdpSet
WINPR_ASSERT(settings); WINPR_ASSERT(settings);
WINPR_ASSERT(src); WINPR_ASSERT(src);
if (!src->ColorPointerFlag) if (!freerdp_settings_get_bool(src, FreeRDP_ColorPointerFlag))
settings->ColorPointerFlag = FALSE; {
if (!freerdp_settings_set_bool(settings, FreeRDP_ColorPointerFlag, FALSE))
return FALSE;
}
settings->PointerCacheSize = src->PointerCacheSize; const UINT32 pointerCacheSize = freerdp_settings_get_uint32(src, FreeRDP_PointerCacheSize);
settings->ColorPointerCacheSize = src->ColorPointerCacheSize; const UINT32 colorPointerCacheSize =
freerdp_settings_get_uint32(src, FreeRDP_ColorPointerCacheSize);
const UINT32 dstPointerCacheSize =
freerdp_settings_get_uint32(settings, FreeRDP_PointerCacheSize);
const UINT32 dstColorPointerCacheSize =
freerdp_settings_get_uint32(settings, FreeRDP_ColorPointerCacheSize);
/* We want the minimum of our setting and the remote announced value. */
const UINT32 actualPointerCacheSize = MIN(pointerCacheSize, dstPointerCacheSize);
const UINT32 actualColorPointerCacheSize = MIN(colorPointerCacheSize, dstColorPointerCacheSize);
if (!freerdp_settings_set_uint32(settings, FreeRDP_PointerCacheSize, actualPointerCacheSize) ||
!freerdp_settings_set_uint32(settings, FreeRDP_ColorPointerCacheSize,
actualColorPointerCacheSize))
return FALSE;
return TRUE; return TRUE;
} }