changeset 5650:20e8d3977fde

8003978: [macosx] closed/javax/swing/JRootPane/bug4670486.java fails since jdk7u12b01 on macosx Reviewed-by: serb, leonidr
author alexsch
date Tue, 22 Jan 2013 15:15:17 +0400
parents 2b19b0c77416
children afe4d2b7b8cc
files src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java src/share/classes/sun/swing/SwingUtilities2.java test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java
diffstat 5 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Jan 22 02:34:28 2013 +0400
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Jan 22 15:15:17 2013 +0400
@@ -787,7 +787,6 @@
             "List.font", new FontLazyValue(Region.LIST),
             "List.rendererUseUIBorder", Boolean.FALSE,
 
-            "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
             "Menu.arrowIcon", new GTKStyle.GTKLazyValue(
                               "com.sun.java.swing.plaf.gtk.GTKIconFactory",
                               "getMenuArrowIcon"),
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java	Tue Jan 22 02:34:28 2013 +0400
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java	Tue Jan 22 15:15:17 2013 +0400
@@ -630,8 +630,10 @@
             "Menu.menuPopupOffsetY", new Integer(0),
             "Menu.submenuPopupOffsetX", new Integer(-2),
             "Menu.submenuPopupOffsetY", new Integer(3),
-            "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK,
-                                            KeyEvent.META_MASK},
+            "Menu.shortcutKeys", new int[]{
+                SwingUtilities2.getSystemMnemonicKeyMask(),
+                KeyEvent.META_MASK
+            },
             "Menu.cancelMode", "hideMenuTree",
 
             "MenuBar.border", menuBarBorder,
--- a/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Tue Jan 22 02:34:28 2013 +0400
+++ b/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Tue Jan 22 15:15:17 2013 +0400
@@ -1153,7 +1153,9 @@
             "Menu.menuPopupOffsetY", new Integer(0),
             "Menu.submenuPopupOffsetX", new Integer(0),
             "Menu.submenuPopupOffsetY", new Integer(0),
-            "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
+            "Menu.shortcutKeys", new int[]{
+                SwingUtilities2.getSystemMnemonicKeyMask()
+            },
             "Menu.crossMenuMnemonic", Boolean.TRUE,
             // Menu.cancelMode affects the cancel menu action behaviour;
             // currently supports:
--- a/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jan 22 02:34:28 2013 +0400
+++ b/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jan 22 15:15:17 2013 +0400
@@ -1868,4 +1868,12 @@
         }
         return -1;
     }
+
+    public static int getSystemMnemonicKeyMask() {
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        if (toolkit instanceof SunToolkit) {
+            return ((SunToolkit) toolkit).getFocusAcceleratorKeyMask();
+        }
+        return InputEvent.ALT_MASK;
+    }
 }
--- a/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java	Tue Jan 22 02:34:28 2013 +0400
+++ b/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java	Tue Jan 22 15:15:17 2013 +0400
@@ -36,6 +36,7 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.lang.reflect.InvocationTargetException;
 import test.java.awt.regtesthelpers.Util;
+import sun.awt.OSInfo;
 
 public class SubMenuShowTest extends Applet {
     Robot robot;
@@ -86,6 +87,11 @@
         frame.setVisible(true);
         Util.waitForIdle(robot);
 
+        boolean isMacOSX = (OSInfo.getOSType() == OSInfo.OSType.MACOSX);
+        if (isMacOSX) {
+            robot.keyPress(KeyEvent.VK_CONTROL);
+            robot.delay(20);
+        }
         robot.keyPress(KeyEvent.VK_ALT);
         robot.delay(20);
         robot.keyPress(KeyEvent.VK_F);
@@ -93,6 +99,10 @@
         robot.keyRelease(KeyEvent.VK_F);
         robot.delay(20);
         robot.keyRelease(KeyEvent.VK_ALT);
+        if (isMacOSX) {
+            robot.keyRelease(KeyEvent.VK_CONTROL);
+            robot.delay(20);
+        }
         Util.waitForIdle(robot);
 
         robot.keyPress(KeyEvent.VK_M);