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

View File

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

View File

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

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