jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
changeset 28084 441853c190f4
parent 26353 b5e3b7fbf56d
child 28231 b608ffcaed74
equal deleted inserted replaced
28083:91a04df877cc 28084:441853c190f4
   101 
   101 
   102     static int arrowCursor;
   102     static int arrowCursor;
   103     static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
   103     static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
   104     static HashMap<Object, Object> specialPeerMap = new HashMap<>();
   104     static HashMap<Object, Object> specialPeerMap = new HashMap<>();
   105     static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
   105     static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
   106     private static long _display;
       
   107     static UIDefaults uidefaults;
   106     static UIDefaults uidefaults;
   108     static X11GraphicsEnvironment localEnv;
   107     static final X11GraphicsEnvironment localEnv;
   109     static X11GraphicsDevice device;
   108     private static final X11GraphicsDevice device;
   110     static final X11GraphicsConfig config;
   109     private static final X11GraphicsConfig config;
       
   110     private static final long display;
   111     static int awt_multiclick_time;
   111     static int awt_multiclick_time;
   112     static boolean securityWarningEnabled;
   112     static boolean securityWarningEnabled;
   113 
   113 
   114     private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
   114     private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
   115     static long awt_defaultFg; // Pixel
   115     static long awt_defaultFg; // Pixel
   116     private static XMouseInfoPeer xPeer;
   116     private static XMouseInfoPeer xPeer;
   117 
   117 
   118     static {
   118     static {
   119         initSecurityWarning();
   119         initSecurityWarning();
   120         if (GraphicsEnvironment.isHeadless()) {
   120         if (GraphicsEnvironment.isHeadless()) {
       
   121             localEnv = null;
       
   122             device = null;
   121             config = null;
   123             config = null;
       
   124             display = 0;
   122         } else {
   125         } else {
   123             localEnv = (X11GraphicsEnvironment) GraphicsEnvironment
   126             localEnv = (X11GraphicsEnvironment) GraphicsEnvironment
   124                 .getLocalGraphicsEnvironment();
   127                 .getLocalGraphicsEnvironment();
   125             device = (X11GraphicsDevice) localEnv.getDefaultScreenDevice();
   128             device = (X11GraphicsDevice) localEnv.getDefaultScreenDevice();
   126             config = (X11GraphicsConfig) (device.getDefaultConfiguration());
   129             config = (X11GraphicsConfig) device.getDefaultConfiguration();
   127             if (device != null) {
   130             display = device.getDisplay();
   128                 _display = device.getDisplay();
       
   129             }
       
   130             setupModifierMap();
   131             setupModifierMap();
   131             initIDs();
   132             initIDs();
   132             setBackingStoreType();
   133             setBackingStoreType();
   133         }
   134         }
   134     }
   135     }
   195         {
   196         {
   196             e.printStackTrace();
   197             e.printStackTrace();
   197         }
   198         }
   198     }
   199     }
   199 
   200 
   200     static Object displayLock = new Object();
   201     /**
   201 
   202      * Returns the X11 Display of the default screen device.
       
   203      *
       
   204      * @return X11 Display
       
   205      * @throws AWTError thrown if local GraphicsEnvironment is null, which
       
   206      *         means we are in the headless environment
       
   207      */
   202     public static long getDisplay() {
   208     public static long getDisplay() {
   203         return _display;
   209         if (localEnv == null) {
       
   210             throw new AWTError("Local GraphicsEnvironment must not be null");
       
   211         }
       
   212         return display;
   204     }
   213     }
   205 
   214 
   206     public static long getDefaultRootWindow() {
   215     public static long getDefaultRootWindow() {
   207         awtLock();
   216         awtLock();
   208         try {
   217         try {