8156460: [macosx] Test case javax/swing/JPopupMenu/6827786/bug6827786.java fails
8160144: [macosx] The menuitem in the menu of the "Test Frame" can't work correctly 8160145: [macosx] Keep pressed the Alt, Shift & Ctrl Keys,and then Click 'ClickMe' button,the case failed automatically 8158621: The ALT key can not work with any key 8158485: The "File" menu's menuitems can not bring up information window or modal quit Dialog 8158501: [macosx] The checkbox can't be checked via an event generate on the menu 8158389: [macosx] Regression: javax/swing/JMenu/4213634/bug4213634.java 8158526: [macosx] java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java fails (invalid extended modifier info) 8158496: [macosx] Swing mnemonics broken on Mac 8158362: [macosx] Regression: at least java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java fails 8158512: [Regression] Test java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java fails 8158377: [macosx] Regression: java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest Reviewed-by: alexsch, ssadetsky, aniyogi
This commit is contained in:
parent
a2168558c1
commit
0d7becfcb7
@ -277,6 +277,16 @@ const nsKeyToJavaModifierTable[] =
|
||||
java_awt_event_InputEvent_CTRL_MASK,
|
||||
java_awt_event_KeyEvent_VK_CONTROL
|
||||
},
|
||||
{
|
||||
NSCommandKeyMask,
|
||||
//kCGSFlagsMaskAppleLeftCommandKey,
|
||||
//kCGSFlagsMaskAppleRightCommandKey,
|
||||
55,
|
||||
54,
|
||||
java_awt_event_InputEvent_META_DOWN_MASK,
|
||||
java_awt_event_InputEvent_META_MASK,
|
||||
java_awt_event_KeyEvent_VK_META
|
||||
},
|
||||
{
|
||||
NSAlternateKeyMask,
|
||||
//kCGSFlagsMaskAppleLeftAlternateKey,
|
||||
@ -295,16 +305,6 @@ const nsKeyToJavaModifierTable[] =
|
||||
java_awt_event_InputEvent_ALT_MASK | java_awt_event_InputEvent_ALT_GRAPH_MASK,
|
||||
java_awt_event_KeyEvent_VK_ALT | java_awt_event_KeyEvent_VK_ALT_GRAPH
|
||||
},
|
||||
{
|
||||
NSCommandKeyMask,
|
||||
//kCGSFlagsMaskAppleLeftCommandKey,
|
||||
//kCGSFlagsMaskAppleRightCommandKey,
|
||||
55,
|
||||
54,
|
||||
java_awt_event_InputEvent_META_DOWN_MASK,
|
||||
java_awt_event_InputEvent_META_MASK,
|
||||
java_awt_event_KeyEvent_VK_META
|
||||
},
|
||||
// NSNumericPadKeyMask
|
||||
{
|
||||
NSHelpKeyMask,
|
||||
@ -319,6 +319,7 @@ const nsKeyToJavaModifierTable[] =
|
||||
};
|
||||
|
||||
static BOOL leftAltKeyPressed;
|
||||
static BOOL altGRPressed = NO;
|
||||
|
||||
/*
|
||||
* Almost all unicode characters just go from NS to Java with no translation.
|
||||
@ -559,20 +560,28 @@ NsKeyModifiersToJavaKeyInfo(NSUInteger nsFlags, unsigned short eventKeyCode,
|
||||
*/
|
||||
jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods)
|
||||
{
|
||||
jint javaModifiers = 0;
|
||||
const struct _nsKeyToJavaModifier* cur;
|
||||
jint javaModifiers = 0;
|
||||
const struct _nsKeyToJavaModifier* cur;
|
||||
|
||||
for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
|
||||
if ((cur->nsMask & nsFlags) != 0) {
|
||||
javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask;
|
||||
if (cur->nsMask == NSAlternateKeyMask && leftAltKeyPressed == NO) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
|
||||
if ((cur->nsMask & nsFlags) != 0) {
|
||||
|
||||
if (cur->nsMask == NSAlternateKeyMask) {
|
||||
if (leftAltKeyPressed == YES) {
|
||||
javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask;
|
||||
if (altGRPressed == NO)
|
||||
break;
|
||||
} else {
|
||||
leftAltKeyPressed = YES;
|
||||
altGRPressed = YES;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask;
|
||||
}
|
||||
}
|
||||
|
||||
return javaModifiers;
|
||||
return javaModifiers;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -261,27 +261,10 @@ Java_sun_lwawt_macosx_CRobot_keyEvent
|
||||
{
|
||||
CGKeyCode keyCode = GetCGKeyCode(javaKeyCode);
|
||||
|
||||
if ((javaKeyCode >= java_awt_event_KeyEvent_VK_0) &&
|
||||
(javaKeyCode <= java_awt_event_KeyEvent_VK_9))
|
||||
{
|
||||
AXUIElementRef elem = AXUIElementCreateSystemWide();
|
||||
AXUIElementPostKeyboardEvent(elem, (CGCharCode)0, keyCode, keyPressed);
|
||||
CFRelease(elem);
|
||||
} else {
|
||||
/*
|
||||
* JDK-8155740: AXUIElementPostKeyboardEvent posts correct key codes for
|
||||
* number keys whereas CGEventPost posts Numpad keys for corresponding
|
||||
* number key. Hence AXUIElementPostKeyboardEvent is used for posting
|
||||
* numbers and CGEventCreateKeyboardEvent/CGEventPost is used for other
|
||||
* keys.
|
||||
* Key code for modifier key is required to distinguish between ALT and
|
||||
* ALT-GR key for fixing issue 8155740.
|
||||
*/
|
||||
CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGSessionEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGSessionEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user