src/java.desktop/unix/classes/sun/awt/X11/XKeysym.java
changeset 52535 45a5c4d812d9
parent 52248 2e330da7cbf4
equal deleted inserted replaced
52534:356e75119d31 52535:45a5c4d812d9
     1 // This is a generated file: do not edit! Edit keysym2ucs.h if necessary.
       
     2 
       
     3 /*
     1 /*
     4  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
     5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6  *
     4  *
     7  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
    23  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    24  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    25  * questions.
    23  * questions.
    26  */
    24  */
    27 
    25 
       
    26 /*
       
    27  * This file was originally generated by a tool that embedded much of
       
    28  * an X11 keysym header file, keysym2ucs.h, turned into a Java program,
       
    29  * and which also consumed an UnicodeData.txt database file.
       
    30  * keysym2ucs.h and a genhash.awk script were checked in alongside this
       
    31  * source file. Maintaining the Java program to match updated versions
       
    32  * of keysym2ucs.h is too burdensome, since it is rarely, needed and any
       
    33  * updates will be minimal, so they have been removed and
       
    34  * this file can now be hand maintained. If it ever becomes necessary
       
    35  * to re-generate it, then the deleted files can be recovered from
       
    36  * the history.
       
    37  */
       
    38 
    28 package sun.awt.X11;
    39 package sun.awt.X11;
    29 import java.util.Hashtable;
    40 import java.util.Hashtable;
    30 import jdk.internal.misc.Unsafe;
    41 import jdk.internal.misc.Unsafe;
    31 
    42 
    32 import sun.util.logging.PlatformLogger;
    43 import sun.util.logging.PlatformLogger;
    33 
    44 
    34 public class XKeysym {
    45 public class XKeysym {
    35 
       
    36     public static void main( String[] args ) {
       
    37        System.out.println( "Cyrillc zhe:"+convertKeysym(0x06d6, 0));
       
    38        System.out.println( "Arabic sheen:"+convertKeysym(0x05d4, 0));
       
    39        System.out.println( "Latin a breve:"+convertKeysym(0x01e3, 0));
       
    40        System.out.println( "Latin f:"+convertKeysym(0x066, 0));
       
    41        System.out.println( "Backspace:"+Integer.toHexString(convertKeysym(0xff08, 0)));
       
    42        System.out.println( "Ctrl+f:"+Integer.toHexString(convertKeysym(0x066, XConstants.ControlMask)));
       
    43     }
       
    44 
    46 
    45     private XKeysym() {}
    47     private XKeysym() {}
    46 
    48 
    47     static class Keysym2JavaKeycode  {
    49     static class Keysym2JavaKeycode  {
    48         int jkeycode;
    50         int jkeycode;
    69     static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
    71     static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
    70     static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
    72     static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
    71     static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
    73     static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
    72     static Keysym2JavaKeycode kanaLock = new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_KANA_LOCK,
    74     static Keysym2JavaKeycode kanaLock = new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_KANA_LOCK,
    73                                                                 java.awt.event.KeyEvent.KEY_LOCATION_STANDARD);
    75                                                                 java.awt.event.KeyEvent.KEY_LOCATION_STANDARD);
    74     private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XKeysym");
    76     private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.key.XKeysym");
    75     public static char convertKeysym( long ks, int state ) {
    77     public static char convertKeysym( long ks, int state ) {
    76 
    78 
    77         /* First check for Latin-1 characters (1:1 mapping) */
    79         /* First check for Latin-1 characters (1:1 mapping) */
    78         if ((ks >= 0x0020 && ks <= 0x007e) ||
    80         if ((ks >= 0x0020 && ks <= 0x007e) ||
    79             (ks >= 0x00a0 && ks <= 0x00ff)) {
    81             (ks >= 0x00a0 && ks <= 0x00ff)) {