RamonUnch / GreenPad

Fork from roytam1 fork from original GreenPad
22 stars 0 forks source link

Take SPI_GETWHEELSCROLLLINES parameter in account #45

Closed RamonUnch closed 2 years ago

RamonUnch commented 2 years ago

This is a bug fix: GreenPad now takes the number of lines for a scroll event into account. Also the patch avoids scrolling more than a single page when scroll step is larger than the current view's height (even Microsoft recommends that).

Also the multiplication by number of lines must be done before the division by WHEEL_DELTA(=120), otherwise when delta is smaller that 120 it does not scroll at all! Some mouses with fine wheel can do that.

EDIT: if delta is too small we still get a problem because we cannot scroll less that a single line. In theory we should accumulate the wheel steps and scroll a line when we reach the correct amount.

I know the NZero() is completely overkill but I am always paranoid about divisions by zero (just me).

@roytam1 you might be interested by this patch.