Fixed scaling of discrete wheel input.

This commit is contained in:
akallabeth 2022-01-21 15:47:40 +01:00 committed by akallabeth
parent 66338e4c1f
commit 8a5bd522c7
1 changed files with 12 additions and 6 deletions

View File

@ -1029,19 +1029,25 @@ BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags)
UINT rc;
UINT64 flags = 0;
INT32 x = 0, y = 0;
INT32 value = mflags & 0xFF;
if (mflags & PTR_FLAGS_WHEEL_NEGATIVE)
value = -1 * (0x100 - value);
if (mflags & PTR_FLAGS_WHEEL)
{
flags |= AINPUT_FLAGS_WHEEL;
x = flags & 0xff;
if (mflags & PTR_FLAGS_WHEEL_NEGATIVE)
x = -x;
y = value;
}
/* We have discrete steps, scale this so we can also support high
* resolution wheels. */
value *= 0x10000;
if (mflags & PTR_FLAGS_HWHEEL)
{
flags |= AINPUT_FLAGS_WHEEL;
y = flags & 0xff;
if (mflags & PTR_FLAGS_WHEEL_NEGATIVE)
y = -y;
x = value;
}
WINPR_ASSERT(cctx->ainput->AInputSendInputEvent);