7142565: [macosx] Many special keys processed twice in text fields
authorant
Thu, 17 May 2012 21:27:19 +0400
changeset 12659 fa378682b3cb
parent 12658 4eaff9680674
child 12660 76c54631149e
7142565: [macosx] Many special keys processed twice in text fields Summary: forward port from 7u4 Reviewed-by: anthony
jdk/src/macosx/native/sun/awt/AWTView.m
--- 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];