Hello,

Could you review the updated fix:
  http://cr.openjdk.java.net/~alexsch/8166591/webrev.04

The fix uses the proposed changes below and sets a wheel rotation to +1 or -1 when the scroll phase is ended and the accumulates delta value is small than the threshold.

Thanks,
Alexandr.

On 29/09/16 22:56, Sergey Malenkov wrote:
- The SCROLL_MASK_PHASE_CANCELLED  and SCROLL_MASK_PHASE_ENDED scroll masks
are added.
Now we use the scrollMask value and the following constants:

static final int SCROLL_MASK_WHEEL = 1;
static final int SCROLL_MASK_TRACKPAD = 1 << 1;
static final int SCROLL_MASK_PHASE_BEGAN = 1 << 2;
static final int SCROLL_MASK_PHASE_CANCELLED = 1 << 3;
static final int SCROLL_MASK_PHASE_ENDED = 1 << 4;

All these masks cannot be used together.
So I suggest to replace it with the scrollPhase value:

static final int SCROLL_PHASE_UNSUPPORTED = 0; // for mouse events
static final int SCROLL_PHASE_BEGAN = 1;
static final int SCROLL_PHASE_CONTINUED = 2;
static final int SCROLL_PHASE_CANCELLED = 3;
static final int SCROLL_PHASE_ENDED = 4;

It simplifies if-statements:
- if ((scrollMask & NSEvent.SCROLL_MASK_PHASE_BEGAN) != 0) {
+ if (scrollPhase == NSEvent.SCROLL_PHASE_BEGAN) {

and the following method:

+ (jint) scrollTypeToMask: (NSEventPhase) phase {
     if (phase) return SCROLL_PHASE_UNSUPPORTED;
     switch (phase) {
         case NSEventPhaseBegan:    return SCROLL_MASK_PHASE_BEGAN;
         case NSEventPhaseCancelled:    return SCROLL_MASK_PHASE_CANCELLED;
         case NSEventPhaseEnded:    return SCROLL_MASK_PHASE_ENDED;
     }
     return SCROLL_PHASE_CONTINUED;
}

What do you think?


Reply via email to