< prev index next >

src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java

Print this page




 312                     new AWTPermission("fullScreenExclusive");
 313             }
 314             try {
 315                 security.checkPermission(fullScreenExclusivePermission);
 316             } catch (SecurityException e) {
 317                 return false;
 318             }
 319         }
 320         return true;
 321     }
 322 
 323     /**
 324      * returns true unless we're not allowed to use fullscreen mode.
 325      */
 326     @Override
 327     public boolean isFullScreenSupported() {
 328         return isFSExclusiveModeAllowed();
 329     }
 330 
 331     @Override

 332     public synchronized void setFullScreenWindow(Window w) {
 333         Window old = getFullScreenWindow();
 334         if (w == old) {
 335             return;
 336         }
 337         if (!isFullScreenSupported()) {
 338             super.setFullScreenWindow(w);
 339             return;
 340         }
 341 
 342         // Enter windowed mode.
 343         if (old != null) {
 344             // restore the original display mode
 345             if (defaultDisplayMode != null) {
 346                 setDisplayMode(defaultDisplayMode);
 347                 // we set the default display mode to null here
 348                 // because the default mode could change during
 349                 // the life of the application (user can change it through
 350                 // the desktop properties dialog, for example), so
 351                 // we need to record it every time prior to


 387             peer.updateGC();
 388         }
 389     }
 390 
 391     // Entering and exiting full-screen mode are done within a
 392     // tree-lock and should never lock on any resources which are
 393     // required by other threads which may have them and may require
 394     // the tree-lock.
 395     // REMIND: in the future these methods may need to become protected so that
 396     // subclasses could override them and use appropriate api other than GDI
 397     // for implementing these functions.
 398     protected native void enterFullScreenExclusive(int screen, WindowPeer w);
 399     protected native void exitFullScreenExclusive(int screen, WindowPeer w);
 400 
 401     @Override
 402     public boolean isDisplayChangeSupported() {
 403         return (isFullScreenSupported() && getFullScreenWindow() != null);
 404     }
 405 
 406     @Override

 407     public synchronized void setDisplayMode(DisplayMode dm) {
 408         if (!isDisplayChangeSupported()) {
 409             super.setDisplayMode(dm);
 410             return;
 411         }
 412         if (dm == null || (dm = getMatchingDisplayMode(dm)) == null) {
 413             throw new IllegalArgumentException("Invalid display mode");
 414         }
 415         if (getDisplayMode().equals(dm)) {
 416             return;
 417         }
 418         Window w = getFullScreenWindow();
 419         if (w != null) {
 420             WWindowPeer peer = (WWindowPeer)w.getPeer();
 421             configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(),
 422                 dm.getBitDepth(), dm.getRefreshRate());
 423             // resize the fullscreen window to the dimensions of the new
 424             // display mode
 425             Rectangle screenBounds = getDefaultConfiguration().getBounds();
 426             w.setBounds(screenBounds.x, screenBounds.y,




 312                     new AWTPermission("fullScreenExclusive");
 313             }
 314             try {
 315                 security.checkPermission(fullScreenExclusivePermission);
 316             } catch (SecurityException e) {
 317                 return false;
 318             }
 319         }
 320         return true;
 321     }
 322 
 323     /**
 324      * returns true unless we're not allowed to use fullscreen mode.
 325      */
 326     @Override
 327     public boolean isFullScreenSupported() {
 328         return isFSExclusiveModeAllowed();
 329     }
 330 
 331     @Override
 332     @SuppressWarnings("deprecation")
 333     public synchronized void setFullScreenWindow(Window w) {
 334         Window old = getFullScreenWindow();
 335         if (w == old) {
 336             return;
 337         }
 338         if (!isFullScreenSupported()) {
 339             super.setFullScreenWindow(w);
 340             return;
 341         }
 342 
 343         // Enter windowed mode.
 344         if (old != null) {
 345             // restore the original display mode
 346             if (defaultDisplayMode != null) {
 347                 setDisplayMode(defaultDisplayMode);
 348                 // we set the default display mode to null here
 349                 // because the default mode could change during
 350                 // the life of the application (user can change it through
 351                 // the desktop properties dialog, for example), so
 352                 // we need to record it every time prior to


 388             peer.updateGC();
 389         }
 390     }
 391 
 392     // Entering and exiting full-screen mode are done within a
 393     // tree-lock and should never lock on any resources which are
 394     // required by other threads which may have them and may require
 395     // the tree-lock.
 396     // REMIND: in the future these methods may need to become protected so that
 397     // subclasses could override them and use appropriate api other than GDI
 398     // for implementing these functions.
 399     protected native void enterFullScreenExclusive(int screen, WindowPeer w);
 400     protected native void exitFullScreenExclusive(int screen, WindowPeer w);
 401 
 402     @Override
 403     public boolean isDisplayChangeSupported() {
 404         return (isFullScreenSupported() && getFullScreenWindow() != null);
 405     }
 406 
 407     @Override
 408     @SuppressWarnings("deprecation")
 409     public synchronized void setDisplayMode(DisplayMode dm) {
 410         if (!isDisplayChangeSupported()) {
 411             super.setDisplayMode(dm);
 412             return;
 413         }
 414         if (dm == null || (dm = getMatchingDisplayMode(dm)) == null) {
 415             throw new IllegalArgumentException("Invalid display mode");
 416         }
 417         if (getDisplayMode().equals(dm)) {
 418             return;
 419         }
 420         Window w = getFullScreenWindow();
 421         if (w != null) {
 422             WWindowPeer peer = (WWindowPeer)w.getPeer();
 423             configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(),
 424                 dm.getBitDepth(), dm.getRefreshRate());
 425             // resize the fullscreen window to the dimensions of the new
 426             // display mode
 427             Rectangle screenBounds = getDefaultConfiguration().getBounds();
 428             w.setBounds(screenBounds.x, screenBounds.y,


< prev index next >