mirror of https://github.com/mpv-player/mpv
wayland: support modifiers during axis events
It was never implemented before but it's trivial. As an aside, touch events currently don't support modifiers either (is this a thing?). Well if someone complains that can be done later. Fixes #9490.
This commit is contained in:
parent
59898331dd
commit
21cdc713bc
|
@ -253,19 +253,20 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
|
|||
{
|
||||
struct vo_wayland_state *wl = data;
|
||||
|
||||
int mpmod = get_mods(wl);
|
||||
double val = wl_fixed_to_double(value) < 0 ? -1 : 1;
|
||||
switch (axis) {
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
if (value > 0)
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_DOWN, +val);
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_DOWN | mpmod, +val);
|
||||
if (value < 0)
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_UP, -val);
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_UP | mpmod, -val);
|
||||
break;
|
||||
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
if (value > 0)
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_RIGHT, +val);
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_RIGHT | mpmod, +val);
|
||||
if (value < 0)
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_LEFT, -val);
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_LEFT | mpmod, -val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue