[pointer] unify mouse pointer settings
This commit is contained in:
parent
132ce797db
commit
32b60ae438
@ -149,19 +149,15 @@ static BOOL wlf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
|
||||
|
||||
BOOL wlf_register_pointer(rdpGraphics* graphics)
|
||||
{
|
||||
rdpPointer* pointer = NULL;
|
||||
rdpPointer pointer = { 0 };
|
||||
|
||||
if (!(pointer = (rdpPointer*)calloc(1, sizeof(rdpPointer))))
|
||||
return FALSE;
|
||||
|
||||
pointer->size = sizeof(wlfPointer);
|
||||
pointer->New = wlf_Pointer_New;
|
||||
pointer->Free = wlf_Pointer_Free;
|
||||
pointer->Set = wlf_Pointer_Set;
|
||||
pointer->SetNull = wlf_Pointer_SetNull;
|
||||
pointer->SetDefault = wlf_Pointer_SetDefault;
|
||||
pointer->SetPosition = wlf_Pointer_SetPosition;
|
||||
graphics_register_pointer(graphics, pointer);
|
||||
free(pointer);
|
||||
pointer.size = sizeof(wlfPointer);
|
||||
pointer.New = wlf_Pointer_New;
|
||||
pointer.Free = wlf_Pointer_Free;
|
||||
pointer.Set = wlf_Pointer_Set;
|
||||
pointer.SetNull = wlf_Pointer_SetNull;
|
||||
pointer.SetDefault = wlf_Pointer_SetDefault;
|
||||
pointer.SetPosition = wlf_Pointer_SetPosition;
|
||||
graphics_register_pointer(graphics, &pointer);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -723,20 +723,16 @@ static BOOL xf_Glyph_EndDraw(rdpContext* context, INT32 x, INT32 y, INT32 width,
|
||||
/* Graphics Module */
|
||||
BOOL xf_register_pointer(rdpGraphics* graphics)
|
||||
{
|
||||
rdpPointer* pointer = NULL;
|
||||
rdpPointer pointer = { 0 };
|
||||
|
||||
if (!(pointer = (rdpPointer*)calloc(1, sizeof(rdpPointer))))
|
||||
return FALSE;
|
||||
|
||||
pointer->size = sizeof(xfPointer);
|
||||
pointer->New = xf_Pointer_New;
|
||||
pointer->Free = xf_Pointer_Free;
|
||||
pointer->Set = xf_Pointer_Set;
|
||||
pointer->SetNull = xf_Pointer_SetNull;
|
||||
pointer->SetDefault = xf_Pointer_SetDefault;
|
||||
pointer->SetPosition = xf_Pointer_SetPosition;
|
||||
graphics_register_pointer(graphics, pointer);
|
||||
free(pointer);
|
||||
pointer.size = sizeof(xfPointer);
|
||||
pointer.New = xf_Pointer_New;
|
||||
pointer.Free = xf_Pointer_Free;
|
||||
pointer.Set = xf_Pointer_Set;
|
||||
pointer.SetNull = xf_Pointer_SetNull;
|
||||
pointer.SetDefault = xf_Pointer_SetDefault;
|
||||
pointer.SetPosition = xf_Pointer_SetPosition;
|
||||
graphics_register_pointer(graphics, &pointer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -4012,6 +4012,42 @@ static int freerdp_client_settings_parse_command_line_arguments_int(rdpSettings*
|
||||
{
|
||||
settings->MouseUseRelativeMove = enable;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "mouse")
|
||||
{
|
||||
size_t count = 0;
|
||||
char** ptr = CommandLineParseCommaSeparatedValuesEx("mouse", arg->Value, &count);
|
||||
UINT rc = 0;
|
||||
if (ptr)
|
||||
{
|
||||
for (size_t x = 1; x < count; x++)
|
||||
{
|
||||
const char* cur = ptr[x];
|
||||
|
||||
const PARSE_ON_OFF_RESULT bval = parse_on_off_option(cur);
|
||||
if (bval == PARSE_FAIL)
|
||||
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
else
|
||||
{
|
||||
const BOOL val = bval != PARSE_OFF;
|
||||
size_t key = 0;
|
||||
if (option_starts_with("relative", cur))
|
||||
key = FreeRDP_MouseUseRelativeMove;
|
||||
else if (option_starts_with("grab", cur))
|
||||
key = FreeRDP_GrabMouse;
|
||||
|
||||
if (!freerdp_settings_set_bool(settings, key, val))
|
||||
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
|
||||
if (rc != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(ptr);
|
||||
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "unmap-buttons")
|
||||
{
|
||||
settings->UnmapButtons = enable;
|
||||
|
@ -311,6 +311,11 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
|
||||
"Send mouse motion" },
|
||||
{ "mouse-relative", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
|
||||
"Send mouse motion with relative addressing" },
|
||||
{ "mouse", COMMAND_LINE_VALUE_REQUIRED, "[relative:[on|off],grab:[on|off]]", NULL, NULL, -1,
|
||||
NULL,
|
||||
"Mouse related options:"
|
||||
"* relative: send relative mouse movements if supported by server"
|
||||
"* grab: grab the mouse if within the window" },
|
||||
#if defined(CHANNEL_TSMF_CLIENT)
|
||||
{ "multimedia", COMMAND_LINE_VALUE_OPTIONAL, "[sys:<sys>,][dev:<dev>,][decoder:<decoder>]",
|
||||
NULL, NULL, -1, "mmr", "[DEPRECATED], use /video] Redirect multimedia (video)" },
|
||||
|
@ -184,7 +184,7 @@ static BOOL ios_Pointer_SetDefault(rdpContext *context)
|
||||
|
||||
static BOOL ios_register_pointer(rdpGraphics *graphics)
|
||||
{
|
||||
rdpPointer pointer;
|
||||
rdpPointer pointer = { 0 };
|
||||
|
||||
if (!graphics)
|
||||
return FALSE;
|
||||
|
9
libfreerdp/cache/pointer.c
vendored
9
libfreerdp/cache/pointer.c
vendored
@ -63,18 +63,17 @@ static void pointer_free(rdpContext* context, rdpPointer* pointer)
|
||||
static BOOL update_pointer_position(rdpContext* context,
|
||||
const POINTER_POSITION_UPDATE* pointer_position)
|
||||
{
|
||||
rdpPointer* pointer;
|
||||
BOOL GrabMouse;
|
||||
|
||||
if (!context || !context->graphics || !context->graphics->Pointer_Prototype ||
|
||||
!pointer_position)
|
||||
return FALSE;
|
||||
|
||||
GrabMouse = freerdp_settings_get_bool(context->settings, FreeRDP_GrabMouse);
|
||||
const BOOL GrabMouse = freerdp_settings_get_bool(context->settings, FreeRDP_GrabMouse);
|
||||
if (!GrabMouse)
|
||||
return TRUE;
|
||||
|
||||
pointer = context->graphics->Pointer_Prototype;
|
||||
const rdpPointer* pointer = context->graphics->Pointer_Prototype;
|
||||
WINPR_ASSERT(pointer);
|
||||
|
||||
return IFCALLRESULT(TRUE, pointer->SetPosition, context, pointer_position->xPos,
|
||||
pointer_position->yPos);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user