+ (jint) scrollStateWithEvent: (NSEvent*) event { scrollPhaseFromEvent sounds more clear for me
if ([event type] != NSScrollWheel) { return 0; } We have no corresponding SCROLL_PHASE_ constant. This value is not processed and is processed like S_P_CONTINUED in our code. On Fri, Sep 30, 2016 at 5:59 PM, Alexander Scherbatiy <alexandr.scherba...@oracle.com> wrote: > > Hello, > > Could you review the updated fix: > http://cr.openjdk.java.net/~alexsch/8166591/webrev.06 > > - The CPlatformResponder.handleScrollEvent(...) is updated to dispatch a > scroll event when delta or round delta is not equal to zero > - The native scrollStateWithPhase: method is updated to have NSEvent as an > argument > > Thanks, > Alexandr. > > On 30/09/16 16:58, Sergey Malenkov wrote: >> >> In the CPlatformResponder: >> >> phase3 0 ~ 0.0 // mayBegan >> phase2 0 ~ 0.0 // began >> phase3 0 ~ 0.0222015380859375 >> phase3 0 ~ 0.0234222412109375 >> phase3 0 ~ 0.023956298828125 >> phase3 0 ~ 0.0242919921875 >> phase3 0 ~ 0.02447509765625 >> phase3 0 ~ 0.0246124267578125 >> phase3 0 ~ 0.024658203125 >> phase3 0 ~ 0.0222015380859375 >> phase3 0 ~ 0.0233306884765625 >> phase5 1 ~ 0.0 // end >> >> In Java: >> >> wheelRotation=0,preciseWheelRotation=-0.0222015380859375 >> wheelRotation=0,preciseWheelRotation=-0.0234222412109375 >> wheelRotation=0,preciseWheelRotation=-0.023956298828125 >> wheelRotation=0,preciseWheelRotation=-0.0242919921875 >> wheelRotation=0,preciseWheelRotation=-0.02447509765625 >> wheelRotation=0,preciseWheelRotation=-0.0246124267578125 >> wheelRotation=0,preciseWheelRotation=-0.024658203125 >> wheelRotation=0,preciseWheelRotation=-0.0222015380859375 >> wheelRotation=0,preciseWheelRotation=-0.0233306884765625 >> >> We ignored first two events, because of 0 & 0.0 >> We should not ignore last event, where 1 & 0.0 >> Seems we need to fix DeltaAccumulator. >> >> >> On Fri, Sep 30, 2016 at 2:25 PM, Alexander Scherbatiy >> <alexandr.scherba...@oracle.com> wrote: >>> >>> Hello, >>> >>> Could you review the updated fix: >>> http://cr.openjdk.java.net/~alexsch/8166591/webrev.05 >>> >>> The momentumPhase is used to detect the trackpad events. >>> >>> Thanks, >>> Alexandr. >>> >>> >>> On 30/09/16 14:58, Sergey Malenkov wrote: >>>>> >>>>> # C [AppKit+0x3a528e] -[NSApplication _crashOnException:]+0x6d >>>>> >>>>> The app is crashed as soon as I start scrolling. Investigating... >>>>> May be it is my fault during backporting. >>>> >>>> Sorry, It was may fault. >>>> >>>> >>>>> LWCToolkit.m: >>>>> +// SCROLL EVENT MASK >>>>> +#define SCROLL_PHASE_UNSUPPORTED 1 >>>>> ... >>>>> >>>>> replace the comment with the following one: >>>>> >>>>> +// TRACKPAD SCROLL EVENT PHASE >>>> >>>> I discovered how we should detect mouse event properly: use both >>>> properties phase and momentumPhase. >>>> >>>> >>>> https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/EventOverview/HandlingTouchEvents/HandlingTouchEvents.html >>>> "The momentumPhase property helps you detect momentum scrolling, in >>>> which the hardware continues to issue scroll wheel events even though >>>> the user is no longer physically scrolling." >>>> >>>> if (phase==NULL) && (momentumPhase==NULL) -> this is a mouse event. >>>> >>>> scrolling by trackpad generates the following events: >>>> >>>> phase=mayBegan momentumPhase=null >>>> phase=began momentumPhase=null >>>> phase=continued momentumPhase=null >>>> ... >>>> phase=continued momentumPhase=null >>>> phase=ended momentumPhase=null >>>> phase=null momentumPhase=began >>>> phase=null momentumPhase=continued >>>> ... >>>> phase=null momentumPhase=continued >>>> phase=null momentumPhase=ended >>>> >>>> So, we should generate PHASE_UNSUPPORTED only >>>> if ((phase == NULL) && (momentumPhase == NULL)) >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >> >> > -- Best regards, Sergey A. Malenkov