2157 }
2158
2159 @Override
2160 public boolean isAlwaysOnTopSupported() {
2161 for (XLayerProtocol proto : XWM.getWM().getProtocols(XLayerProtocol.class)) {
2162 if (proto.supportsLayer(XLayerProtocol.LAYER_ALWAYS_ON_TOP)) {
2163 return true;
2164 }
2165 }
2166 return false;
2167 }
2168
2169 @Override
2170 public boolean useBufferPerWindow() {
2171 return XToolkit.getBackingStoreType() == XConstants.NotUseful;
2172 }
2173
2174 /**
2175 * Returns one of XConstants: NotUseful, WhenMapped or Always.
2176 * If backing store is not available on at least one screen, or
2177 * java2d uses DGA(which conflicts with backing store) on at least one screen,
2178 * or the string system property "sun.awt.backingStore" is neither "Always"
2179 * nor "WhenMapped", then the method returns XConstants.NotUseful.
2180 * Otherwise, if the system property "sun.awt.backingStore" is "WhenMapped",
2181 * then the method returns XConstants.WhenMapped.
2182 * Otherwise (i.e., if the system property "sun.awt.backingStore" is "Always"),
2183 * the method returns XConstants.Always.
2184 */
2185 static int getBackingStoreType() {
2186 return backingStoreType;
2187 }
2188
2189 private static void setBackingStoreType() {
2190 String prop = AccessController.doPrivileged(
2191 new sun.security.action.GetPropertyAction("sun.awt.backingStore"));
2192
2193 if (prop == null) {
2194 backingStoreType = XConstants.NotUseful;
2195 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2196 backingStoreLog.config("The system property sun.awt.backingStore is not set" +
2197 ", by default backingStore=NotUseful");
2199 return;
2200 }
2201
2202 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2203 backingStoreLog.config("The system property sun.awt.backingStore is " + prop);
2204 }
2205 prop = prop.toLowerCase();
2206 if (prop.equals("always")) {
2207 backingStoreType = XConstants.Always;
2208 } else if (prop.equals("whenmapped")) {
2209 backingStoreType = XConstants.WhenMapped;
2210 } else {
2211 backingStoreType = XConstants.NotUseful;
2212 }
2213
2214 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2215 backingStoreLog.config("backingStore(as provided by the system property)=" +
2216 ( backingStoreType == XConstants.NotUseful ? "NotUseful"
2217 : backingStoreType == XConstants.WhenMapped ?
2218 "WhenMapped" : "Always") );
2219 }
2220
2221 if (sun.java2d.x11.X11SurfaceData.isDgaAvailable()) {
2222 backingStoreType = XConstants.NotUseful;
2223
2224 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2225 backingStoreLog.config("DGA is available, backingStore=NotUseful");
2226 }
2227
2228 return;
2229 }
2230
2231 awtLock();
2232 try {
2233 int screenCount = XlibWrapper.ScreenCount(getDisplay());
2234 for (int i = 0; i < screenCount; i++) {
2235 if (XlibWrapper.DoesBackingStore(XlibWrapper.ScreenOfDisplay(getDisplay(), i))
2236 == XConstants.NotUseful) {
2237 backingStoreType = XConstants.NotUseful;
2238
2239 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2240 backingStoreLog.config("Backing store is not available on the screen " +
2241 i + ", backingStore=NotUseful");
2242 }
2243
2244 return;
2245 }
2246 }
2247 } finally {
2248 awtUnlock();
|
2157 }
2158
2159 @Override
2160 public boolean isAlwaysOnTopSupported() {
2161 for (XLayerProtocol proto : XWM.getWM().getProtocols(XLayerProtocol.class)) {
2162 if (proto.supportsLayer(XLayerProtocol.LAYER_ALWAYS_ON_TOP)) {
2163 return true;
2164 }
2165 }
2166 return false;
2167 }
2168
2169 @Override
2170 public boolean useBufferPerWindow() {
2171 return XToolkit.getBackingStoreType() == XConstants.NotUseful;
2172 }
2173
2174 /**
2175 * Returns one of XConstants: NotUseful, WhenMapped or Always.
2176 * If backing store is not available on at least one screen, or
2177 * or the string system property "sun.awt.backingStore" is neither "Always"
2178 * nor "WhenMapped", then the method returns XConstants.NotUseful.
2179 * Otherwise, if the system property "sun.awt.backingStore" is "WhenMapped",
2180 * then the method returns XConstants.WhenMapped.
2181 * Otherwise (i.e., if the system property "sun.awt.backingStore" is "Always"),
2182 * the method returns XConstants.Always.
2183 */
2184 static int getBackingStoreType() {
2185 return backingStoreType;
2186 }
2187
2188 private static void setBackingStoreType() {
2189 String prop = AccessController.doPrivileged(
2190 new sun.security.action.GetPropertyAction("sun.awt.backingStore"));
2191
2192 if (prop == null) {
2193 backingStoreType = XConstants.NotUseful;
2194 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2195 backingStoreLog.config("The system property sun.awt.backingStore is not set" +
2196 ", by default backingStore=NotUseful");
2198 return;
2199 }
2200
2201 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2202 backingStoreLog.config("The system property sun.awt.backingStore is " + prop);
2203 }
2204 prop = prop.toLowerCase();
2205 if (prop.equals("always")) {
2206 backingStoreType = XConstants.Always;
2207 } else if (prop.equals("whenmapped")) {
2208 backingStoreType = XConstants.WhenMapped;
2209 } else {
2210 backingStoreType = XConstants.NotUseful;
2211 }
2212
2213 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2214 backingStoreLog.config("backingStore(as provided by the system property)=" +
2215 ( backingStoreType == XConstants.NotUseful ? "NotUseful"
2216 : backingStoreType == XConstants.WhenMapped ?
2217 "WhenMapped" : "Always") );
2218 }
2219
2220 awtLock();
2221 try {
2222 int screenCount = XlibWrapper.ScreenCount(getDisplay());
2223 for (int i = 0; i < screenCount; i++) {
2224 if (XlibWrapper.DoesBackingStore(XlibWrapper.ScreenOfDisplay(getDisplay(), i))
2225 == XConstants.NotUseful) {
2226 backingStoreType = XConstants.NotUseful;
2227
2228 if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
2229 backingStoreLog.config("Backing store is not available on the screen " +
2230 i + ", backingStore=NotUseful");
2231 }
2232
2233 return;
2234 }
2235 }
2236 } finally {
2237 awtUnlock();
|