<AWT Dev> [13] JDK-8218917: KeyEvent.getModifiers() returns inconsistent values for ALT keys

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Mar 14 23:07:38 UTC 2019


On 14/03/2019 03:33, Sergey Malenkov wrote:
> I strongly don't like two masks for one key. If you press VK_ALT,
> ALT_DOWN_MASK should be set. If you press VK_SHIFT then,
> SHIFT_DOWN_MASK should be added to indicate that both keys are
> pressed. And if you press VK_ALT_GRAPH, only ALT_GRAPH_DOWN_MASK
> should be added. Otherwise, you can't distinguish the following key
> strokes: 'AltGr+Right' and 'Alt+AltGr+Right'. But these keystrokes are
> different and should invoke different actions. For example,
> 'Alt+Right' moves cursor to the next word
> 'Alt+Shift+Right' moves cursor to the next word AND adds all skipped
> characters to selection
> 'Alt+AltGr+Right' does nothing, because we do not assign this shortcut yet

Unfortunately it is not possible to drop ALT_DOWN_MASK(to support 'Alt+AltGr+Right')
from the "right alt", it should work as alt for compatibility reasons, it is known that some
applications depends on it. The current implementation is the only way
that we could do to distinguish the alt and altGr, that preserves
compatibility and confirms the specification.


-- 
Best regards, Sergey.


More information about the awt-dev mailing list