Merge remote-tracking branch 'origin/GP-6450-dragonmacher-right-alt-fix'

into patch (Closes #8969)
This commit is contained in:
Ryan Kurtz
2026-02-17 15:32:08 -05:00
@@ -15,6 +15,7 @@
*/
package docking.action;
import java.awt.event.InputEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.*;
@@ -102,6 +103,9 @@ public class KeyBindingsManager implements PropertyChangeListener {
// map standard keystroke to action
doAddKeyBinding(provider, action, keyStroke);
// map workaround keystroke to action
fixupAltGraphKeyStrokeMapping(provider, action, keyStroke);
}
public String validateActionKeyBinding(DockingActionIf dockingAction, KeyStroke ks) {
@@ -146,6 +150,24 @@ public class KeyBindingsManager implements PropertyChangeListener {
doAddKeyBinding(provider, action, keyStroke, keyStroke);
}
private void fixupAltGraphKeyStrokeMapping(ComponentProvider provider, DockingActionIf action,
KeyStroke keyStroke) {
// special case
int modifiers = keyStroke.getModifiers();
if ((modifiers & InputEvent.ALT_DOWN_MASK) == InputEvent.ALT_DOWN_MASK) {
//
// Also register the 'Alt' binding with the 'Alt Graph' mask. This fixes the but
// on Windows (https://bugs.openjdk.java.net/browse/JDK-8194873)
// that have different key codes for the left and right Alt keys.
//
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
KeyStroke updateKeyStroke =
KeyStroke.getKeyStroke(keyStroke.getKeyCode(), modifiers, false);
doAddKeyBinding(provider, action, updateKeyStroke, keyStroke);
}
}
private void doAddKeyBinding(ComponentProvider provider, DockingActionIf action,
KeyStroke mappingKeyStroke, KeyStroke actionKeyStroke) {