JDK-8173876 : [macosx] Fast precise scrolling and DeltaAccumulator fix for macOS Sierra 10.12.2
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-02-03
  • Updated: 2018-03-03
  • Resolved: 2017-02-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8 JDK 9
10Fixed 8u152Fixed 9 b158Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
See the emails: 
Fix for precise scrolling on Mac Sierra 10.12.2
http://mail.openjdk.java.net/pipermail/awt-dev/2017-January/012540.html
----------
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 ?
----------

MacOS: precise scrolling is too fast
http://mail.openjdk.java.net/pipermail/awt-dev/2016-September/011991.html
----------
Hi guys,

JetBrains has some problems to continue Oracle support, and I have no
ability to submit a CR for now.  But there is a critical issue in AWT
scrolling after Sierra have been released.
http://bugs.openjdk.java.net/browse/JDK-8166591

I solved this issue in our custom JDK:
http://sites.google.com/site/malenkov/java/160926

This fix is safe for existing third-party code, but it removes support
of precise scrolling. It is OK for now, because Swing does not support
it. I can provide another fix, but it may affect third-party
developers and requires additional changes in Swing. For example, the
following bug must be fixed in another way:
http://bugs.openjdk.java.net/browse/JDK-7141296
I think there are may be other issues, but I have not access to
test/closed repository to check this. Could you please move UI tests
to open-source like I did for java.beans?


I see the following steps to do:
1. fix 8166591 for comfortable scrolling in Sierra
- apply my fix (simple and almost safe) or update it
  to restore precise scrolling and fix all usages of MouseWheelEvent
2. implement new feature: Precise scrolling in Swing
- now it uses integers only
3. implement new feature: Imitate native scroll bars on Mac


I'll try to raise the issue severity as soon as we restore access to
Oracle support.
----------
Fix for DeltaAccumulator
http://mail.openjdk.java.net/pipermail/awt-dev/2017-January/012539.html
----------
Hello Alexander,

I want to suggest a change for your fix. It fixes the following issue:
http://youtrack.jetbrains.com/issue/IDEA-162490

My change updates processing of scrolling phase.
We should process events from PHASE_BEGIN to PHASE_END,
and ignore other events like PHASE_MAY_BEGIN.

Could you please review attached webrev.zip ?
----------
Comments
Request to backport the issue to the JDK 8u-dev: http://mail.openjdk.java.net/pipermail/jdk8u-dev/2017-February/006443.html
22-02-2017

http://mail.openjdk.java.net/pipermail/awt-dev/2017-February/012573.html http://cr.openjdk.java.net/~alexsch/sergey.malenkov/8173876/webrev-all.00
07-02-2017

The review thread: http://mail.openjdk.java.net/pipermail/awt-dev/2017-February/012573.html Proposed fixes: Precise Scrolling: http://cr.openjdk.java.net/~alexsch/sergey.malenkov/8173876/webrev-precise-scrolling.00 DeltaAccumulator: http://cr.openjdk.java.net/~alexsch/sergey.malenkov/8173876/webrev-delta-accumulator.00 Both: http://cr.openjdk.java.net/~alexsch/sergey.malenkov/8173876/webrev-all.00
07-02-2017