mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-17 05:39:53 +00:00
Add absolute mouse motion support
This commit is contained in:
@@ -440,7 +440,7 @@ int LiSendMouseMoveEvent(short deltaX, short deltaY) {
|
||||
|
||||
holder->packetLength = sizeof(NV_MOUSE_MOVE_PACKET);
|
||||
holder->packet.mouseMove.header.packetType = htonl(PACKET_TYPE_MOUSE_MOVE);
|
||||
holder->packet.mouseMove.magic = MOUSE_MOVE_MAGIC;
|
||||
holder->packet.mouseMove.magic = MOUSE_MOVE_REL_MAGIC;
|
||||
// On Gen 5 servers, the header code is incremented by one
|
||||
if (AppVersionQuad[0] >= 5) {
|
||||
holder->packet.mouseMove.magic++;
|
||||
@@ -456,6 +456,39 @@ int LiSendMouseMoveEvent(short deltaX, short deltaY) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// Send a mouse position update to the streaming machine
|
||||
int LiSendMousePositionEvent(short x, short y) {
|
||||
PPACKET_HOLDER holder;
|
||||
int err;
|
||||
|
||||
if (!initialized) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
// TODO: Figure out the exact version where this was added
|
||||
if (AppVersionQuad[0] < 7) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
holder = malloc(sizeof(*holder));
|
||||
if (holder == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
holder->packetLength = sizeof(NV_MOUSE_MOVE_PACKET);
|
||||
holder->packet.mouseMove.header.packetType = htonl(PACKET_TYPE_MOUSE_MOVE);
|
||||
holder->packet.mouseMove.magic = MOUSE_MOVE_ABS_MAGIC;
|
||||
holder->packet.mouseMove.deltaX = htons(x);
|
||||
holder->packet.mouseMove.deltaY = htons(y);
|
||||
|
||||
err = LbqOfferQueueItem(&packetQueue, holder, &holder->entry);
|
||||
if (err != LBQ_SUCCESS) {
|
||||
free(holder);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
// Send a mouse button event to the streaming machine
|
||||
int LiSendMouseButtonEvent(char action, int button) {
|
||||
PPACKET_HOLDER holder;
|
||||
|
||||
Reference in New Issue
Block a user