282 int width, int height, 283 int displayMode); 284 private static native void resetNativeData(int screen); 285 286 /** 287 * Returns true only if: 288 * - the Xrandr extension is present 289 * - the necessary Xrandr functions were loaded successfully 290 * - XINERAMA is not enabled 291 */ 292 private static synchronized boolean isXrandrExtensionSupported() { 293 if (xrandrExtSupported == null) { 294 xrandrExtSupported = 295 Boolean.valueOf(initXrandrExtension()); 296 } 297 return xrandrExtSupported.booleanValue(); 298 } 299 300 @Override 301 public boolean isFullScreenSupported() { 302 // REMIND: for now we will only allow fullscreen exclusive mode 303 // on the primary screen; we could change this behavior slightly 304 // in the future by allowing only one screen to be in fullscreen 305 // exclusive mode at any given time... 306 boolean fsAvailable = (screen == 0) && isXrandrExtensionSupported(); 307 if (fsAvailable) { 308 SecurityManager security = System.getSecurityManager(); 309 if (security != null) { 310 if (fullScreenExclusivePermission == null) { 311 fullScreenExclusivePermission = 312 new AWTPermission("fullScreenExclusive"); 313 } 314 try { 315 security.checkPermission(fullScreenExclusivePermission); 316 } catch (SecurityException e) { 317 return false; 318 } 319 } 320 } 321 return fsAvailable; 322 } 323 324 @Override 325 public boolean isDisplayChangeSupported() { 326 return (isFullScreenSupported() && (getFullScreenWindow() != null)); 327 } 328 329 private static void enterFullScreenExclusive(Window w) { 330 X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); 331 if (peer != null) { 332 enterFullScreenExclusive(peer.getContentWindow()); 333 peer.setFullScreenExclusiveModeState(true); 334 } 335 } 336 337 private static void exitFullScreenExclusive(Window w) { 338 X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); 339 if (peer != null) { 340 peer.setFullScreenExclusiveModeState(false); 341 exitFullScreenExclusive(peer.getContentWindow()); 342 } 343 } 344 345 @Override 346 public synchronized void setFullScreenWindow(Window w) { 347 Window old = getFullScreenWindow(); 348 if (w == old) { 349 return; 350 } 351 352 boolean fsSupported = isFullScreenSupported(); 353 if (fsSupported && old != null) { 354 // enter windowed mode (and restore original display mode) 355 exitFullScreenExclusive(old); 356 setDisplayMode(origDisplayMode); 357 } 358 359 super.setFullScreenWindow(w); 360 361 if (fsSupported && w != null) { | 282 int width, int height, 283 int displayMode); 284 private static native void resetNativeData(int screen); 285 286 /** 287 * Returns true only if: 288 * - the Xrandr extension is present 289 * - the necessary Xrandr functions were loaded successfully 290 * - XINERAMA is not enabled 291 */ 292 private static synchronized boolean isXrandrExtensionSupported() { 293 if (xrandrExtSupported == null) { 294 xrandrExtSupported = 295 Boolean.valueOf(initXrandrExtension()); 296 } 297 return xrandrExtSupported.booleanValue(); 298 } 299 300 @Override 301 public boolean isFullScreenSupported() { 302 boolean fsAvailable = isXrandrExtensionSupported(); 303 if (fsAvailable) { 304 SecurityManager security = System.getSecurityManager(); 305 if (security != null) { 306 if (fullScreenExclusivePermission == null) { 307 fullScreenExclusivePermission = 308 new AWTPermission("fullScreenExclusive"); 309 } 310 try { 311 security.checkPermission(fullScreenExclusivePermission); 312 } catch (SecurityException e) { 313 return false; 314 } 315 } 316 } 317 return fsAvailable; 318 } 319 320 @Override 321 public boolean isDisplayChangeSupported() { 322 return (isFullScreenSupported() && (getFullScreenWindow() != null)); 323 } 324 325 private static void enterFullScreenExclusive(Window w) { 326 X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); 327 if (peer != null) { 328 enterFullScreenExclusive(peer.getWindow()); 329 peer.setFullScreenExclusiveModeState(true); 330 } 331 } 332 333 private static void exitFullScreenExclusive(Window w) { 334 X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w); 335 if (peer != null) { 336 peer.setFullScreenExclusiveModeState(false); 337 exitFullScreenExclusive(peer.getWindow()); 338 } 339 } 340 341 @Override 342 public synchronized void setFullScreenWindow(Window w) { 343 Window old = getFullScreenWindow(); 344 if (w == old) { 345 return; 346 } 347 348 boolean fsSupported = isFullScreenSupported(); 349 if (fsSupported && old != null) { 350 // enter windowed mode (and restore original display mode) 351 exitFullScreenExclusive(old); 352 setDisplayMode(origDisplayMode); 353 } 354 355 super.setFullScreenWindow(w); 356 357 if (fsSupported && w != null) { |