<AWT Dev> Fix for precise scrolling on Mac Sierra 10.12.2

Pavel Fatin pavel.fatin at jetbrains.com
Thu Jan 19 15:28:31 UTC 2017


Hi Sergey,

The provided list of numbers gives the impression that deltaY =~ SUM(0.1 
* scrollingDeltaY) and then the code uses 0.1 as a fixed multiplier to 
translate between the values. However, tests show that it's not the case 
– in reality, there's no such a linear mapping between the two values, 
and SUM(0.1 * scrollingDeltaY) might differ from deltaY significantly 
(x2-x5), especially on slow scrolling.


On 17.01.2017 0:34, Sergey Malenkov wrote:
> Hello all,
>
> A precise scrolling (introduced in Sierra) caused a fast scrolling in
> old applications including Java. It was fixed in JDK by introducing an
> accumulator for deltas. But Apple fixed this issue in 10.12.2 by
> introducing own accumulator. So, the deltaX/Y do not correspond to the
> scrollingDeltaX/Y for now. It does not affect current scrolling
> implementation in Swing, but it breaks precise scrolling values in
> MouseWheelEvent.
>
> Java API assumes that all scrolling deltas are declared in terms of
> unit scroll (i.e. a line height), so we should use deltaX/Y, but not
> recommended scrollingDeltaX/Y. But since 10.12.2 these values are not
> precise. Moreover, these values do not correspond to scrolling delta.
>
> Actual Results:
> deltaY =    0.4, scrollingDeltaY =   5,
> deltaY =    0.4, scrollingDeltaY =   5,
> deltaY =    0.0, scrollingDeltaY =   5,
> deltaY =    0.0, scrollingDeltaY =   4,
> deltaY =    0.0, scrollingDeltaY =   4,
> deltaY =    1.4, scrollingDeltaY =   4,
> deltaY =    0.0, scrollingDeltaY =   3,
> deltaY =    0.0, scrollingDeltaY =   3,
> deltaY =    0.0, scrollingDeltaY =   3,
> deltaY =    0.0, scrollingDeltaY =   3,
> deltaY =    1.1, scrollingDeltaY =   2,
> deltaY =    0.0, scrollingDeltaY =   2,
> deltaY =    0.0, scrollingDeltaY =   2,
> deltaY =    0.0, scrollingDeltaY =   2,
> deltaY =    0.0, scrollingDeltaY =   1,
> deltaY =    0.0, scrollingDeltaY =   0,
>
> Expected Results:
> deltaY =    0.5, scrollingDeltaY =   5,
> deltaY =    0.5, scrollingDeltaY =   5,
> deltaY =    0.5, scrollingDeltaY =   5,
> deltaY =    0.4, scrollingDeltaY =   4,
> deltaY =    0.4, scrollingDeltaY =   4,
> deltaY =    0.4, scrollingDeltaY =   4,
> deltaY =    0.3, scrollingDeltaY =   3,
> deltaY =    0.3, scrollingDeltaY =   3,
> deltaY =    0.3, scrollingDeltaY =   3,
> deltaY =    0.3, scrollingDeltaY =   3,
> deltaY =    0.2, scrollingDeltaY =   2,
> deltaY =    0.2, scrollingDeltaY =   2,
> deltaY =    0.2, scrollingDeltaY =   2,
> deltaY =    0.2, scrollingDeltaY =   2,
> deltaY =    0.1, scrollingDeltaY =   1,
> deltaY =    0.0, scrollingDeltaY =   0,
>
> I suggest to calculate delta from the corresponding scrollingDelta if
> a native event has precise scrolling deltas. Could you please review
> attached webrev.zip ?
>

-- 
Sincerely, Pavel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20170119/c17f7b6b/attachment.html>


More information about the awt-dev mailing list