Add support for -grab-mouse, to prevent the client from moving the user's pointer

This commit is contained in:
bolt 2020-06-29 21:05:12 +02:00 committed by akallabeth
parent 5409f4f043
commit 03ced3d8f0
8 changed files with 21 additions and 1 deletions

View File

@ -2896,6 +2896,10 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
{
settings->GrabKeyboard = enable;
}
CommandLineSwitchCase(arg, "grab-mouse")
{
settings->GrabMouse = enable;
}
CommandLineSwitchCase(arg, "unmap-buttons")
{
settings->UnmapButtons = enable;

View File

@ -180,6 +180,7 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
{ "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
"Grab keyboard" },
{ "grab-mouse", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Grab mouse" },
{ "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http|auto]", NULL, NULL, -1, NULL,
"Gateway transport type" },
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[[<domain>\\]<user>|<user>[@<domain>]]", NULL, NULL, -1,

View File

@ -718,6 +718,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_PercentScreenUseWidth (1556)
#define FreeRDP_PercentScreenUseHeight (1557)
#define FreeRDP_DynamicResolutionUpdate (1558)
#define FreeRDP_GrabMouse (1559)
#define FreeRDP_SoftwareGdi (1601)
#define FreeRDP_LocalConnection (1602)
#define FreeRDP_AuthenticationOnly (1603)
@ -1195,7 +1196,8 @@ struct rdp_settings
ALIGN64 BOOL PercentScreenUseWidth; /* 1556 */
ALIGN64 BOOL PercentScreenUseHeight; /* 1557 */
ALIGN64 BOOL DynamicResolutionUpdate; /* 1558 */
UINT64 padding1601[1601 - 1559]; /* 1559 */
ALIGN64 BOOL GrabMouse; /* 1559 */
UINT64 padding1601[1601 - 1560]; /* 1560 */
/* Miscellaneous */
ALIGN64 BOOL SoftwareGdi; /* 1601 */

View File

@ -68,6 +68,9 @@ static BOOL update_pointer_position(rdpContext* context,
!pointer_position)
return FALSE;
if (!context->settings->GrabMouse)
return TRUE;
pointer = context->graphics->Pointer_Prototype;
return IFCALLRESULT(TRUE, pointer->SetPosition, context, pointer_position->xPos,
pointer_position->yPos);

View File

@ -228,6 +228,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
case FreeRDP_GrabKeyboard:
return settings->GrabKeyboard;
case FreeRDP_GrabMouse:
return settings->GrabMouse;
case FreeRDP_HasExtendedMouseEvent:
return settings->HasExtendedMouseEvent;
@ -802,6 +805,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
settings->GrabKeyboard = val;
break;
case FreeRDP_GrabMouse:
settings->GrabMouse = val;
break;
case FreeRDP_HasExtendedMouseEvent:
settings->HasExtendedMouseEvent = val;
break;

View File

@ -86,6 +86,7 @@ static const struct settings_str_entry settings_map[] = {
{ FreeRDP_GfxSmallCache, 0, "FreeRDP_GfxSmallCache" },
{ FreeRDP_GfxThinClient, 0, "FreeRDP_GfxThinClient" },
{ FreeRDP_GrabKeyboard, 0, "FreeRDP_GrabKeyboard" },
{ FreeRDP_GrabMouse, 0, "FreeRDP_GrabMouse" },
{ FreeRDP_HasExtendedMouseEvent, 0, "FreeRDP_HasExtendedMouseEvent" },
{ FreeRDP_HasHorizontalWheel, 0, "FreeRDP_HasHorizontalWheel" },
{ FreeRDP_HasMonitorAttributes, 0, "FreeRDP_HasMonitorAttributes" },

View File

@ -316,6 +316,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
settings->Workarea = FALSE;
settings->Fullscreen = FALSE;
settings->GrabKeyboard = TRUE;
settings->GrabMouse = TRUE;
settings->Decorations = TRUE;
settings->RdpVersion = RDP_VERSION_10_7;
settings->ColorDepth = 16;

View File

@ -75,6 +75,7 @@ static const size_t bool_list_indices[] = {
FreeRDP_GfxSmallCache,
FreeRDP_GfxThinClient,
FreeRDP_GrabKeyboard,
FreeRDP_GrabMouse,
FreeRDP_HasExtendedMouseEvent,
FreeRDP_HasHorizontalWheel,
FreeRDP_HasMonitorAttributes,