On Sat, 5 Mar 2022 15:53:52 GMT, Alexander Scherbatiy <alex...@openjdk.org> wrote:
> An axis is not cached in the LinuxTouchTransform class. > > To reproduce the issue I added `System.out.printf("initTransform: axis: %d, > index: %d%n", axis, index);` log to the LinuxTouchTransform.initTransform() > method: > https://github.com/openjdk/jfx/blob/5112be957be70dd6521e6fb6ee64e669c148729c/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java#L117 > run the > [JFXButtonExample](https://bugs.openjdk.java.net/secure/attachment/98181/JFXButtonExample.java) > sample and tapped the touch screen on a Raspberry Pi with Touchscreen. > > The result was > > initTransform: axis: 47, index: 0 > initTransform: axis: 57, index: 0 > initTransform: axis: 53, index: 0 > initTransform: axis: 54, index: 0 > initTransform: axis: 0, index: 0 > initTransform: axis: 1, index: 0 > initTransform: axis: 53, index: 0 > initTransform: axis: 54, index: 0 > initTransform: axis: 0, index: 0 > initTransform: axis: 1, index: 0 > initTransform: axis: 53, index: 0 > initTransform: axis: 54, index: 0 > initTransform: axis: 0, index: 0 > initTransform: axis: 1, index: 0 > > The initTransform() is called several times for axis 0,1,47,53,54 and index > is always set to zero. > > The straight forward fix is to store the given axis in the axes array: > "axes[index] = axis". This is the first commit for the current fix. > Using this fix the output with printf from initTransform() method looks like: > > initTransform: axis: 47, index: 0 > initTransform: axis: 57, index: 1 > initTransform: axis: 53, index: 2 > initTransform: axis: 54, index: 4 > initTransform: axis: 1, index: 5 > > Now all axes are printed only once and the index value is different for each > axes. > > However, the minimum/maximum values are retrieved and cached for ABS_X/Y and > ABS_MT_POSITION_X/Y axes after the fist tap on the screen. > The second commit improves this moving the ABS_X/Y and ABS_MT_POSITION_X/Y > axes initialization into the LinuxTouchTransform constructor. > > Now the touch logs look like: > > // LinuxTouchTransform constructor > // device: /dev/input/mouse0 > initTransform: axis: 0, index: 0 > initTransform: axis: 1, index: 1 > initTransform: axis: 53, index: 2 > initTransform: axis: 54, index: 3 > > // LinuxTouchTransform constructor > // device: /dev/input/event2 > initTransform: axis: 0, index: 0 > initTransform: axis: 1, index: 1 > initTransform: axis: 53, index: 2 > initTransform: axis: 54, index: 3 > > // the first tap > initTransform: axis: 57, index: 4 > initTransform: axis: 47, index: 5 > > > The ABS_X/Y and ABS_MT_POSITION_X/Y axes and corresponding minimum/maximum > values are in... This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jfx/pull/747