< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -317,11 +317,10 @@
     // NSFunctionKeyMask
     {0, 0, 0, 0, 0, 0}
 };
 
 static BOOL leftAltKeyPressed;
-static BOOL altGRPressed = NO;
 
 /*
  * Almost all unicode characters just go from NS to Java with no translation.
  *  For the few exceptions, we handle it here with this small table.
  */

@@ -565,23 +564,17 @@
     jint javaModifiers = 0;
     const struct _nsKeyToJavaModifier* cur;
 
     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;
-                    }
-                }
+            //This code will consider the mask value for left alt as well as
+            //right alt, but that should be ok, since right alt contains left alt
+            //mask value.
             javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask;
+            if (cur->nsMask == NSAlternateKeyMask && leftAltKeyPressed) {
+                    break; //since right alt key struct is defined last, break out of the loop                }
+            }
         }
     }
 
     return javaModifiers;
 }
< prev index next >