Add relative mouse input and no channel support
This commit is contained in:
parent
8a5bd522c7
commit
de81f54076
@ -1058,6 +1058,7 @@ BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags)
|
|||||||
#endif
|
#endif
|
||||||
if (!handled)
|
if (!handled)
|
||||||
freerdp_input_send_mouse_event(cctx->context.input, mflags, 0, 0);
|
freerdp_input_send_mouse_event(cctx->context.input, mflags, 0, 0);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,13 +1107,20 @@ BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative, UIN
|
|||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
const rdpSettings* settings = cctx->context.settings;
|
if (relative)
|
||||||
static INT64 lastX = 0;
|
{
|
||||||
static INT64 lastY = 0;
|
cctx->lastX += x;
|
||||||
|
cctx->lastY += y;
|
||||||
lastX = MIN(MAX(lastX + x, 0), settings->DesktopWidth);
|
WLog_WARN(TAG, "Relative mouse input but channel % not available, sending absolute!",
|
||||||
lastY = MIN(MAX(lastY + y, 0), settings->DesktopHeight);
|
AINPUT_DVC_CHANNEL_NAME);
|
||||||
freerdp_input_send_mouse_event(cctx->context.input, mflags, (UINT16)lastX, (UINT16)lastY);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cctx->lastX = x;
|
||||||
|
cctx->lastY = y;
|
||||||
|
}
|
||||||
|
freerdp_input_send_mouse_event(cctx->context.input, mflags, (UINT16)cctx->lastX,
|
||||||
|
(UINT16)cctx->lastY);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1120,6 +1128,7 @@ BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative, UIN
|
|||||||
BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx, BOOL relative, UINT16 mflags,
|
BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx, BOOL relative, UINT16 mflags,
|
||||||
INT32 x, INT32 y)
|
INT32 x, INT32 y)
|
||||||
{
|
{
|
||||||
|
BOOL handled = FALSE;
|
||||||
WINPR_ASSERT(cctx);
|
WINPR_ASSERT(cctx);
|
||||||
|
|
||||||
#if defined(CHANNEL_AINPUT_CLIENT)
|
#if defined(CHANNEL_AINPUT_CLIENT)
|
||||||
@ -1137,10 +1146,27 @@ BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx, BOOL rela
|
|||||||
flags |= AINPUT_XFLAGS_BUTTON2;
|
flags |= AINPUT_XFLAGS_BUTTON2;
|
||||||
|
|
||||||
ainput_send_diff_event(cctx, flags, x, y);
|
ainput_send_diff_event(cctx, flags, x, y);
|
||||||
|
handled = TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!handled)
|
||||||
|
{
|
||||||
|
if (relative)
|
||||||
|
{
|
||||||
|
cctx->lastX += x;
|
||||||
|
cctx->lastY += y;
|
||||||
|
WLog_WARN(TAG, "Relative mouse input but channel % not available, sending absolute!",
|
||||||
|
AINPUT_DVC_CHANNEL_NAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
{
|
||||||
freerdp_input_send_extended_mouse_event(cctx->context.input, mflags, x, y);
|
cctx->lastX = x;
|
||||||
|
cctx->lastY = y;
|
||||||
|
}
|
||||||
|
freerdp_input_send_extended_mouse_event(cctx->context.input, mflags, (UINT16)cctx->lastX,
|
||||||
|
(UINT16)cctx->lastY);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,9 @@ extern "C"
|
|||||||
UINT64 reserved2;
|
UINT64 reserved2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT64 reserved[128 - 3]; /**< (offset 3) */
|
ALIGN64 INT32 lastX; /**< (offset 3) */
|
||||||
|
ALIGN64 INT32 lastY; /**< (offset 4) */
|
||||||
|
UINT64 reserved[128 - 5]; /**< (offset 5) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Common client functions */
|
/* Common client functions */
|
||||||
|
Loading…
Reference in New Issue
Block a user