changeset 4676:5780795f381e

7134826: [macosx] KeyEvent difference between Apple 1.6 and openjdk Reviewed-by: anthony, alexp
author leonidr
date Fri, 27 Jan 2012 21:59:22 +0300
parents c28e318653c6
children 5599aa5a4a51
files src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java src/macosx/native/sun/awt/AWTView.m
diffstat 2 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Fri Jan 27 16:02:35 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Fri Jan 27 21:59:22 2012 +0300
@@ -100,7 +100,7 @@
     /*
      * Handles key events.
      */
-    public void handleKeyEvent(int eventType, int modifierFlags, String charsIgnoringMods,
+    public void handleKeyEvent(int eventType, int modifierFlags, String chars,
                                short keyCode)
     {
         boolean isFlagsChangedEvent =
@@ -125,8 +125,8 @@
             jkeyLocation = out[1];
             jeventType = out[2];
         } else {
-            if (charsIgnoringMods != null && charsIgnoringMods.length() > 0) {
-                testChar = charsIgnoringMods.charAt(0);
+            if (chars != null && chars.length() > 0) {
+                testChar = chars.charAt(0);
             }
 
             int[] in = new int[] {testChar, testDeadChar, modifierFlags, keyCode};
@@ -156,13 +156,8 @@
         // for clipboard related shortcuts like Meta + [CVX]
         boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0;
         if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) {
-            boolean isCtrlDown = (jmodifiers & KeyEvent.CTRL_DOWN_MASK) != 0;
-            boolean isShiftDown = (jmodifiers & KeyEvent.SHIFT_DOWN_MASK) != 0;
-
-            // emulating the codes from the ASCII table
-            int shift = isCtrlDown ? isShiftDown ? 64 : 96 : 0;
             peer.dispatchKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
-                                  KeyEvent.VK_UNDEFINED, (char) (testChar - shift),
+                                  KeyEvent.VK_UNDEFINED, testChar,
                                   KeyEvent.KEY_LOCATION_UNKNOWN);
         }
     }
--- a/src/macosx/native/sun/awt/AWTView.m	Fri Jan 27 16:02:35 2012 +0400
+++ b/src/macosx/native/sun/awt/AWTView.m	Fri Jan 27 21:59:22 2012 +0300
@@ -381,9 +381,9 @@
     [AWTToolkit eventCountPlusPlus];
     JNIEnv *env = [ThreadUtilities getJNIEnv];
 
-    jstring charactersIgnoringModifiers = NULL;
+    jstring characters = NULL;
     if ([event type] != NSFlagsChanged) {
-        charactersIgnoringModifiers = JNFNSToJavaString(env, [event charactersIgnoringModifiers]);    
+        characters = JNFNSToJavaString(env, [event characters]);    
     }
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
@@ -392,15 +392,15 @@
                                   [event type],
                                   [event modifierFlags],
                                   [event keyCode],
-                                  charactersIgnoringModifiers);
+                                  characters);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
                             "deliverKeyEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
     
-    if (charactersIgnoringModifiers != NULL) {
-        (*env)->DeleteLocalRef(env, charactersIgnoringModifiers);
+    if (characters != NULL) {
+        (*env)->DeleteLocalRef(env, characters);
     }
 }