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:
Dudemanguy 2021-11-20 09:13:06 -06:00
parent 59898331dd
commit 21cdc713bc
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}
}