JDK-8028617 : Dvorak keyboard mapping not honored when ctrl key pressed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u40,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-11-19
  • Updated: 2015-08-21
  • Resolved: 2014-05-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u72Fixed 8u20Fixed 9 b22Fixed
Related Reports
Duplicate :  
EB> Environment
EB> ===========
EB> Mac OS X 10.7.5
EB> Java 1.6.0_45
EB> NetBeans 7.3.1
EB> Configuration
EB> =============

EB> In System preferences, set keyboard layout to DVORAK and remap the
EB> caps lock key to be the ctrl key.

EB> In NetBeans preferences, set the keyboard mapping to emacs.

EB> Steps to reproduce
EB> ==================

EB> 1. In the text editor, put the text on a line and press Ctrl-e (e in
EB> the DVORAK layout is where d is in QWERTY) to go to the end of the
EB> line.

EB> Instead of going to the end of the line, Netbeans deletes a character.

EB> 2. In the text editor, put the text on a line and press Ctrl-.  This
EB> causes the cursor to go to the end of the line, apparently because
EB> . in the DVORAK layout is where e is in QWERTY.
EB> Observation
EB> ===========

EB> It seems the keymap reverts to QWERTY when the Ctrl key is pressed.

EB> If I bring up the keyboard viewer, I do see that Ctrl-e is shown to
EB> be pressed when I press Ctrl-e.

Svata Dedic wrote:

SD> This seems as a defect in JDK/MacOS X, specifically the method
SD> KeyEvent.getExtendedKeyCode() fails to produce the correct key code
SD> (returns VK_UNDEFINED).

SD> The KeyEvent that arrives to the NetBeans for pressing "E" key has
SD> the following properties on both Linux (working) and MacOS X (not
SD> working):

SD> * keyText='E'
SD> * keyChar='.'
SD> * keyCode=69

SD> extendedKeyCode returns 46 on Linux, 0 on MacOS X.

SD> Should start to work OK once fixed on JDK/JRE side.

There is no possibility to create an auto test since the problem is reproducible only with non-ascii keyboard layout. As far as I understand we avoid creating manual regression tests.

Why there is no regression test?

To reproduce the problem run the Frame1 testcase. With the qwerty layout press Ctrl-D in the textfield, you should see '^ D D' Switch to the Dvorak layout (add it in the Settings if needed), in the text field again press Ctrl-D ('D' key in qwerty layout corresponds to 'E' in Dvorak layout). Without the fix you will see the same picture: '^ D D' With the fix you should see '^ E E'

The updated fix is here http://cr.openjdk.java.net/%7Eanashaty/8028617/9/webrev.01/

I am delighted to see action on this. How can I advocate for having it backported to the next release for JDK7 and JDK8? Thanks, Ed

Suggested fix: http://cr.openjdk.java.net/~anashaty/8028617/9/webrev.00/

The problem is in the AWTView.m:deliverJavaKeyEventHelper(): for taking a character we use NSEvent::characters which works fine until the Ctrl modifier is pressed. In this case the 'charaters' returns empty string. The typed character is then calculated via key code using the standard keyboard layout. Of course that doesn't work for any other layout including DVORAK. We should use NSEvent::charactersIgnoringModifiers property instead (especially taking into account that sun.lwawt.macosx.event.NSEvent constructor parameter name is 'charactersIgnoringModifiers')

Release team: Approved for deferral.

@ Please provide further details of the impact of this issue on a customer (or @ you as the filer). @ . @ Is this blocking a milestone/deadline? Thank you for your attention. This issue impacts me personally because I use the DVORAK keyboard mapping. I declare this mapping preference using the OS (Mac OS 10.8.5). This issue makes it so I cannot use GUI Java apps on jdk7 because when I press the ctrl key, the keycodes are sent as if the US-ASCII keyboard mapping is selected. Consider the impact when using netbeans 7.4 with emacs keyboard shortcuts. On dvorak, the 'e' key is where the 'd' key is on qwerty. Thus pressing ctrl 'e' deletes the line instead of moving the cursor to the end of the line. @ At the moment this is a very (very) low priority task for our team, so please @ give us more background. @ . If the problem only impacted dvorak keyboard users, I could see an argument for low priority. However, I wonder if it impacts other locales also, and would thus be a bigger problem. @ When you advocated for this to be fixed, who did you speak to? Brian Goetz. I hope you can give it some time.

jdk8: SQE OK to defer

Defer justification: The issue exists from apple jdk-6, a very uncommon system configuration is affected.

please review priority and affecting jdk8 (critical-defer)