The issue is reproduced on Raspberry Pi 3 B+ with Touchscreen display.

To reproduce the issue run the 
[ScrollPaneSample](https://bugs.openjdk.java.net/secure/attachment/93270/ScrollPaneSample.java)
 with Monocle:
> sudo jdk/bin/java -Dprism.verbose=true -Djavafx.platform=monocle 
> -Dembedded=monocle -Dglass.platform=Monocle ScrollPaneSample


An application consists of a ScrollPane with buttons. if a button is touched by 
a finger, moved up/down and released, the button is scrolled and the button's 
action is fired.

This happens because Monocle generates mouse pressed, mouse dragged, scroll, 
mouse released events when touch events are received.
Even a  button is scrolled on a ScrollPane it still fires the button's action 
on the synthesized mouse release event.

My first attempt was to add a scroll event listener to a ButtonBehavior class 
and disarm the button when the scroll event is received.
This does work not in the case where buttons are small and scrolling buttons 
leads that a finger is released on the next button (the scrolling process is 
remained a slightly behind the touched finger so the finger is touched on one 
button and released on another).
In this case all scroll events goes to the first button and the second button 
still fires its action (it does not disarmed because it does not receive scroll 
events).

The current fix adds drag event listener to ButtonBehavior to disarm the 
button. Drag events goes to the touched and released buttons.

Than I checked the fix on the same Raspberry Pi using GTK  with touchscreen.
>  sudo jdk/bin/java -Dprism.verbose=true -Djavafx.platform=gtk ScrollPaneSample

I have not seen scroll events using GTK (even using 
-Dgtk.com.sun.javafx.gestures.scroll=true option), but GTK sends mouse drag 
events on a button touch.
The mouse drag event between a button touch and release events would disarm the 
button in the proposed ButtonBehavior drag event handler. So I added the check 
if the mouse drag is synthesized. If the mouse drag is synthesized (Monocle 
case on touchscreen) it disarms the button, otherwise (GTK case) not.

I checked the fix for the following controls placed on a ScrollPane (see 
[ScrollPaneControlsSample](https://bugs.openjdk.java.net/secure/attachment/93271/ScrollPaneControlsSample.java)
 sample) :
- Fixed in corresponding behavior classes or its parents: Button, ToggleButton, 
CheckBox, ComboBox, ChoiceBox, ColorPicker, DatePicker, RadioButton 
- Works because an action is not fired on mouse release event: TextField 
- Does not work: Slider

The Slider control does not work with the fix because it reacts not only on 
mouse release event but on mouse drag event as well. It requires a separate fix.

I checked the Ensemble8 sample with the fix. It works with Monocle on Raspberry 
Pi 3B+ on Touchscreen. Scrolling the main page by a finger does not makes it to 
be pressed.

The Ensemble8 sample does not work with GTK on Raspberry Pi 3B+ with 
Touchscreen. I see it generates scroll events ( it has its own 
[ScrollEventSynthesizer](https://github.com/openjdk/jfx/blob/master/apps/samples/Ensemble8/src/app/java/ensemble/ScrollEventSynthesizer.java))
 and action events and it can makes the Ensemble8 buttons on a ScrollPane to be 
pressed.

-------------

Commit messages:
 - Scrolled button is pressed using Monocle on Raspberry Pi with Touchscreen

Changes: https://git.openjdk.java.net/jfx/pull/406/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=406&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262023
  Stats: 69 lines in 4 files changed: 66 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jfx/pull/406.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/406/head:pull/406

PR: https://git.openjdk.java.net/jfx/pull/406

Reply via email to