Plumb HDR metadata and horizontal scrolling with Sunshine

This commit is contained in:
Cameron Gutman
2023-01-16 21:51:18 -06:00
parent 17cad6b3ca
commit 8a0142bd0f
6 changed files with 88 additions and 66 deletions

View File

@@ -227,6 +227,21 @@ void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event)
LiSendHighResScrollEvent((short)(event->preciseY * 120)); // WHEEL_DELTA
}
if (event->preciseX != 0.0f) {
// Invert the scroll direction if needed
if (m_ReverseScrollDirection) {
event->preciseX = -event->preciseY;
}
#ifdef Q_OS_DARWIN
// HACK: Clamp the scroll values on macOS to prevent OS scroll acceleration
// from generating wild scroll deltas when scrolling quickly.
event->preciseX = SDL_clamp(event->preciseX, -1.0f, 1.0f);
#endif
LiSendHighResHScrollEvent((short)(event->preciseX * 120)); // WHEEL_DELTA
}
#else
if (event->y != 0) {
// Invert the scroll direction if needed
@@ -241,6 +256,20 @@ void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event)
LiSendScrollEvent((signed char)event->y);
}
if (event->x != 0) {
// Invert the scroll direction if needed
if (m_ReverseScrollDirection) {
event->x = -event->x;
}
#ifdef Q_OS_DARWIN
// See comment above
event->x = SDL_clamp(event->x, -1, 1);
#endif
LiSendHScrollEvent((signed char)event->x);
}
#endif
}