RFR: 8294426: Two fingers tap generates wrong mouse modifiers on M2 MacBooks

Nikita Provotorov duke at openjdk.org
Fri Oct 14 13:37:06 UTC 2022


On Mon, 3 Oct 2022 20:38:43 GMT, Phil Race <prr at openjdk.org> wrote:

>> I don't have an M2 device to check, but I think (judging to the code) if we add `jmodifiers == 0` check here then users making a tap holding the Control will receive the mouse events with `modifiers` == `CTRL_DOWN_MASK | BUTTON3_MASK | CTRL_MASK`, i.e. without modern `BUTTON3_DOWN_MASK` which is at least unusual and inconvenient.
>
> OK .. well I've at least run all our automated tests and no regressions were found, so I'll approve this.

I've checked behavior of tap holding modifiers on M2 and here are which mouse events are received:
* _Ctrl + Two fingers tap_:
  * event: `java.awt.event.MouseEvent[MOUSE_PRESSED,(86,102),absolute(86,302),button=3,modifiers=⌘+⌃+Button3,extModifiers=⌃,clickCount=1] on MouseWindow$1[,0,136,200x200,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777225,maximumSize=,minimumSize=,preferredSize=]`
  * modifiers: 6 (`⌘+⌃+Button3`)
  * modifiersEx: 128 (`⌃`)
* _Option + Two fingers tap_:
  * event: `java.awt.event.MouseEvent[MOUSE_PRESSED,(63,135),absolute(63,335),button=3,modifiers=⌥+⌘+Button2+Button3,extModifiers=⌥,clickCount=1] on MouseWindow$1[,0,136,200x200,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777225,maximumSize=,minimumSize=,preferredSize=]`
  * modifiers: 12 (`⌥+⌘+Button2+Button3`)
  * modifiersEx: 512 (`⌥`)

Thus, as I assumed, modifiersEx don't contain `BUTTON3_DOWN_MASK`, so we shouldn't restrict the patch by the `jmodifiers == 0` condition.

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

PR: https://git.openjdk.org/jdk/pull/10429



More information about the client-libs-dev mailing list