pointer: Fix mouse scroll

vencrypt
Andri Yngvason 2020-01-03 20:43:43 +00:00
parent 476854aeaf
commit 457e540d89
1 changed files with 15 additions and 7 deletions

View File

@ -53,16 +53,22 @@ static void pointer_set_button_mask(struct pointer* self, uint32_t t,
zwlr_virtual_pointer_v1_button(self->pointer, t, BTN_RIGHT,
!!(mask & NVNC_BUTTON_RIGHT));
int axis = WL_POINTER_AXIS_VERTICAL_SCROLL;
/* I arrived at the magical value of 15 by connecting a mouse with a
* scroll wheel and viewing the output of wev.
*/
if ((diff & NVNC_SCROLL_UP) && !(mask & NVNC_SCROLL_UP))
zwlr_virtual_pointer_v1_axis(self->pointer, t,
WL_POINTER_AXIS_VERTICAL_SCROLL,
1);
zwlr_virtual_pointer_v1_axis_discrete(self->pointer, t, axis,
wl_fixed_from_int(-15),
-1);
if ((diff & NVNC_SCROLL_DOWN) && !(mask & NVNC_SCROLL_DOWN))
zwlr_virtual_pointer_v1_axis(self->pointer, t,
WL_POINTER_AXIS_VERTICAL_SCROLL,
1);
zwlr_virtual_pointer_v1_axis_discrete(self->pointer, t, axis,
wl_fixed_from_int(15),
1);
self->current_mask = mask;
}
@ -81,4 +87,6 @@ void pointer_set(struct pointer* self, uint32_t x, uint32_t y,
if (button_mask != self->current_mask)
pointer_set_button_mask(self, t, button_mask);
zwlr_virtual_pointer_v1_frame(self->pointer);
}