Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236971

[macos] Gestures handled incorrectly due to missing events

XMLWordPrintable

        On my MacBook Pro I can observe the following incorrect behavior for gestures. See attached demo program. (I can't say what the behavior
        on other platforms is.)

        When I move two fingers over the built-in track pad, I get the following kind of output:

        setOnScroll: 0,000000 0,000000 1,000000 1,000000 0
        setOnScroll: 0,000000 0,000000 2,000000 2,000000 0
        setOnScroll: 0,000000 0,000000 1,000000 1,000000 0
        setOnScroll: 0,000000 0,000000 1,000000 1,000000 0
        setOnScroll: 1,000000 1,000000 1,000000 1,000000 0
        setOnScroll: 1,000000 1,000000 2,000000 2,000000 0
        setOnScroll: 1,000000 1,000000 1,000000 1,000000 0
        setOnScroll: 1,000000 1,000000 1,000000 1,000000 0

        The values are: e.getDeltaX(), e.getTotalDeltaX(), e.getDeltaY(), e.getTotalDeltaY(), e.getTouchCount()

        This is wrong for several reasons according to the documentation for ScrollEvent:

        1. The sequence of events for one gesture is never surrounded by SCROLL_STARTED and SCROLL_FINISHED.
        2. The total-delta values are never accumulated. They seem to be the same as the delta values.
        3. The touch-count is always 0. I'd expected 2 in this case.

        This is also inconsistent with zoom events, where I get at least sometimes a zoom-started or zoom-finished notification. But this behavior is also not correct because it seems the zoom events are not surrounded correctly. Often I just get something like this:

        setOnZoom: 0,998001
        setOnZoom: 0,998001
        setOnZoom: 0,994003
        setOnZoomFinished
        setOnZoomStarted

        For rotation events the accumulation behavior actually works in contrast to the scroll events.

        When I now attach an USB mouse to my Mac and create scroll events with the mouse wheel, the behavior is also wrong. The documentation says: "The totalDeltaX and totalDeltaY contain the cumulative values for the whole gesture, zeros for mouse wheel". As you can see here, the total-deltas for y are not zeros.

        setOnScroll: 0,000000 0,000000 1,000061 1,000061 0
        setOnScroll: 0,000000 0,000000 1,000061 1,000061 0
        setOnScroll: 0,000000 0,000000 1,000061 1,000061 0
        setOnScroll: 0,000000 0,000000 1,000061 1,000061 0
        setOnScroll: 0,000000 0,000000 4,296417 4,296417 0
        setOnScroll: 0,000000 0,000000 -1,000061 -1,000061 0
        setOnScroll: 0,000000 0,000000 -11,195526 -11,195526 0
        setOnScroll: 0,000000 0,000000 -38,627014 -38,627014 0
        setOnScroll: 0,000000 0,000000 -50,805664 -50,805664 0
        setOnScroll: 0,000000 0,000000 -52,142639 -52,142639 0

        The current behavior is especially problematic for me because there does not seem to be any reliable way now to distinguish between mouse and track pad generated scrolling for which I have to take differnt actions.

              kcr Kevin Rushforth
              mpaus Michael Paus
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: