jfx icon indicating copy to clipboard operation
jfx copied to clipboard

8282886: Mouse event is generated outside of node on Raspberry Pi with Touchscreen

Open AlexanderScherbatiy opened this issue 3 years ago • 4 comments

Tapping on a circle in the center of the screen sometimes generates mouse click events outside the circle with x coordinates set to zero.

To reproduce the issue run the JFXCircle sample. It has a circle in the center of the screen and a large rectangle under the circle which covers the whole screen. Tap quickly 10 times on the circle. The output is:

circle mouse pressed [416.000000, 199.000000]: 1
circle mouse pressed [416.000000, 199.000000]: 2
circle mouse pressed [419.000000, 196.000000]: 3
circle mouse pressed [416.000000, 188.000000]: 4
circle mouse pressed [419.000000, 190.000000]: 5
rectangle mouse pressed [0.000000, 188.000000]
circle mouse pressed [422.000000, 185.000000]: 6
circle mouse pressed [418.000000, 191.000000]: 7
circle mouse pressed [417.000000, 187.000000]: 8
circle mouse pressed [420.000000, 185.000000]: 9
circle mouse pressed [416.000000, 187.000000]: 10
circle mouse pressed [417.000000, 192.000000]: 11
circle mouse pressed [420.000000, 188.000000]: 12 

One mouse event is reported by the rectangle with zero x coordinate.

The issue occurs when one of ABS_MT_POSITION_X or Y position is not reported. For example, the output from evtest /dev/input/event2

Event: time 1646845728.905383, -------------- SYN_REPORT ------------
Event: time 1646845728.935382, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 1308
Event: time 1646845728.935382, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 449
Event: time 1646845728.935382, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 240
Event: time 1646845728.935382, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1646845728.935382, type 3 (EV_ABS), code 0 (ABS_X), value 449
Event: time 1646845728.935382, type 3 (EV_ABS), code 1 (ABS_Y), value 240
Event: time 1646845728.935382, -------------- SYN_REPORT ------------
Event: time 1646845729.025363, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 242
Event: time 1646845729.025363, type 3 (EV_ABS), code 1 (ABS_Y), value 242
Event: time 1646845729.025363, -------------- SYN_REPORT ------------
Event: time 1646845729.055379, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1646845729.055379, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1646845729.055379, -------------- SYN_REPORT ------------

The first SYN_REPORT reports ABS_MT_POSITION_X/Y [449, 240] coordinates. The second SYN_REPORT reports only ABS_MT_POSITION_Y value 242 and the ABS_MT_POSITION_X becomes undefined. As a result, the LinuxStatefulMultiTouchProcessor.updatePoint(x, y) method does not set the p.x value and it is left as zero. https://github.com/openjdk/jfx/blob/c6069d6845df4b90cca226e2b3dff49e3b48d8ac/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/LinuxStatefulMultiTouchProcessor.java#L161

The fix checks if ABS_MT_POSITION_X/Y value is undefined to use the previous ABS_MT_POSITION_X/Y value for the current slot.

The first commit queries ABS_MT_SLOT maximum value to store slot IDs in an array. The second commit stores ABS_MT_POSITION_X/Y values in slotToX/Y values and uses them for current undefined values.


Progress

  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] Change must be properly reviewed

Issue

  • JDK-8282886: Mouse event is generated outside of node on Raspberry Pi with Touchscreen

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/749/head:pull/749
$ git checkout pull/749

Update a local copy of the PR:
$ git checkout pull/749
$ git pull https://git.openjdk.java.net/jfx pull/749/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 749

View PR using the GUI difftool:
$ git pr show -t 749

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/749.diff

AlexanderScherbatiy avatar Mar 09 '22 17:03 AlexanderScherbatiy

:wave: Welcome back alexsch! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Mar 09 '22 17:03 bridgekeeper[bot]

/issue 8282886

AlexanderScherbatiy avatar Mar 09 '22 18:03 AlexanderScherbatiy

@AlexanderScherbatiy This issue is referenced in the PR title - it will now be updated.

openjdk[bot] avatar Mar 09 '22 18:03 openjdk[bot]

Webrevs

mlbridge[bot] avatar Mar 09 '22 18:03 mlbridge[bot]

@AlexanderScherbatiy this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8282886
git fetch https://git.openjdk.org/jfx master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

openjdk[bot] avatar Feb 17 '23 18:02 openjdk[bot]

@AlexanderScherbatiy This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Mar 31 '23 23:03 bridgekeeper[bot]

I will look at the merge conflict.

AlexanderScherbatiy avatar Apr 24 '23 11:04 AlexanderScherbatiy

@AlexanderScherbatiy This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar May 22 '23 15:05 bridgekeeper[bot]

@AlexanderScherbatiy This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar Jun 19 '23 22:06 bridgekeeper[bot]