mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 09:54:26 +08:00
Merge pull request #10780 from akallabeth/window-fake-monitor
Window fake monitor
This commit is contained in:
commit
5538681fc3
@ -189,6 +189,10 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
|
||||
rdpSettings* settings = sdl->context()->settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
if (!freerdp_settings_get_bool(settings, FreeRDP_Fullscreen) &&
|
||||
!freerdp_settings_get_bool(settings, FreeRDP_UseMultimon))
|
||||
return TRUE;
|
||||
|
||||
const UINT32 numIds = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);
|
||||
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorDefArray, nullptr, numIds))
|
||||
return FALSE;
|
||||
|
@ -189,6 +189,9 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
|
||||
|
||||
rdpSettings* settings = sdl->context()->settings;
|
||||
WINPR_ASSERT(settings);
|
||||
if (!freerdp_settings_get_bool(settings, FreeRDP_Fullscreen) &&
|
||||
!freerdp_settings_get_bool(settings, FreeRDP_UseMultimon))
|
||||
return TRUE;
|
||||
|
||||
const UINT32 numIds = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);
|
||||
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorDefArray, nullptr, numIds))
|
||||
|
@ -727,7 +727,8 @@ static int freerdp_client_command_line_pre_filter(void* context, int index, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, const char** params)
|
||||
BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count,
|
||||
const char* const* params)
|
||||
{
|
||||
WINPR_ASSERT(settings);
|
||||
WINPR_ASSERT(params);
|
||||
@ -858,7 +859,8 @@ BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name)
|
||||
return freerdp_static_channel_collection_del(settings, name);
|
||||
}
|
||||
|
||||
BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count, const char** params)
|
||||
BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count,
|
||||
const char* const* params)
|
||||
{
|
||||
ADDIN_ARGV* _args = NULL;
|
||||
|
||||
@ -887,7 +889,8 @@ BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name)
|
||||
return freerdp_dynamic_channel_collection_del(settings, name);
|
||||
}
|
||||
|
||||
BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count, const char** params)
|
||||
BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count,
|
||||
const char* const* params)
|
||||
{
|
||||
ADDIN_ARGV* _args = NULL;
|
||||
|
||||
@ -1057,7 +1060,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
||||
if (!freerdp_client_add_static_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_static_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1067,7 +1070,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1077,7 +1080,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
||||
if (!freerdp_client_add_device_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1088,7 +1091,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
||||
if (!freerdp_client_add_device_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1100,7 +1103,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
||||
if (!freerdp_client_add_device_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1111,7 +1114,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
||||
if (!freerdp_client_add_device_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1121,7 +1124,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
||||
if (!freerdp_client_add_device_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1132,7 +1135,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
size_t count = 0;
|
||||
char** ptr =
|
||||
CommandLineParseCommaSeparatedValuesEx(URBDRC_CHANNEL_NAME, arg->Value, &count);
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
@ -1181,9 +1184,9 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
size_t count = 0;
|
||||
char** ptr =
|
||||
CommandLineParseCommaSeparatedValuesEx(RDPSND_CHANNEL_NAME, arg->Value, &count);
|
||||
if (!freerdp_client_add_static_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_static_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
|
||||
CommandLineParserFree(ptr);
|
||||
@ -1194,7 +1197,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx(AUDIN_CHANNEL_NAME, arg->Value, &count);
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
|
||||
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
|
||||
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
CommandLineParserFree(ptr);
|
||||
if (status)
|
||||
|
@ -104,12 +104,12 @@ extern "C"
|
||||
FREERDP_API BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type);
|
||||
|
||||
FREERDP_API BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count,
|
||||
const char** params);
|
||||
const char* const* params);
|
||||
FREERDP_API BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count,
|
||||
const char** params);
|
||||
const char* const* params);
|
||||
FREERDP_API BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name);
|
||||
FREERDP_API BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count,
|
||||
const char** params);
|
||||
const char* const* params);
|
||||
FREERDP_API BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -153,7 +153,7 @@ extern "C"
|
||||
FREERDP_API void freerdp_addin_argv_free(ADDIN_ARGV* args);
|
||||
|
||||
WINPR_ATTR_MALLOC(freerdp_addin_argv_free, 1)
|
||||
FREERDP_API ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* argv[]);
|
||||
FREERDP_API ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* const argv[]);
|
||||
|
||||
WINPR_ATTR_MALLOC(freerdp_addin_argv_free, 1)
|
||||
FREERDP_API ADDIN_ARGV* freerdp_addin_argv_clone(const ADDIN_ARGV* args);
|
||||
@ -193,7 +193,8 @@ extern "C"
|
||||
FREERDP_API void freerdp_device_free(RDPDR_DEVICE* device);
|
||||
|
||||
WINPR_ATTR_MALLOC(freerdp_device_free, 1)
|
||||
FREERDP_API RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[]);
|
||||
FREERDP_API RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count,
|
||||
const char* const args[]);
|
||||
|
||||
WINPR_ATTR_MALLOC(freerdp_device_free, 1)
|
||||
FREERDP_API RDPDR_DEVICE* freerdp_device_clone(const RDPDR_DEVICE* device);
|
||||
|
@ -300,7 +300,7 @@ RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, UINT32
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[])
|
||||
RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* const args[])
|
||||
{
|
||||
size_t size = 0;
|
||||
union
|
||||
@ -779,7 +779,7 @@ void freerdp_addin_argv_free(ADDIN_ARGV* args)
|
||||
free(args);
|
||||
}
|
||||
|
||||
ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* argv[])
|
||||
ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* const argv[])
|
||||
{
|
||||
if (argc > INT32_MAX)
|
||||
return NULL;
|
||||
|
@ -119,6 +119,9 @@ static int freerdp_connect_begin(freerdp* instance)
|
||||
instance->ConnectionCallbackState = CLIENT_STATE_PRECONNECT_PASSED;
|
||||
|
||||
freerdp_settings_print_warnings(settings);
|
||||
if (status)
|
||||
status = freerdp_settings_enforce_monitor_exists(settings);
|
||||
|
||||
if (status)
|
||||
status = freerdp_settings_check_client_after_preconnect(settings);
|
||||
|
||||
|
@ -750,6 +750,20 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
if (!settings)
|
||||
return NULL;
|
||||
|
||||
if (!server && !remote)
|
||||
{
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopPhysicalWidth, 1000))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopPhysicalHeight, 1000))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint16(settings, FreeRDP_DesktopOrientation,
|
||||
ORIENTATION_LANDSCAPE))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DeviceScaleFactor, 100))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopScaleFactor, 100))
|
||||
goto out_fail;
|
||||
}
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_SurfaceCommandsSupported,
|
||||
SURFCMDS_SET_SURFACE_BITS | SURFCMDS_STREAM_SURFACE_BITS |
|
||||
SURFCMDS_FRAME_MARKER))
|
||||
@ -1661,3 +1675,67 @@ BOOL freerdp_target_net_adresses_reset(rdpSettings* settings, size_t size)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL freerdp_settings_enforce_monitor_exists(rdpSettings* settings)
|
||||
{
|
||||
const UINT32 nrIds = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);
|
||||
const UINT32 count = freerdp_settings_get_uint32(settings, FreeRDP_MonitorCount);
|
||||
const BOOL fullscreen = freerdp_settings_get_bool(settings, FreeRDP_Fullscreen);
|
||||
const BOOL multimon = freerdp_settings_get_bool(settings, FreeRDP_UseMultimon);
|
||||
const BOOL useMonitors = fullscreen || multimon;
|
||||
|
||||
if (nrIds == 0)
|
||||
{
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_NumMonitorIds, 1))
|
||||
return FALSE;
|
||||
}
|
||||
if (!useMonitors || (count == 0))
|
||||
{
|
||||
const UINT32 width = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
|
||||
const UINT32 height = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
|
||||
const UINT32 pwidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopPhysicalWidth);
|
||||
const UINT32 pheight = freerdp_settings_get_uint32(settings, FreeRDP_DesktopPhysicalHeight);
|
||||
const UINT16 orientation =
|
||||
freerdp_settings_get_uint16(settings, FreeRDP_DesktopOrientation);
|
||||
const UINT32 desktopScaleFactor =
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DeviceScaleFactor);
|
||||
const UINT32 deviceScaleFactor =
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DesktopScaleFactor);
|
||||
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_MonitorCount, 1))
|
||||
return FALSE;
|
||||
|
||||
rdpMonitor* monitor =
|
||||
freerdp_settings_get_pointer_array_writable(settings, FreeRDP_MonitorDefArray, 0);
|
||||
if (!monitor)
|
||||
return FALSE;
|
||||
monitor->x = 0;
|
||||
monitor->y = 0;
|
||||
WINPR_ASSERT(width <= INT32_MAX);
|
||||
monitor->width = (INT32)width;
|
||||
WINPR_ASSERT(height <= INT32_MAX);
|
||||
monitor->height = (INT32)height;
|
||||
monitor->is_primary = TRUE;
|
||||
monitor->orig_screen = 0;
|
||||
monitor->attributes.physicalWidth = pwidth;
|
||||
monitor->attributes.physicalHeight = pheight;
|
||||
monitor->attributes.orientation = orientation;
|
||||
monitor->attributes.desktopScaleFactor = desktopScaleFactor;
|
||||
monitor->attributes.deviceScaleFactor = deviceScaleFactor;
|
||||
}
|
||||
else if (fullscreen || (multimon && (count == 1)))
|
||||
{
|
||||
|
||||
/* not all platforms start primary monitor at 0/0, so enforce this to avoid issues with
|
||||
* fullscreen mode */
|
||||
rdpMonitor* monitor =
|
||||
freerdp_settings_get_pointer_array_writable(settings, FreeRDP_MonitorDefArray, 0);
|
||||
if (!monitor)
|
||||
return FALSE;
|
||||
monitor->x = 0;
|
||||
monitor->y = 0;
|
||||
monitor->is_primary = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
FREERDP_LOCAL BOOL freerdp_settings_enforce_monitor_exists(rdpSettings* settings);
|
||||
FREERDP_LOCAL void freerdp_settings_print_warnings(const rdpSettings* settings);
|
||||
FREERDP_LOCAL BOOL freerdp_settings_check_client_after_preconnect(const rdpSettings* settings);
|
||||
FREERDP_LOCAL BOOL freerdp_settings_set_default_order_support(rdpSettings* settings);
|
||||
|
Loading…
Reference in New Issue
Block a user