jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
changeset 3088 b0260407a050
parent 3084 67ca55732362
child 3728 d4b5b18ac3eb
child 3928 be186a33df9b
child 4191 ca8d3ef845c8
equal deleted inserted replaced
3087:e5f156d403ad 3088:b0260407a050
  2128     /**
  2128     /**
  2129      * One of XConstants: NotUseful, WhenMapped or Always.
  2129      * One of XConstants: NotUseful, WhenMapped or Always.
  2130      */
  2130      */
  2131     private static int backingStoreType;
  2131     private static int backingStoreType;
  2132 
  2132 
  2133     static boolean awt_ServerInquired = false;
  2133     static final int XSUN_KP_BEHAVIOR = 1;
  2134     static boolean awt_IsXsunServer    = false;
  2134     static final int XORG_KP_BEHAVIOR = 2;
       
  2135 
       
  2136     static int     awt_IsXsunKPBehavior = 0;
  2135     static boolean awt_UseXKB         = false;
  2137     static boolean awt_UseXKB         = false;
  2136     static boolean awt_UseXKB_Calls   = false;
  2138     static boolean awt_UseXKB_Calls   = false;
  2137     static int     awt_XKBBaseEventCode = 0;
  2139     static int     awt_XKBBaseEventCode = 0;
  2138     static int     awt_XKBEffectiveGroup = 0; // so far, I don't use it leaving all calculations
  2140     static int     awt_XKBEffectiveGroup = 0; // so far, I don't use it leaving all calculations
  2139                                               // to XkbTranslateKeyCode
  2141                                               // to XkbTranslateKeyCode
  2140     static long    awt_XKBDescPtr     = 0;
  2142     static long    awt_XKBDescPtr     = 0;
       
  2143 
  2141     /**
  2144     /**
  2142        Try to understand if it is Xsun server.
  2145      * Check for Xsun convention regarding numpad keys.
  2143        By now (2005) Sun is vendor of Xsun and Xorg servers; we only return true if Xsun is running.
  2146      * Xsun and some other servers (i.e. derived from Xsun)
  2144     */
  2147      * under certain conditions process numpad keys unlike Xorg.
  2145     static boolean isXsunServer() {
  2148      */
  2146         awtLock();
  2149     static boolean isXsunKPBehavior() {
  2147         try {
  2150         awtLock();
  2148             if( awt_ServerInquired ) {
  2151         try {
  2149                 return awt_IsXsunServer;
  2152             if( awt_IsXsunKPBehavior == 0 ) {
  2150             }
  2153                 if( XlibWrapper.IsXsunKPBehavior(getDisplay()) ) {
  2151             if( ! XlibWrapper.ServerVendor(getDisplay()).startsWith("Sun Microsystems") ) {
  2154                     awt_IsXsunKPBehavior = XSUN_KP_BEHAVIOR;
  2152                 awt_ServerInquired = true;
  2155                 }else{
  2153                 awt_IsXsunServer = false;
  2156                     awt_IsXsunKPBehavior = XORG_KP_BEHAVIOR;
  2154                 return false;
  2157                 }
  2155             }
  2158             }
  2156             // Now, it's Sun. It still may be Xorg though, eg on Solaris 10, x86.
  2159             return awt_IsXsunKPBehavior == XSUN_KP_BEHAVIOR ? true : false;
  2157             // Today (2005), VendorRelease of Xorg is a Big Number unlike Xsun.
       
  2158             if( XlibWrapper.VendorRelease(getDisplay()) > 10000 ) {
       
  2159                 awt_ServerInquired = true;
       
  2160                 awt_IsXsunServer = false;
       
  2161                 return false;
       
  2162             }
       
  2163             awt_ServerInquired = true;
       
  2164             awt_IsXsunServer = true;
       
  2165             return true;
       
  2166         } finally {
  2160         } finally {
  2167             awtUnlock();
  2161             awtUnlock();
  2168         }
  2162         }
  2169     }
  2163     }
  2170     static boolean isXKBenabled() {
  2164     static boolean isXKBenabled() {