Add support for high-resolution scroll events

This commit is contained in:
Cameron Gutman 2019-02-26 18:48:13 -08:00
parent 708a513256
commit 8755529b1a
2 changed files with 16 additions and 3 deletions

View File

@ -599,8 +599,8 @@ int LiSendMultiControllerEvent(short controllerNumber, short activeGamepadMask,
leftStickX, leftStickY, rightStickX, rightStickY);
}
// Send a scroll event to the streaming machine
int LiSendScrollEvent(signed char scrollClicks) {
// Send a high resolution scroll event to the streaming machine
int LiSendHighResScrollEvent(short scrollAmount) {
PPACKET_HOLDER holder;
int err;
@ -622,7 +622,7 @@ int LiSendScrollEvent(signed char scrollClicks) {
}
holder->packet.scroll.zero1 = 0;
holder->packet.scroll.zero2 = 0;
holder->packet.scroll.scrollAmt1 = htons(scrollClicks * 120);
holder->packet.scroll.scrollAmt1 = htons(scrollAmount);
holder->packet.scroll.scrollAmt2 = holder->packet.scroll.scrollAmt1;
holder->packet.scroll.zero3 = 0;
@ -633,3 +633,8 @@ int LiSendScrollEvent(signed char scrollClicks) {
return err;
}
// Send a scroll event to the streaming machine
int LiSendScrollEvent(signed char scrollClicks) {
return LiSendHighResScrollEvent(scrollClicks * 120);
}

View File

@ -416,8 +416,16 @@ int LiSendMultiControllerEvent(short controllerNumber, short activeGamepadMask,
short leftStickX, short leftStickY, short rightStickX, short rightStickY);
// This function queues a vertical scroll event to the remote server.
// The number of "clicks" is multiplied by WHEEL_DELTA (120) before
// being sent to the PC.
int LiSendScrollEvent(signed char scrollClicks);
// This function queues a vertical scroll event to the remote server.
// Unlike LiSendScrollEvent(), this function can send wheel events
// smaller than 120 units for devices that support "high resolution"
// scrolling (Apple Trackpads, Microsoft Precision Touchpads, etc.).
int LiSendHighResScrollEvent(short scrollAmount);
// This function returns a time in milliseconds with an implementation-defined epoch.
// NOTE: This will be populated from gettimeofday() if !HAVE_CLOCK_GETTIME and
// populated from clock_gettime(CLOCK_MONOTONIC) if HAVE_CLOCK_GETTIME.