提交 ea2580ba 编写于 作者: K kizune

7144063: [macosx] Swing JMenu mnemonic doesn't work; hint misleading; cross symbol typed

Reviewed-by: leonidr, skovatch, swingler
上级 58f491ae
...@@ -812,7 +812,7 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod"); ...@@ -812,7 +812,7 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
// Unicode value. // Unicode value.
NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 2)) { if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) {
JNIEnv *env = [ThreadUtilities getJNIEnv]; JNIEnv *env = [ThreadUtilities getJNIEnv];
static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V"); static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");
......
...@@ -31,33 +31,31 @@ ...@@ -31,33 +31,31 @@
#import <JavaRuntimeSupport/JavaRuntimeSupport.h> #import <JavaRuntimeSupport/JavaRuntimeSupport.h>
// returns 10.7 for Lion, 10.6 for SnowLeopard etc. // returns 107 for Lion, 106 for SnowLeopard etc.
double getOSXMajorVersion() { int getOSXMajorVersion() {
char *version = JRSCopyOSVersion(); char *ver = JRSCopyOSVersion();
if (ver == NULL) {
return 0;
}
if (version == NULL) return 0.0; int len = strlen(ver);
int v = 0;
char temp[32]; // Third char must be a '.'
strlcpy(temp, version, sizeof(temp)); if (len >= 3 && ver[2] == '.') {
free(version); int i;
if (strlen(temp) < 3) { v = (ver[0] - '0') * 10 + (ver[1] - '0');
return 0.0; for (i = 3; i < len && isdigit(ver[i]); ++i) {
v = v * 10 + (ver[i] - '0');
} }
if (temp[2] != '.') { // Third char must be a '.'
return 0.0;
} }
char *ptr = strchr(temp+3, '.'); // remove the second . if one exists. free(ver);
if (ptr != NULL) {
*ptr = 0;
}
return atof(temp); return v;
} }
BOOL isSnowLeopardOrLower() { BOOL isSnowLeopardOrLower() {
return (getOSXMajorVersion() < 10.7); return (getOSXMajorVersion() < 107);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册