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

Unwanted MOUSE_MOVED event breaks dispatching MOUSE_RELEASED to the right component

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, 9
    • Fix Version/s: tbd
    • Component/s: client-libs
    • Labels:
      None

      Description

      We found a rare occurrence of a bug in JDK1.8 and onwards, might also occur earlier but we didn’t check for that.

      In some instances MOUSE_MOVED events occur between a MOUSE_PRESSED and a MOUSE_RELEASED. In Container.java on MOUSE_PRESSED the component is remembered in an instance variable to send a corresponding MOUSE_RELEASED to it.
      The same instance variable is used for the MOUSE_MOVED Event, so if there are MOUSE_MOVED Events between a MOUSE_PRESSED and MOUSE_RELEASED the corresponding MOUSE_RELEASE will be reported to the "wrong" component.

      I attached a simple example to replicate the error.

      The probability of occurrence of this fluctuates with the hardware used. We got the best results to reproduce with a Macbook and a magic mouse. With a trackpad it is almost impossible to replicate.

      How to reproduce: With the attached example, move the mouse in the blue rectangle VERY FAST from left to right or vice versa. Release the mousebutton near the end of the drag, while you are still in motion.

      We are using a workaround for this, the same custom queue built into the example. If we are between MOUSE_PRESSED and MOUSE_RELEASED we do not dispatch MOUSE_MOVED Events.
      We would still like to see this bug fixed or at least have different instance variables for MOUSE_PRESSED and MOUSE_MOVED so we get the MOUSE_RELEASE on the right component.

      The problem was initially reported on awt-dev mailing list: http://mail.openjdk.java.net/pipermail/awt-dev/2018-January/013482.html

        Attachments

        1. ErrorOutput.jpg
          ErrorOutput.jpg
          58 kB
        2. ErrorOutput.jpg
          ErrorOutput.jpg
          58 kB
        3. HardwareSpec1.jpg
          HardwareSpec1.jpg
          53 kB
        4. HardwareSpec1.jpg
          HardwareSpec1.jpg
          53 kB
        5. HardwareSpec2.jpg
          HardwareSpec2.jpg
          52 kB
        6. HardwareSpec2.jpg
          HardwareSpec2.jpg
          52 kB
        7. MouseMotionBugGui.java
          4 kB

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            clanger Christoph Langer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: