-
Bug
-
Resolution: Fixed
-
P4
-
11, 17, 19, 20
-
b20
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8295453 | 19-pool | Maxim Kartashev | P4 | Open | Unresolved | |
JDK-8295399 | 17-pool | Maxim Kartashev | P4 | Open | Unresolved | |
JDK-8295398 | 11-pool | Maxim Kartashev | P4 | Open | Unresolved |
Tapping (not pressing) on Apple M2 MacBooks with two fingers on a trackpad generates wrong mouse modifiers (which are returned by MouseEvent.getModifiersEx).
Steps to reproduce
1. Enable System Preferences -> Trackpad -> Tap to click
2. Tap with two fingers in the following app:
import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
class MouseWindow {
final JFrame frame;
MouseWindow() {
frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setTitle("Mouse window");
frame.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
System.out.println(e);
}
});
frame.pack();
frame.setSize(300, 300);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(MouseWindow::new);
}
}
Expected
Printed mouse event has modifiersEx is 4096 (which is InputEvent.BUTTON3_DOWN_MASK)
Actual
Printed mouse event has modifiersEx is 4352 (which is InputEvent.BUTTON3_DOWN_MASK | InputEvent.META_DOWN_MASK)
The bug is 100% reproducible on M2 MacBooks (at least under macOS 12.5). It's also reproducible on M1 MacBooks, but much more rarely (about 10-15% of reproducibility).
Steps to reproduce
1. Enable System Preferences -> Trackpad -> Tap to click
2. Tap with two fingers in the following app:
import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
class MouseWindow {
final JFrame frame;
MouseWindow() {
frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setTitle("Mouse window");
frame.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
System.out.println(e);
}
});
frame.pack();
frame.setSize(300, 300);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(MouseWindow::new);
}
}
Expected
Printed mouse event has modifiersEx is 4096 (which is InputEvent.BUTTON3_DOWN_MASK)
Actual
Printed mouse event has modifiersEx is 4352 (which is InputEvent.BUTTON3_DOWN_MASK | InputEvent.META_DOWN_MASK)
The bug is 100% reproducible on M2 MacBooks (at least under macOS 12.5). It's also reproducible on M1 MacBooks, but much more rarely (about 10-15% of reproducibility).
- backported by
-
JDK-8295398 Two fingers tap generates wrong mouse modifiers on M2 MacBooks
- Open
-
JDK-8295399 Two fingers tap generates wrong mouse modifiers on M2 MacBooks
- Open
-
JDK-8295453 Two fingers tap generates wrong mouse modifiers on M2 MacBooks
- Open