jfx
jfx copied to clipboard
8282702: Button is pressed one more time on Raspberry Pi with Touchscreen
Tapping on a button and next tapping on another place on the screen leads that the button is pressed twice on a Raspberry Pi with Touchscreen.
For example, run the JFXButtonExample app and first tap on the button in the left bottom side of the screen and second tap on the center of the screen.
This is a log of the state from LinuxStatefulMultiTouchProcessor.processEvents() method when System.out.printf("state: %s%n", state);
code is added before the line:
https://github.com/openjdk/jfx/blob/2e8a4a5e97bb88a5807ae5fe075b98e1d54a4ca0/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/LinuxStatefulMultiTouchProcessor.java#L140
state: TouchState[1,TouchState.Point[id=91,x=257,y=419]]
state: TouchState[1,TouchState.Point[id=91,x=257,y=420]]
state: TouchState[0]
Hello World!
state: TouchState[2,TouchState.Point[id=91,x=257,y=419],TouchState.Point[id=92,x=410,y=265]]
state: TouchState[2,TouchState.Point[id=91,x=257,y=419],TouchState.Point[id=92,x=409,y=267]]
state: TouchState[2,TouchState.Point[id=91,x=257,y=419],TouchState.Point[id=92,x=408,y=286]]
state: TouchState[0]
Hello World!
The TouchState contains only button coordinates (x=257,y=419) for the first tap on the button. The TouchState contains both the button coordinates (x=257,y=419) and coordinates of the center of screen (x=408,y=286) for the second tap on the center of the screen.
This happens because when LinuxStatefulMultiTouchProcessor.processEvents() pushes the state with current touches to the pipeline the LookaheadTouchFilter saves the current state and copies the previous saved state to the current state. https://github.com/openjdk/jfx/blob/2e8a4a5e97bb88a5807ae5fe075b98e1d54a4ca0/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/LookaheadTouchFilter.java#L74
That leads that the already deleted touch state (which contains the button coordinate) is restored.
The proposed solution is to put the copy of the touch state to the pipeline .
Printing the touch state after the fix shows the log:
state: TouchState[1,TouchState.Point[id=65,x=267,y=423]]
state: TouchState[1,TouchState.Point[id=65,x=269,y=425]]
state: TouchState[0]
Hello World!
state: TouchState[1,TouchState.Point[id=66,x=414,y=243]]
state: TouchState[1,TouchState.Point[id=66,x=414,y=238]]
state: TouchState[0]
The TouchState does not contains the button coordinates for the second tap.
Progress
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
- [ ] Change must be properly reviewed
Issue
- JDK-8282702: Button is pressed one more time on Raspberry Pi with Touchscreen
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/746/head:pull/746
$ git checkout pull/746
Update a local copy of the PR:
$ git checkout pull/746
$ git pull https://git.openjdk.java.net/jfx pull/746/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 746
View PR using the GUI difftool:
$ git pr show -t 746
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/746.diff
: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.
The fix looks OK to me. Since it is in Monocle, maybe @johanvos can review it?
@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!
#641 proposes to fix the issue in general way in TouchPipeline, not only for LinuxStatefulMultiTouchProcessor.