RFR: 8242419: JFXPanel: MouseEvent always reports that Primary button changed state if held [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Thu Jul 6 03:21:19 UTC 2023
> If an EventHandler or EventFilter for a mouse button is attached to a scene within a JFXPanel and the **primary mouse button** is held, any mouse button click will create an event such that event.getButton().name() wrongly returns PRIMARY, even if the secondary or middle button was clicked.
> This is because `SwingEvents.mouseButtonToEmbedMouseButton()` overwrites the button name after checking the modifier value.
> For mouse click with primary button `mouseButtonToEmbedMouseButton` is first called with `BUTTON1 `and modifier `BUTTON1_DOWN_MASK `(ie 1024) and then when secondary button(ie right button is clicked) `mouseButtonToEmbedMouseButton` is called with `BUTTON3 `and modifier `BUTTON3_DOWN_MASK | BUTTON1_DOWN_MASK` (ie 5120)
> and when secondary button is released, `mouseButtonToEmbedMouseButton` is again called with `BUTTON3 `but with modifier `BUTTON1_DOWN_MASK `(1024) resulting in button being declared PRIMARY.
>
> Fix is to make sure not to overwrite button name if a button name is already assigned.
Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
Fix comment
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1170/files
- new: https://git.openjdk.org/jfx/pull/1170/files/f44b7496..f10c3299
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1170&range=01
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1170&range=00-01
Stats: 2 lines in 1 file changed: 1 ins; 1 del; 0 mod
Patch: https://git.openjdk.org/jfx/pull/1170.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1170/head:pull/1170
PR: https://git.openjdk.org/jfx/pull/1170
More information about the openjfx-dev
mailing list