[client,sdl] send relative mouse button events

This commit is contained in:
akallabeth 2023-10-12 14:33:20 +02:00 committed by akallabeth
parent d7798e97d1
commit 927b553ad7

View File

@ -269,13 +269,15 @@ BOOL sdl_handle_mouse_button(SdlContext* sdl, const SDL_MouseButtonEvent* ev)
break;
}
INT32 x = ev->x;
INT32 y = ev->y;
const BOOL relative =
freerdp_settings_get_bool(sdl->context()->settings, FreeRDP_MouseUseRelativeMove);
INT32 x = relative ? 0 : ev->x;
INT32 y = relative ? 0 : ev->y;
sdl_scale_coordinates(sdl, ev->windowID, &x, &y, TRUE, TRUE);
if ((flags & (~PTR_FLAGS_DOWN)) != 0)
return freerdp_client_send_button_event(sdl->common(), FALSE, flags, x, y);
return freerdp_client_send_button_event(sdl->common(), relative, flags, x, y);
else if ((xflags & (~PTR_XFLAGS_DOWN)) != 0)
return freerdp_client_send_extended_button_event(sdl->common(), FALSE, xflags, x, y);
return freerdp_client_send_extended_button_event(sdl->common(), relative, xflags, x, y);
else
return FALSE;
}