diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 04b93a8e..a399858a 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -474,10 +474,22 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; } CGPoint currentScrollTranslation = [gesture translationInView:self]; - short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA - if (translationDeltaY != 0) { - LiSendHighResScrollEvent(translationDeltaY * 20); - lastScrollTranslation = currentScrollTranslation; + + { + short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA + if (translationDeltaY != 0) { + LiSendHighResScrollEvent(translationDeltaY * 20); + lastScrollTranslation = currentScrollTranslation; + } + } + + { + short translationDeltaX = ((currentScrollTranslation.x - lastScrollTranslation.x) / self.bounds.size.width) * 120; // WHEEL_DELTA + if (translationDeltaX != 0) { + // Direction is reversed from vertical scrolling + LiSendHighResHScrollEvent(-translationDeltaX * 20); + lastScrollTranslation = currentScrollTranslation; + } } } @@ -497,9 +509,20 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; // Using velocityInView is 0 for discrete scroll events // when scrolling very slowly, but translationInView does work. CGPoint currentScrollTranslation = [gesture translationInView:self]; - short translationDeltaY = currentScrollTranslation.y - lastScrollTranslation.y; - if (translationDeltaY != 0) { - LiSendScrollEvent(translationDeltaY > 0 ? 1 : -1); + + { + short translationDeltaY = currentScrollTranslation.y - lastScrollTranslation.y; + if (translationDeltaY != 0) { + LiSendScrollEvent(translationDeltaY > 0 ? 1 : -1); + } + } + + { + short translationDeltaX = currentScrollTranslation.x - lastScrollTranslation.x; + if (translationDeltaX != 0) { + // Direction is reversed from vertical scrolling + LiSendHScrollEvent(translationDeltaX < 0 ? 1 : -1); + } } lastScrollTranslation = currentScrollTranslation;