Add absolute mouse motion support
This commit is contained in:
parent
f0c3b57d11
commit
ef7de27727
3 changed files with 40 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue