RFR: 8262023: Scrolled button is pressed using Monocle on Raspberry Pi with Touchscreen
John Neffenger
github.com+1413266+jgneff at openjdk.java.net
Sat Feb 20 19:45:39 UTC 2021
On Sat, 20 Feb 2021 07:41:02 GMT, Alexander Scherbatiy <alexsch at openjdk.org> wrote:
>> In case it helps, I reproduced the problem on a Kobo Touch e-reader with an e-paper display. The expected result isn't explicit in the bug report, so just to confirm, there should be no button action events received at all when you touch any of the buttons only for the purpose of scrolling the entire pane, right?
>>
>> $ sudo $HOME/opt/jdk-15.0.2+7/bin/java \
>> --module-path=$HOME/lib/armv6hf-sdk/lib --add-modules=javafx.controls \
>> -Dglass.platform=Monocle -Dmonocle.platform=EPD -Dprism.order=sw \
>> -Dmonocle.input.18/0/0/0.minX=0 -Dmonocle.input.18/0/0/0.maxX=800 \
>> -Dmonocle.input.18/0/0/0.minY=0 -Dmonocle.input.18/0/0/0.maxY=600 ScrollPaneSample
>> Button is pressed: 3
>> Button is pressed: 3
>> Button is pressed: 5
>> Button is pressed: 5
>> Button is pressed: 5
>>
>> It's subtle, though. With a bit of practice, I can scroll the pane without causing the action events by swiping my finger quickly over the buttons. It's only when I linger for a fraction of a second too long on one of the buttons that one or more of the events are fired.
>
>> The expected result isn't explicit in the bug report, so just to confirm, there should be no button action events received at all when you touch any of the buttons only for the purpose of scrolling the entire pane, right?
>
> Could you run Ensemble8 demo on the a Kobo Touch e-reader?
>
> On my Raspberry Pi with Touchscreen I run Ensemble8, slide a main page to scroll and the program opens the sample where my finger is released. It prevents me to scroll Ensemble8 main page to bottom. To avoid this I need to use places without samples to scroll the main page down.
> Could you run Ensemble8 demo on the Kobo Touch e-reader?
Yes, I see the problem you describe using the Ensemble8 app on my Kobo e-reader. Thanks. And thank you for having the courage to fix this!
I also tested the changes in this pull request. I notice an improvement in that there are less "Button is pressed" action events received, but I still see the error. I added calls to `System.err.println` right before any calls to `arm()`, `fire()`, or `disarm()` in each of the mouse event handlers in `ButtonBehavior.java`. I swiped the buttons four times to scroll the pane. The output is shown below. The first three worked. The fourth one failed by firing Button 12 twice.
The new method is marked with the prefix `***`.
$ sudo $HOME/opt/jdk-15.0.2+7/bin/java \
--module-path=$HOME/lib/armv6hf-sdk/lib --add-modules=javafx.controls \
-Dglass.platform=Monocle -Dmonocle.platform=EPD -Dprism.order=sw \
-Dmonocle.input.18/0/0/0.minX=0 -Dmonocle.input.18/0/0/0.maxX=800 \
-Dmonocle.input.18/0/0/0.minY=0 -Dmonocle.input.18/0/0/0.maxY=600 \
ScrollPaneSample
--> Arming button (mouse pressed) ...
--> Disarming button (mouse exited) ...
--> Arming button (mouse pressed) ...
--> Disarming button (mouse exited) ...
--> Arming button (mouse pressed) ...
*** Disarming button (mouse dragged) ...
--> Arming button (mouse pressed) ...
--> Firing and disarming button (mouse released) ...
Button is pressed: 12
--> Arming button (mouse pressed) ...
--> Firing and disarming button (mouse released) ...
Button is pressed: 12
--> Arming button (mouse pressed) ...
*** Disarming button (mouse dragged) ...
The trace below shows a similar test but this time with the system property `monocle.input.traceEvents` set to `true`. (There is also the property `monocle.input.traceEvents.verbose`, but I don't find the extra information helpful.) In this case, the first two swipes worked, and the third one failed.
$ sudo $HOME/opt/jdk-15.0.2+7/bin/java \
--module-path=$HOME/lib/armv6hf-sdk/lib --add-modules=javafx.controls \
-Dglass.platform=Monocle -Dmonocle.platform=EPD -Dprism.order=sw \
-Dmonocle.input.18/0/0/0.minX=0 -Dmonocle.input.18/0/0/0.maxX=800 \
-Dmonocle.input.18/0/0/0.minY=0 -Dmonocle.input.18/0/0/0.maxY=600 \
-Dmonocle.input.traceEvents=true ScrollPaneSample
traceEvent: Set MouseState[x=400,y=300,wheel=0,buttonsPressed=IntSet[]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=238,y=448]]
traceEvent: Set MouseState[x=238,y=448,wheel=0,buttonsPressed=IntSet[212]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=253,y=110]]
traceEvent: Set MouseState[x=253,y=110,wheel=0,buttonsPressed=IntSet[212]]
traceEvent: Set TouchState[0]
traceEvent: Set MouseState[x=253,y=110,wheel=0,buttonsPressed=IntSet[]]
--> Arming button (mouse pressed) ...
--> Disarming button (mouse exited) ...
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=209,y=450]]
traceEvent: Set MouseState[x=209,y=450,wheel=0,buttonsPressed=IntSet[212]]
--> Arming button (mouse pressed) ...
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=209,y=450]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=229,y=262]]
traceEvent: Set MouseState[x=229,y=262,wheel=0,buttonsPressed=IntSet[212]]
*** Disarming button (mouse dragged) ...
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=235,y=238]]
traceEvent: Set MouseState[x=235,y=238,wheel=0,buttonsPressed=IntSet[212]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=265,y=109]]
traceEvent: Set MouseState[x=265,y=109,wheel=0,buttonsPressed=IntSet[212]]
traceEvent: Set TouchState[0]
traceEvent: Set MouseState[x=265,y=109,wheel=0,buttonsPressed=IntSet[]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=260,y=403]]
traceEvent: Set MouseState[x=260,y=403,wheel=0,buttonsPressed=IntSet[212]]
--> Arming button (mouse pressed) ...
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=260,y=403]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=260,y=403]]
traceEvent: Set TouchState[0]
traceEvent: Set MouseState[x=260,y=403,wheel=0,buttonsPressed=IntSet[]]
--> Firing and disarming button (mouse released) ...
Button is pressed: 10
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=260,y=400]]
traceEvent: Set MouseState[x=260,y=400,wheel=0,buttonsPressed=IntSet[212]]
traceEvent: Set TouchState[1,TouchState.Point[id=1,x=260,y=142]]
traceEvent: Set MouseState[x=260,y=142,wheel=0,buttonsPressed=IntSet[212]]
traceEvent: Set TouchState[0]
traceEvent: Set MouseState[x=260,y=142,wheel=0,buttonsPressed=IntSet[]]
--> Arming button (mouse pressed) ...
*** Disarming button (mouse dragged) ...
I find that any movement after touching a button will cause it to fire, even without lifting my finger. I don't think the button action should fire unless I lift my finger off the button from the same location or very near to where I first touched it.
Can you reproduce the error I'm seeing? Hold your finger on a button. Then roll your finger back and forth while keeping contact. Then release the button. Android does nothing when I do that on a button, and it seems to fire an event only when I release my finger very close to where I first touched it. With Monocle, though, I can fire a hundred action events just by rolling my finger back and forth on the button without ever releasing it.
It could be the sensitivity of my touch panel. The panel itself is double the resolution of the display, which is why I have to add all those `monocle.input` properties to set the correct 800 × 600 touch points to match the pixel resolution.
-------------
PR: https://git.openjdk.java.net/jfx/pull/406
More information about the openjfx-dev
mailing list