7129133: [macosx] Accelerators are displayed as Meta instead of the Command symbol
Reviewed-by: anthony, serb
This commit is contained in:
parent
721272b6c0
commit
bf404f9ad8
@ -253,6 +253,13 @@ ifeq ($(OPENJDK_TARGET_OS),windows)
|
|||||||
$(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\
|
$(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\
|
||||||
ListResourceBundle,%zh_TW,%zh_HK))
|
ListResourceBundle,%zh_TW,%zh_HK))
|
||||||
endif
|
endif
|
||||||
|
# os x specific awt properties
|
||||||
|
ifeq ($(OPENJDK_TARGET_OS),macosx)
|
||||||
|
$(eval $(call add_properties_to_compile,SUN_AWT,\
|
||||||
|
$(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\
|
||||||
|
$(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\
|
||||||
|
ListResourceBundle))
|
||||||
|
endif
|
||||||
|
|
||||||
#sun/launcher/resources
|
#sun/launcher/resources
|
||||||
$(eval $(call add_properties_to_compile,SUN_LAUNCHER,\
|
$(eval $(call add_properties_to_compile,SUN_LAUNCHER,\
|
||||||
|
71
jdk/src/macosx/classes/sun/awt/resources/awtosx.properties
Normal file
71
jdk/src/macosx/classes/sun/awt/resources/awtosx.properties
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#
|
||||||
|
# OS X specific AWT properties
|
||||||
|
#
|
||||||
|
|
||||||
|
# Modifier names
|
||||||
|
AWT.shift=\u21e7
|
||||||
|
AWT.control=\u2303
|
||||||
|
AWT.alt=\u2325
|
||||||
|
AWT.meta=\u2318
|
||||||
|
AWT.altGraph=\u2325
|
||||||
|
|
||||||
|
# Key names
|
||||||
|
AWT.enter=\u23ce
|
||||||
|
AWT.backSpace=\u232b
|
||||||
|
AWT.tab=\u21e5
|
||||||
|
AWT.cancel=\u238b
|
||||||
|
AWT.clear=\u2327
|
||||||
|
AWT.capsLock=\u21ea
|
||||||
|
AWT.escape=\u238b
|
||||||
|
AWT.space=\u2423
|
||||||
|
AWT.pgup=\u21de
|
||||||
|
AWT.pgdn=\u21df
|
||||||
|
AWT.end=\u2198
|
||||||
|
AWT.home=\u2196
|
||||||
|
AWT.left=\u2190
|
||||||
|
AWT.up=\u2191
|
||||||
|
AWT.right=\u2192
|
||||||
|
AWT.down=\u2193
|
||||||
|
AWT.comma=,
|
||||||
|
AWT.period=.
|
||||||
|
AWT.slash=/
|
||||||
|
AWT.semicolon=;
|
||||||
|
AWT.equals=\u003d
|
||||||
|
AWT.openBracket=[
|
||||||
|
AWT.backSlash=\\
|
||||||
|
AWT.closeBracket=]
|
||||||
|
AWT.multiply=\u2328 *
|
||||||
|
AWT.add=\u2328 +
|
||||||
|
AWT.separator=\u2328 ,
|
||||||
|
AWT.separater=\u2328 ,
|
||||||
|
AWT.subtract=\u2328 -
|
||||||
|
AWT.decimal=\u2328 .
|
||||||
|
AWT.divide=\u2328 /
|
||||||
|
AWT.delete=\u2326
|
||||||
|
AWT.printScreen=\u2399
|
||||||
|
AWT.backQuote=`
|
||||||
|
AWT.quote='
|
||||||
|
AWT.ampersand=&
|
||||||
|
AWT.asterisk=*
|
||||||
|
AWT.quoteDbl="
|
||||||
|
AWT.Less=<
|
||||||
|
AWT.greater=>
|
||||||
|
AWT.braceLeft=[
|
||||||
|
AWT.braceRight=]
|
||||||
|
AWT.at=@
|
||||||
|
AWT.colon=:
|
||||||
|
AWT.circumflex=^
|
||||||
|
AWT.dollar=$
|
||||||
|
AWT.euro=\u20ac
|
||||||
|
AWT.exclamationMark=!
|
||||||
|
AWT.invertedExclamationMark=\u00a1
|
||||||
|
AWT.leftParenthesis=(
|
||||||
|
AWT.numberSign=#
|
||||||
|
AWT.plus=+
|
||||||
|
AWT.minus=-
|
||||||
|
AWT.rightParenthesis=)
|
||||||
|
AWT.underscore=_
|
||||||
|
|
||||||
|
# Numeric Keypad
|
||||||
|
AWT.numpad=\u2328
|
||||||
|
|
@ -44,6 +44,8 @@ import sun.lwawt.*;
|
|||||||
import sun.lwawt.LWWindowPeer.PeerType;
|
import sun.lwawt.LWWindowPeer.PeerType;
|
||||||
import sun.security.action.GetBooleanAction;
|
import sun.security.action.GetBooleanAction;
|
||||||
|
|
||||||
|
import sun.util.CoreResourceBundleControl;
|
||||||
|
|
||||||
class NamedCursor extends Cursor {
|
class NamedCursor extends Cursor {
|
||||||
NamedCursor(String name) {
|
NamedCursor(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@ -67,13 +69,28 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
System.err.flush();
|
System.err.flush();
|
||||||
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
|
|
||||||
public Object run() {
|
ResourceBundle platformResources = java.security.AccessController.doPrivileged(
|
||||||
|
new java.security.PrivilegedAction<ResourceBundle>() {
|
||||||
|
public ResourceBundle run() {
|
||||||
|
ResourceBundle platformResources = null;
|
||||||
|
try {
|
||||||
|
platformResources =
|
||||||
|
ResourceBundle.getBundle("sun.awt.resources.awtosx",
|
||||||
|
CoreResourceBundleControl.getRBControlInstance());
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
// No resource file; defaults will be used.
|
||||||
|
}
|
||||||
|
|
||||||
System.loadLibrary("awt");
|
System.loadLibrary("awt");
|
||||||
System.loadLibrary("fontmanager");
|
System.loadLibrary("fontmanager");
|
||||||
return null;
|
|
||||||
|
return platformResources;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources);
|
||||||
|
|
||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ import sun.awt.HeadlessToolkit;
|
|||||||
import sun.awt.NullComponentPeer;
|
import sun.awt.NullComponentPeer;
|
||||||
import sun.awt.PeerEvent;
|
import sun.awt.PeerEvent;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import sun.security.util.SecurityConstants;
|
import sun.security.util.SecurityConstants;
|
||||||
|
|
||||||
import sun.util.CoreResourceBundleControl;
|
import sun.util.CoreResourceBundleControl;
|
||||||
@ -1599,6 +1600,12 @@ public abstract class Toolkit {
|
|||||||
* here, so that only one copy is maintained.
|
* here, so that only one copy is maintained.
|
||||||
*/
|
*/
|
||||||
private static ResourceBundle resources;
|
private static ResourceBundle resources;
|
||||||
|
private static ResourceBundle platformResources;
|
||||||
|
|
||||||
|
// called by platform toolkit
|
||||||
|
private static void setPlatformResources(ResourceBundle bundle) {
|
||||||
|
platformResources = bundle;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize JNI field and method ids
|
* Initialize JNI field and method ids
|
||||||
@ -1647,6 +1654,14 @@ public abstract class Toolkit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
AWTAccessor.setToolkitAccessor(
|
||||||
|
new AWTAccessor.ToolkitAccessor() {
|
||||||
|
@Override
|
||||||
|
public void setPlatformResources(ResourceBundle bundle) {
|
||||||
|
Toolkit.setPlatformResources(bundle);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<Void>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
@ -1674,6 +1689,15 @@ public abstract class Toolkit {
|
|||||||
* This method returns defaultValue if the property is not found.
|
* This method returns defaultValue if the property is not found.
|
||||||
*/
|
*/
|
||||||
public static String getProperty(String key, String defaultValue) {
|
public static String getProperty(String key, String defaultValue) {
|
||||||
|
// first try platform specific bundle
|
||||||
|
if (platformResources != null) {
|
||||||
|
try {
|
||||||
|
return platformResources.getString(key);
|
||||||
|
}
|
||||||
|
catch (MissingResourceException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// then shared one
|
||||||
if (resources != null) {
|
if (resources != null) {
|
||||||
try {
|
try {
|
||||||
return resources.getString(key);
|
return resources.getString(key);
|
||||||
|
@ -39,6 +39,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -704,6 +705,13 @@ public final class AWTAccessor {
|
|||||||
boolean isSequencedEvent(AWTEvent event);
|
boolean isSequencedEvent(AWTEvent event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An accessor for the Toolkit class
|
||||||
|
*/
|
||||||
|
public interface ToolkitAccessor {
|
||||||
|
void setPlatformResources(ResourceBundle bundle);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accessor instances are initialized in the static initializers of
|
* Accessor instances are initialized in the static initializers of
|
||||||
* corresponding AWT classes by using setters defined below.
|
* corresponding AWT classes by using setters defined below.
|
||||||
@ -731,6 +739,7 @@ public final class AWTAccessor {
|
|||||||
private static TrayIconAccessor trayIconAccessor;
|
private static TrayIconAccessor trayIconAccessor;
|
||||||
private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
|
private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
|
||||||
private static SequencedEventAccessor sequencedEventAccessor;
|
private static SequencedEventAccessor sequencedEventAccessor;
|
||||||
|
private static ToolkitAccessor toolkitAccessor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set an accessor object for the java.awt.Component class.
|
* Set an accessor object for the java.awt.Component class.
|
||||||
@ -1124,4 +1133,22 @@ public final class AWTAccessor {
|
|||||||
// (so not a single instance of the event has been created).
|
// (so not a single instance of the event has been created).
|
||||||
return sequencedEventAccessor;
|
return sequencedEventAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set an accessor object for the java.awt.Toolkit class.
|
||||||
|
*/
|
||||||
|
public static void setToolkitAccessor(ToolkitAccessor ta) {
|
||||||
|
toolkitAccessor = ta;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the accessor object for the java.awt.Toolkit class.
|
||||||
|
*/
|
||||||
|
public static ToolkitAccessor getToolkitAccessor() {
|
||||||
|
if (toolkitAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(Toolkit.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
return toolkitAccessor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 7129133
|
||||||
|
* @summary [macosx] Accelerators are displayed as Meta instead of the Command symbol
|
||||||
|
* @author leonid.romanov@oracle.com
|
||||||
|
* @run main bug7129133
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class bug7129133 {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
|
||||||
|
System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolkit.getDefaultToolkit();
|
||||||
|
|
||||||
|
String cmdSymbol = "\u2318";
|
||||||
|
String val = Toolkit.getProperty("AWT.meta", "Meta");
|
||||||
|
|
||||||
|
if (!val.equals(cmdSymbol)) {
|
||||||
|
throw new Exception("Wrong property value for AWT.meta. Expected: " + cmdSymbol + ", actual: " + val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user