Replies: 1 comment
-
|
Addition: Doh. I completely misunderstood this. What I referenced there in the AppKit documentation is for the "back" navigation gesture, when swiping left or right. So it seems that scrollingDeltaY is the desirable value, and I just need to fix whatever issue is causing it not to work as expected I will continue exploring this for macOS and I think this seriously needs to be added to keep SWT modern. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The current state of scrolling in SWT isn't great. ScrolledComposite only supports line scrolling, not pixel scrolling. Pixel scrolling can be implemented with MouseWheelEvent but it doesn't grab values with great enough precision for it to feel native enough using a trackpad. On macOS, SWT's mouse-wheel handling reads
NSEvent.deltaX()/deltaY()— the legacy line scroll API, rather than the high-resolutionscrollingDeltaX()/scrollingDeltaY()properties Apple introduced in 10.7 Lion, and doesn't look athasPreciseScrollingDeltas(),phase(), ormomentumPhase()at all.Where this lives in the code
bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java(andControl.java) — thescrollWheel(long id, long sel, long theEvent)callback, which currently readsnsEvent.deltaX()/deltaY()and multiplies byScrollBar.getIncrement().bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSEvent.java— the typed native wrapper, which does not currently bindscrollingDeltaX,scrollingDeltaY,hasPreciseScrollingDeltas,phase, ormomentumPhase.Related history:
SWT: Bugzilla [#220175](https://bugs.eclipse.org/bugs/show_bug.cgi?id=220175).
AWT: Similar discussions have taken place with regards to Java's AWT. This is one by a developer at JetBrains. mail.openjdk.org/pipermail/awt-dev/2017-January/012531.html
Other platforms
I know for a fact that Windows has similar values in their own API but I do not know the state of this on the Linux side. So if anyone knows more, feel free to add information to this discussion.
Proposed approach
My idea would be to expose these values and the momentum phase information along with similar values for Windows and Linux, depending on support. The question is however, would this be feasible and something that would genuinely be accepted in some form and if so, in what form? I haven't looked too much into this, so if I'm missing/misunderstand something, you can correct me.
Beta Was this translation helpful? Give feedback.
All reactions