8019265: [macosx] apple.laf.useScreenMenuBar regression comparing with jdk6
authorleonidr
Mon, 08 Jul 2013 19:47:40 +0400
changeset 18756 c0aeda4cdd3d
parent 18755 0c3267f23937
child 18757 5ab9e48648e5
8019265: [macosx] apple.laf.useScreenMenuBar regression comparing with jdk6 Reviewed-by: anthony
jdk/src/macosx/native/sun/awt/CMenuItem.m
jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java
--- a/jdk/src/macosx/native/sun/awt/CMenuItem.m	Fri Jul 05 11:57:11 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/CMenuItem.m	Mon Jul 08 19:47:40 2013 +0400
@@ -82,8 +82,13 @@
         // keys, so we need to do the same translation here that we do
         // for the regular key down events
         if ([eventKey length] == 1) {
-            unichar ch =  NsCharToJavaChar([eventKey characterAtIndex:0], 0);
-            eventKey = [NSString stringWithCharacters: &ch length: 1];
+            unichar origChar = [eventKey characterAtIndex:0];
+            unichar newChar =  NsCharToJavaChar(origChar, 0);
+            if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) {
+                newChar = origChar;
+            }
+
+            eventKey = [NSString stringWithCharacters: &newChar length: 1];
         }
 
         if ([menuKey isEqualToString:eventKey]) {
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Fri Jul 05 11:57:11 2013 -0700
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Mon Jul 08 19:47:40 2013 +0400
@@ -35,10 +35,11 @@
 import javax.swing.*;
 
 public class ActionListenerCalledTwiceTest {
-    static String menuItems[] = { "Item1", "Item2" };
+    static String menuItems[] = { "Item1", "Item2", "Item3" };
     static KeyStroke keyStrokes[] = {
         KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
-        KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)
+        KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
+        KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
     };
 
     static volatile int listenerCallCounter = 0;