< prev index next >

src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java

Print this page




 439                             setDisplayMode(origDisplayMode);
 440                         }
 441                     }
 442                 };
 443                 String name = "Display-Change-Shutdown-Thread-" + screen;
 444                 Thread t = new Thread(
 445                       ThreadGroupUtils.getRootThreadGroup(), r, name, 0, false);
 446                 t.setContextClassLoader(null);
 447                 Runtime.getRuntime().addShutdownHook(t);
 448                 return null;
 449             };
 450             AccessController.doPrivileged(a);
 451         }
 452 
 453         // switch to the new DisplayMode
 454         configDisplayMode(screen,
 455                           dm.getWidth(), dm.getHeight(),
 456                           dm.getRefreshRate());
 457 
 458         // update bounds of the fullscreen window
 459         w.setBounds(0, 0, dm.getWidth(), dm.getHeight());

 460 
 461         // configDisplayMode() is synchronous, so the display change will be
 462         // complete by the time we get here (and it is therefore safe to call
 463         // displayChanged() now)
 464         ((X11GraphicsEnvironment)
 465          GraphicsEnvironment.getLocalGraphicsEnvironment()).displayChanged();
 466     }
 467 
 468     private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) {
 469         if (!isDisplayChangeSupported()) {
 470             return null;
 471         }
 472         DisplayMode[] modes = getDisplayModes();
 473         for (DisplayMode mode : modes) {
 474             if (dm.equals(mode) ||
 475                 (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN &&
 476                  dm.getWidth() == mode.getWidth() &&
 477                  dm.getHeight() == mode.getHeight() &&
 478                  dm.getBitDepth() == mode.getBitDepth()))
 479             {




 439                             setDisplayMode(origDisplayMode);
 440                         }
 441                     }
 442                 };
 443                 String name = "Display-Change-Shutdown-Thread-" + screen;
 444                 Thread t = new Thread(
 445                       ThreadGroupUtils.getRootThreadGroup(), r, name, 0, false);
 446                 t.setContextClassLoader(null);
 447                 Runtime.getRuntime().addShutdownHook(t);
 448                 return null;
 449             };
 450             AccessController.doPrivileged(a);
 451         }
 452 
 453         // switch to the new DisplayMode
 454         configDisplayMode(screen,
 455                           dm.getWidth(), dm.getHeight(),
 456                           dm.getRefreshRate());
 457 
 458         // update bounds of the fullscreen window
 459         w.setBounds(0, 0, dm.getWidth()/getScaleFactor(),
 460                                                dm.getHeight()/getScaleFactor());
 461 
 462         // configDisplayMode() is synchronous, so the display change will be
 463         // complete by the time we get here (and it is therefore safe to call
 464         // displayChanged() now)
 465         ((X11GraphicsEnvironment)
 466          GraphicsEnvironment.getLocalGraphicsEnvironment()).displayChanged();
 467     }
 468 
 469     private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) {
 470         if (!isDisplayChangeSupported()) {
 471             return null;
 472         }
 473         DisplayMode[] modes = getDisplayModes();
 474         for (DisplayMode mode : modes) {
 475             if (dm.equals(mode) ||
 476                 (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN &&
 477                  dm.getWidth() == mode.getWidth() &&
 478                  dm.getHeight() == mode.getHeight() &&
 479                  dm.getBitDepth() == mode.getBitDepth()))
 480             {


< prev index next >