mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-02-16 02:21:07 +00:00
Send pointer IDs instead of touch indices
This commit is contained in:
@@ -126,8 +126,8 @@ typedef struct _SS_HSCROLL_PACKET {
|
||||
typedef struct _SS_TOUCH_PACKET {
|
||||
NV_INPUT_HEADER header;
|
||||
uint8_t eventType;
|
||||
uint8_t touchIndex;
|
||||
uint8_t zero[2]; // Alignment/reserved
|
||||
uint8_t zero[3]; // Alignment/reserved
|
||||
uint32_t pointerId;
|
||||
netfloat x;
|
||||
netfloat y;
|
||||
netfloat pressure;
|
||||
@@ -162,8 +162,8 @@ typedef struct _SS_CONTROLLER_TOUCH_PACKET {
|
||||
NV_INPUT_HEADER header;
|
||||
uint8_t controllerNumber;
|
||||
uint8_t eventType;
|
||||
uint8_t touchIndex;
|
||||
uint8_t zero[1]; // Alignment/reserved
|
||||
uint8_t zero[2]; // Alignment/reserved
|
||||
uint32_t pointerId;
|
||||
netfloat x;
|
||||
netfloat y;
|
||||
netfloat pressure;
|
||||
|
||||
@@ -1056,7 +1056,7 @@ int LiSendHScrollEvent(signed char scrollClicks) {
|
||||
return LiSendHighResHScrollEvent(scrollClicks * LI_WHEEL_DELTA);
|
||||
}
|
||||
|
||||
int LiSendTouchEvent(uint8_t eventType, uint8_t touchIndex, float x, float y, float pressure) {
|
||||
int LiSendTouchEvent(uint8_t eventType, uint32_t pointerId, float x, float y, float pressure) {
|
||||
PPACKET_HOLDER holder;
|
||||
int err;
|
||||
|
||||
@@ -1077,7 +1077,7 @@ int LiSendTouchEvent(uint8_t eventType, uint8_t touchIndex, float x, float y, fl
|
||||
holder->packet.touch.header.size = BE32(sizeof(SS_TOUCH_PACKET) - sizeof(uint32_t));
|
||||
holder->packet.touch.header.magic = LE32(SS_TOUCH_MAGIC);
|
||||
holder->packet.touch.eventType = eventType;
|
||||
holder->packet.touch.touchIndex = touchIndex;
|
||||
holder->packet.touch.pointerId = LE32(pointerId);
|
||||
memset(holder->packet.touch.zero, 0, sizeof(holder->packet.touch.zero));
|
||||
floatToNetfloat(x, holder->packet.touch.x);
|
||||
floatToNetfloat(y, holder->packet.touch.y);
|
||||
@@ -1172,7 +1172,7 @@ int LiSendControllerArrivalEvent(uint8_t controllerNumber, uint16_t activeGamepa
|
||||
return LiSendMultiControllerEvent(controllerNumber, activeGamepadMask, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint8_t touchIndex, float x, float y, float pressure) {
|
||||
int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint32_t pointerId, float x, float y, float pressure) {
|
||||
PPACKET_HOLDER holder;
|
||||
int err;
|
||||
|
||||
@@ -1194,8 +1194,8 @@ int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint
|
||||
holder->packet.controllerTouch.header.magic = LE32(SS_CONTROLLER_TOUCH_MAGIC);
|
||||
holder->packet.controllerTouch.controllerNumber = controllerNumber;
|
||||
holder->packet.controllerTouch.eventType = eventType;
|
||||
holder->packet.controllerTouch.touchIndex = touchIndex;
|
||||
memset(holder->packet.controllerTouch.zero, 0, sizeof(holder->packet.controllerTouch.zero));
|
||||
holder->packet.controllerTouch.pointerId = LE32(pointerId);
|
||||
floatToNetfloat(x, holder->packet.controllerTouch.x);
|
||||
floatToNetfloat(y, holder->packet.controllerTouch.y);
|
||||
floatToNetfloat(pressure, holder->packet.controllerTouch.pressure);
|
||||
|
||||
@@ -575,6 +575,9 @@ int LiSendMouseMoveAsMousePositionEvent(short deltaX, short deltaY, short refere
|
||||
//
|
||||
// Sending a down/move event with a pressure of 0.0 indicates the actual pressure is unknown.
|
||||
//
|
||||
// Pointer ID is an opaque ID that must uniquely identify each active touch on screen. It must
|
||||
// remain constant through any down/up/move/cancel events involved in a single touch interaction.
|
||||
//
|
||||
// If unsupported by the host, this will return LI_ERR_UNSUPPORTED and the caller should consider
|
||||
// falling back to other functions to send this input (such as LiSendMousePositionEvent()).
|
||||
#define LI_TOUCH_EVENT_HOVER 0x00
|
||||
@@ -582,7 +585,7 @@ int LiSendMouseMoveAsMousePositionEvent(short deltaX, short deltaY, short refere
|
||||
#define LI_TOUCH_EVENT_UP 0x02
|
||||
#define LI_TOUCH_EVENT_MOVE 0x03
|
||||
#define LI_TOUCH_EVENT_CANCEL 0x04
|
||||
int LiSendTouchEvent(uint8_t eventType, uint8_t touchIndex, float x, float y, float pressure);
|
||||
int LiSendTouchEvent(uint8_t eventType, uint32_t pointerId, float x, float y, float pressure);
|
||||
|
||||
// This function is similar to LiSendTouchEvent() but allows additional parameters relevant for pen
|
||||
// input, including rotation, tilt, and buttons. Rotation is in degrees from vertical in Y dimension
|
||||
@@ -686,7 +689,7 @@ int LiSendControllerArrivalEvent(uint8_t controllerNumber, uint16_t activeGamepa
|
||||
//
|
||||
// If unsupported by the host, this will return LI_ERR_UNSUPPORTED and the caller should consider
|
||||
// using this touch input to simulate trackpad input.
|
||||
int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint8_t touchIndex, float x, float y, float pressure);
|
||||
int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint32_t pointerId, float x, float y, float pressure);
|
||||
|
||||
// This function allows clients to send controller-associated motion events to a supported host.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user