summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorCameron Cawley <ccawley2011@gmail.com>2019-07-06 16:52:42 +0100
committerwm4 <1387750+wm4@users.noreply.github.com>2019-10-28 17:14:49 +0100
commitd51e6371508866137f4f12e7b4553fef8d39989f (patch)
treed06f9ada0ac730d9c1c945d6fe37c816cf7427e0 /video
parent6f9399327e476510f00538969db0afd61e3828cd (diff)
downloadmpv-d51e6371508866137f4f12e7b4553fef8d39989f.tar.bz2
mpv-d51e6371508866137f4f12e7b4553fef8d39989f.tar.xz
vo_sdl: Support mouse wheel input
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_sdl.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index 9d21a87118..a6354404d8 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -588,9 +588,19 @@ static void wait_events(struct vo *vo, int64_t until_time_us)
mp_input_put_key(vo->input_ctx,
(MP_MBTN_BASE + ev.button.button - 1) | MP_KEY_STATE_UP);
break;
- case SDL_MOUSEWHEEL:
+ case SDL_MOUSEWHEEL: {
+#if SDL_VERSION_ATLEAST(2, 0, 4)
+ double multiplier = ev.wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? -0.1 : 0.1;
+#else
+ double multiplier = 0.1;
+#endif
+ int y_code = ev.wheel.y > 0 ? MP_WHEEL_UP : MP_WHEEL_DOWN;
+ mp_input_put_wheel(vo->input_ctx, y_code, abs(ev.wheel.y) * multiplier);
+ int x_code = ev.wheel.x > 0 ? MP_WHEEL_RIGHT : MP_WHEEL_LEFT;
+ mp_input_put_wheel(vo->input_ctx, x_code, abs(ev.wheel.x) * multiplier);
break;
}
+ }
}
}