6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #import <JavaNativeFoundation/JavaNativeFoundation.h> 27 #import <JavaRuntimeSupport/JavaRuntimeSupport.h> 28 #import <sys/time.h> 29 #include <Carbon/Carbon.h> 30 31 #import "jni_util.h" 32 #import "LWCToolkit.h" 33 #import "ThreadUtilities.h" 34 35 #import "java_awt_event_InputEvent.h" 36 #import "java_awt_event_KeyEvent.h" 37 #import "java_awt_event_MouseEvent.h" 38 39 /* 40 * Table to map typed characters to their Java virtual key equivalent and back. 41 * We use the incoming unichar (ignoring all modifiers) and try to figure out 42 * which virtual key code is appropriate. A lot of them just have direct 43 * mappings (the function keys, arrow keys, etc.) so they aren't a problem. 44 * We had to do something a little funky to catch the keys on the numeric 45 * key pad (i.e. using event mask to distinguish between period on regular 46 * keyboard and decimal on keypad). We also have to do something incredibly 47 * hokey with regards to the shifted punctuation characters. For examples, 48 * consider '&' which is usually Shift-7. For the Java key typed events, 49 * that's no problem, we just say pass the unichar. But for the 50 * KeyPressed/Released events, we need to identify the virtual key code 51 * (which roughly correspond to hardware keys) which means we are supposed 52 * to say the virtual 7 key was pressed. But how are we supposed to know 53 * when we get a punctuation char what was the real hardware key was that 54 * was pressed? Although '&' often comes from Shift-7 the keyboard can be 55 * remapped! I don't think there really is a good answer, and hopefully 56 * all good applets are only interested in logical key typed events not 57 * press/release. Meanwhile, we are hard-coding the shifted punctuation | 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #import "java_awt_event_InputEvent.h" 27 #import "java_awt_event_KeyEvent.h" 28 #import "LWCToolkit.h" 29 30 #import "jni_util.h" 31 32 #import <JavaNativeFoundation/JavaNativeFoundation.h> 33 #import <sys/time.h> 34 #import <Carbon/Carbon.h> 35 36 /* 37 * Table to map typed characters to their Java virtual key equivalent and back. 38 * We use the incoming unichar (ignoring all modifiers) and try to figure out 39 * which virtual key code is appropriate. A lot of them just have direct 40 * mappings (the function keys, arrow keys, etc.) so they aren't a problem. 41 * We had to do something a little funky to catch the keys on the numeric 42 * key pad (i.e. using event mask to distinguish between period on regular 43 * keyboard and decimal on keypad). We also have to do something incredibly 44 * hokey with regards to the shifted punctuation characters. For examples, 45 * consider '&' which is usually Shift-7. For the Java key typed events, 46 * that's no problem, we just say pass the unichar. But for the 47 * KeyPressed/Released events, we need to identify the virtual key code 48 * (which roughly correspond to hardware keys) which means we are supposed 49 * to say the virtual 7 key was pressed. But how are we supposed to know 50 * when we get a punctuation char what was the real hardware key was that 51 * was pressed? Although '&' often comes from Shift-7 the keyboard can be 52 * remapped! I don't think there really is a good answer, and hopefully 53 * all good applets are only interested in logical key typed events not 54 * press/release. Meanwhile, we are hard-coding the shifted punctuation |