7142565: [macosx] Many special keys processed twice in text fields
Summary: forward port from 7u4
Reviewed-by: anthony
--- a/jdk/src/macosx/native/sun/awt/AWTView.m Thu May 17 15:41:09 2012 +0400
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m Thu May 17 21:27:19 2012 +0400
@@ -48,7 +48,6 @@
//#define IM_DEBUG TRUE
//#define EXTRA_DEBUG
-
static BOOL shouldUsePressAndHold() {
static int shouldUsePressAndHold = -1;
if (shouldUsePressAndHold != -1) return shouldUsePressAndHold;
@@ -394,6 +393,13 @@
}
-(void) deliverJavaKeyEventHelper: (NSEvent *) event {
+ static id sUnretainedLastKeyEvent = nil;
+ if (event == sUnretainedLastKeyEvent) {
+ // The event is repeatedly delivered by keyDown: after performKeyEquivalent:
+ return;
+ }
+ sUnretainedLastKeyEvent = event;
+
[AWTToolkit eventCountPlusPlus];
JNIEnv *env = [ThreadUtilities getJNIEnv];