mirror of https://github.com/mpv-player/mpv
wayland: simplify mouse wheel direction calculation
Based on an idea by sfan5. Remove abs usage, and instead just check for negative value, and set variable to either +/-1.
This commit is contained in:
parent
3aad89829f
commit
33519d61aa
|
@ -251,9 +251,8 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
|
|||
uint32_t time, uint32_t axis, wl_fixed_t value)
|
||||
{
|
||||
struct vo_wayland_state *wl = data;
|
||||
if (wl_fixed_to_double(value) == 0)
|
||||
return;
|
||||
double val = wl_fixed_to_double(value)/abs(wl_fixed_to_double(value));
|
||||
|
||||
double val = wl_fixed_to_double(value) < 0 ? -1 : 1;
|
||||
switch (axis) {
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
if (value > 0)
|
||||
|
|
Loading…
Reference in New Issue