Add horizontal scrolling support with Sunshine

This commit is contained in:
Cameron Gutman 2023-02-21 23:31:00 -06:00
parent 7988594e9e
commit 32ebb00292
4 changed files with 21 additions and 6 deletions

View File

@ -66,7 +66,7 @@ struct input_device {
int hats_state[3][2]; int hats_state[3][2];
int fd; int fd;
char modifiers; char modifiers;
__s32 mouseDeltaX, mouseDeltaY, mouseScroll; __s32 mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll;
__s32 touchDownX, touchDownY, touchX, touchY; __s32 touchDownX, touchDownY, touchX, touchY;
struct timeval touchDownTime; struct timeval touchDownTime;
struct timeval btnDownTime; struct timeval btnDownTime;
@ -273,9 +273,13 @@ static bool evdev_handle_event(struct input_event *ev, struct input_device *dev)
dev->mouseDeltaX = 0; dev->mouseDeltaX = 0;
dev->mouseDeltaY = 0; dev->mouseDeltaY = 0;
} }
if (dev->mouseScroll != 0) { if (dev->mouseVScroll != 0) {
LiSendScrollEvent(dev->mouseScroll); LiSendScrollEvent(dev->mouseVScroll);
dev->mouseScroll = 0; dev->mouseVScroll = 0;
}
if (dev->mouseHScroll != 0) {
LiSendHScrollEvent(dev->mouseHScroll);
dev->mouseHScroll = 0;
} }
if (dev->gamepadModified) { if (dev->gamepadModified) {
if (dev->controllerId < 0) { if (dev->controllerId < 0) {
@ -483,8 +487,11 @@ static bool evdev_handle_event(struct input_event *ev, struct input_device *dev)
case REL_Y: case REL_Y:
dev->mouseDeltaY = ev->value; dev->mouseDeltaY = ev->value;
break; break;
case REL_HWHEEL:
dev->mouseHScroll = ev->value;
break;
case REL_WHEEL: case REL_WHEEL:
dev->mouseScroll = ev->value; dev->mouseVScroll = ev->value;
break; break;
} }
break; break;

View File

@ -164,8 +164,10 @@ int sdlinput_handle_event(SDL_Window* window, SDL_Event* event) {
break; break;
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:
#if SDL_VERSION_ATLEAST(2, 0, 18) #if SDL_VERSION_ATLEAST(2, 0, 18)
LiSendHighResHScrollEvent((short)(event->wheel.preciseX * 120)); // WHEEL_DELTA
LiSendHighResScrollEvent((short)(event->wheel.preciseY * 120)); // WHEEL_DELTA LiSendHighResScrollEvent((short)(event->wheel.preciseY * 120)); // WHEEL_DELTA
#else #else
LiSendHScrollEvent(event->wheel.x);
LiSendScrollEvent(event->wheel.y); LiSendScrollEvent(event->wheel.y);
#endif #endif
break; break;

View File

@ -111,6 +111,12 @@ static int x11_handler(int fd) {
case Button5: case Button5:
LiSendScrollEvent(-1); LiSendScrollEvent(-1);
break; break;
case 6:
LiSendHScrollEvent(-1);
break;
case 7:
LiSendHScrollEvent(1);
break;
case 8: case 8:
button = BUTTON_X1; button = BUTTON_X1;
break; break;

@ -1 +1 @@
Subproject commit 50c0a51b10ecc5b3415ea78c21d96d679e2288f9 Subproject commit d3cb8131d12832898af31c4f2484ec1bd6bed0f4