RFR: 8282703: Axis is not cached in the LinuxTouchTransform class
Alexander Scherbatiy
alexsch at openjdk.org
Mon Apr 24 08:42:58 UTC 2023
On Sat, 5 Mar 2022 15:53:52 GMT, Alexander Scherbatiy <alexsch at 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 initialized in the constructor. The other axes which stores only default values in translates and scalars arrays are initialized during touch events.
> @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!
Could you review the fix?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/747#issuecomment-1519635300
More information about the openjfx-dev
mailing list