79 /* 80 * Note: The MToolkit object depends on the static initializer 81 * of X11GraphicsEnvironment to initialize the connection to 82 * the X11 server. 83 */ 84 if (!isHeadless()) { 85 // first check the OGL system property 86 boolean glxRequested = false; 87 String prop = System.getProperty("sun.java2d.opengl"); 88 if (prop != null) { 89 if (prop.equals("true") || prop.equals("t")) { 90 glxRequested = true; 91 } else if (prop.equals("True") || prop.equals("T")) { 92 glxRequested = true; 93 glxVerbose = true; 94 } 95 } 96 97 // Now check for XRender system property 98 boolean xRenderRequested = true; 99 String xProp = System.getProperty("sun.java2d.xrender"); 100 if (xProp != null) { 101 if (xProp.equals("false") || xProp.equals("f")) { 102 xRenderRequested = false; 103 } else if (xProp.equals("True") || xProp.equals("T")) { 104 xRenderRequested = true; 105 xRenderVerbose = true; 106 } 107 } 108 109 // initialize the X11 display connection 110 initDisplay(glxRequested); 111 112 // only attempt to initialize GLX if it was requested 113 if (glxRequested) { 114 glxAvailable = initGLX(); 115 if (glxVerbose && !glxAvailable) { 116 System.out.println( 117 "Could not enable OpenGL " + 118 "pipeline (GLX 1.3 not available)"); 119 } 120 } 121 122 // only attempt to initialize Xrender if it was requested 123 if (xRenderRequested) { 124 xRenderAvailable = initXRender(xRenderVerbose); 125 if (xRenderVerbose && !xRenderAvailable) { 126 System.out.println( 127 "Could not enable XRender pipeline"); 128 } 129 } 130 131 if (xRenderAvailable) { 132 XRSurfaceData.initXRSurfaceData(); 133 } 134 } 135 136 return null; 137 } 138 }); 139 140 // Install the correct surface manager factory. 141 SurfaceManagerFactory.setInstance(new UnixSurfaceManagerFactory()); 142 143 } 144 145 146 private static boolean glxAvailable; 147 private static boolean glxVerbose; 148 149 private static native boolean initGLX(); 150 151 public static boolean isGLXAvailable() { 152 return glxAvailable; 153 } 154 155 public static boolean isGLXVerbose() { 156 return glxVerbose; 157 } 158 159 private static boolean xRenderVerbose; 160 private static boolean xRenderAvailable; 161 162 private static native boolean initXRender(boolean verbose); 163 public static boolean isXRenderAvailable() { 164 return xRenderAvailable; 165 } 166 167 public static boolean isXRenderVerbose() { 168 return xRenderVerbose; 169 } 170 171 /** 172 * Checks if Shared Memory extension can be used. 173 * Returns: 174 * -1 if server doesn't support MITShm 175 * 1 if server supports it and it can be used 176 * 0 otherwise 177 */ 178 private static native int checkShmExt(); 179 180 private static native String getDisplayString(); 181 private Boolean isDisplayLocal; 182 | 79 /* 80 * Note: The MToolkit object depends on the static initializer 81 * of X11GraphicsEnvironment to initialize the connection to 82 * the X11 server. 83 */ 84 if (!isHeadless()) { 85 // first check the OGL system property 86 boolean glxRequested = false; 87 String prop = System.getProperty("sun.java2d.opengl"); 88 if (prop != null) { 89 if (prop.equals("true") || prop.equals("t")) { 90 glxRequested = true; 91 } else if (prop.equals("True") || prop.equals("T")) { 92 glxRequested = true; 93 glxVerbose = true; 94 } 95 } 96 97 // Now check for XRender system property 98 boolean xRenderRequested = true; 99 boolean xRenderIgnoreLinuxVersion = false; 100 String xProp = System.getProperty("sun.java2d.xrender"); 101 if (xProp != null) { 102 if (xProp.equals("false") || xProp.equals("f")) { 103 xRenderRequested = false; 104 } else if (xProp.equals("True") || xProp.equals("T")) { 105 xRenderRequested = true; 106 xRenderVerbose = true; 107 } 108 109 if(xProp.equalsIgnoreCase("t") || xProp.equalsIgnoreCase("true")) { 110 xRenderIgnoreLinuxVersion = true; 111 } 112 } 113 114 // initialize the X11 display connection 115 initDisplay(glxRequested); 116 117 // only attempt to initialize GLX if it was requested 118 if (glxRequested) { 119 glxAvailable = initGLX(); 120 if (glxVerbose && !glxAvailable) { 121 System.out.println( 122 "Could not enable OpenGL " + 123 "pipeline (GLX 1.3 not available)"); 124 } 125 } 126 127 // only attempt to initialize Xrender if it was requested 128 if (xRenderRequested) { 129 xRenderAvailable = initXRender(xRenderVerbose, xRenderIgnoreLinuxVersion); 130 if (xRenderVerbose && !xRenderAvailable) { 131 System.out.println( 132 "Could not enable XRender pipeline"); 133 } 134 } 135 136 if (xRenderAvailable) { 137 XRSurfaceData.initXRSurfaceData(); 138 } 139 } 140 141 return null; 142 } 143 }); 144 145 // Install the correct surface manager factory. 146 SurfaceManagerFactory.setInstance(new UnixSurfaceManagerFactory()); 147 148 } 149 150 151 private static boolean glxAvailable; 152 private static boolean glxVerbose; 153 154 private static native boolean initGLX(); 155 156 public static boolean isGLXAvailable() { 157 return glxAvailable; 158 } 159 160 public static boolean isGLXVerbose() { 161 return glxVerbose; 162 } 163 164 private static boolean xRenderVerbose; 165 private static boolean xRenderAvailable; 166 167 private static native boolean initXRender(boolean verbose, boolean ignoreLinuxVersion); 168 public static boolean isXRenderAvailable() { 169 return xRenderAvailable; 170 } 171 172 public static boolean isXRenderVerbose() { 173 return xRenderVerbose; 174 } 175 176 /** 177 * Checks if Shared Memory extension can be used. 178 * Returns: 179 * -1 if server doesn't support MITShm 180 * 1 if server supports it and it can be used 181 * 0 otherwise 182 */ 183 private static native int checkShmExt(); 184 185 private static native String getDisplayString(); 186 private Boolean isDisplayLocal; 187 |