client: wayland: Fix mouse event fallback pointer flags

In either case of wlf_handle_touch_up()/wlf_handle_touch_down(), the
UINT16 flags are set to fixed values, so there is little reason for
checking presence of specific flag in them again. The conditional is
always true no less, so just call freerdp_input_send_mouse_event().

Moreover, the flags submitted to the remote are wrong. The code should
send BUTTON1/DOWN/MOVE on wlf_handle_touch_down(), so the remote would
pick not only the button down event, but also the coordinate update,
else the remote would receive a mouse click at the wrong coordinates.
The wlf_handle_touch_motion() should update the pointer location too,
make it send plain MOVE event.

Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Marek Vasut 2021-11-17 14:54:20 +01:00 committed by akallabeth
parent 487894b5bb
commit 1a1056d76d

View File

@ -422,10 +422,7 @@ BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
WINPR_ASSERT(x <= UINT16_MAX);
WINPR_ASSERT(y <= UINT16_MAX);
if ((flags & ~PTR_FLAGS_DOWN) != 0)
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
return TRUE;
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
}
if (!rdpei)
@ -481,14 +478,12 @@ BOOL wlf_handle_touch_down(freerdp* instance, const UwacTouchDown* ev)
UINT16 flags = 0;
flags |= PTR_FLAGS_DOWN;
flags |= PTR_FLAGS_MOVE;
flags |= PTR_FLAGS_BUTTON1;
WINPR_ASSERT(x <= UINT16_MAX);
WINPR_ASSERT(y <= UINT16_MAX);
if ((flags & ~PTR_FLAGS_DOWN) != 0)
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
return FALSE;
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
}
WINPR_ASSERT(rdpei);
@ -541,7 +536,12 @@ BOOL wlf_handle_touch_motion(freerdp* instance, const UwacTouchMotion* ev)
if (wlf->contacts[i].emulate_mouse == TRUE)
{
return TRUE;
UINT16 flags = 0;
flags |= PTR_FLAGS_MOVE;
WINPR_ASSERT(x <= UINT16_MAX);
WINPR_ASSERT(y <= UINT16_MAX);
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
}
if (!rdpei)