[client,common] fix relative mouse event detect

Only send relative mouse events, if the client explicitely enabled them,
the calling function is reporting the events as relative and the server
announced support for it.
This commit is contained in:
Armin Novak 2023-12-19 15:01:34 +01:00 committed by David Fort
parent 198774c035
commit 8613613913
2 changed files with 5 additions and 9 deletions

View File

@ -439,8 +439,7 @@ BOOL xf_generic_RawMotionNotify(xfContext* xfc, int x, int y, Window window, BOO
return FALSE;
}
freerdp_client_send_button_event(&xfc->common, TRUE, PTR_FLAGS_MOVE, x, y);
return TRUE;
return freerdp_client_send_button_event(&xfc->common, TRUE, PTR_FLAGS_MOVE, x, y);
}
static BOOL xf_event_MotionNotify(xfContext* xfc, const XMotionEvent* event, BOOL app)

View File

@ -1502,8 +1502,6 @@ BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags)
WINPR_ASSERT(cctx);
if (!freerdp_settings_get_bool(cctx->context.settings, FreeRDP_HasRelativeMouseEvent))
{
#if defined(CHANNEL_AINPUT_CLIENT)
if (cctx->ainput)
{
@ -1537,7 +1535,7 @@ BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags)
handled = TRUE;
}
#endif
}
if (!handled)
freerdp_input_send_mouse_event(cctx->context.input, mflags, 0, 0);
@ -1566,7 +1564,8 @@ BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative, UIN
WINPR_ASSERT(cctx);
if (freerdp_settings_get_bool(cctx->context.settings, FreeRDP_HasRelativeMouseEvent))
const BOOL relativeInput = freerdp_client_use_relative_mouse_events(cctx);
if (relative && relativeInput)
{
return freerdp_input_send_rel_mouse_event(cctx->context.input, mflags, x, y);
}
@ -1575,8 +1574,6 @@ BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative, UIN
if (cctx->ainput)
{
UINT64 flags = 0;
BOOL relativeInput =
freerdp_settings_get_bool(cctx->context.settings, FreeRDP_MouseUseRelativeMove);
if (cctx->mouse_grabbed && relativeInput)
flags |= AINPUT_FLAGS_HAVE_REL;
@ -1623,7 +1620,7 @@ BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx, BOOL rela
BOOL handled = FALSE;
WINPR_ASSERT(cctx);
if (freerdp_settings_get_bool(cctx->context.settings, FreeRDP_HasRelativeMouseEvent))
if (relative && freerdp_client_use_relative_mouse_events(cctx))
{
return freerdp_input_send_rel_mouse_event(cctx->context.input, mflags, x, y);
}