summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-07-25 18:16:08 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-08-07 22:15:39 +0200
commitf364a1e3dfb78239985b3068e079544bbff6d66f (patch)
tree8dbddacf0451326e425e3fe7060603612b81b521 /video
parent023e5ccd02609c8a2fdcf63ee0a87025beeb79f0 (diff)
downloadmpv-f364a1e3dfb78239985b3068e079544bbff6d66f.tar.bz2
mpv-f364a1e3dfb78239985b3068e079544bbff6d66f.tar.xz
wayland: add support for precise scrolling
The default value for a standard mouse is 10.0. Because we don't want to multiply the value in the input config file we scale it down to 1.0. Hopefully this should work for more precise mousewheels or touchpad, but I don't have access to such hardware.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index fd74601df4..535c662730 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -369,11 +369,23 @@ static void pointer_handle_axis(void *data,
{
struct vo_wayland_state *wl = data;
+ // value is 10.00 on a normal mouse wheel
+ // scale it down to 1.00 for multipliying it with the commands
if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
if (value > 0)
- mp_input_put_key(wl->vo->input_ctx, MP_MOUSE_BTN4);
+ mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_DOWN,
+ wl_fixed_to_double(value)*0.1);
if (value < 0)
- mp_input_put_key(wl->vo->input_ctx, MP_MOUSE_BTN3);
+ mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_UP,
+ wl_fixed_to_double(value)*-0.1);
+ }
+ else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
+ if (value > 0)
+ mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_RIGHT,
+ wl_fixed_to_double(value)*0.1);
+ if (value < 0)
+ mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_LEFT,
+ wl_fixed_to_double(value)*-0.1);
}
}