--- old/src/macosx/classes/sun/awt/CGraphicsDevice.java 2012-07-17 18:24:06.000000000 +0400 +++ new/src/macosx/classes/sun/awt/CGraphicsDevice.java 2012-07-17 18:24:06.000000000 +0400 @@ -48,6 +48,9 @@ private static AWTPermission fullScreenExclusivePermission; + // Save/restore DisplayMode for the Full Screen mode + private DisplayMode originalMode; + public CGraphicsDevice(int displayID) { this.displayID = displayID; configs = new GraphicsConfiguration[] { @@ -124,18 +127,26 @@ } boolean fsSupported = isFullScreenSupported(); + boolean dcSupported = isDisplayChangeSupported(); + if (fsSupported && old != null) { // enter windowed mode (and restore original display mode) exitFullScreenExclusive(old); - - // TODO: restore display mode + if (originalMode != null) { + if (dcSupported) { + setDisplayMode(originalMode); + } + originalMode = null; + } } + super.setFullScreenWindow(w); if (fsSupported && w != null) { - // TODO: save current display mode - + if (dcSupported) { + originalMode = getDisplayMode(); + } // enter fullscreen mode enterFullScreenExclusive(w); } --- old/src/macosx/native/sun/awt/CGraphicsDevice.m 2012-07-17 18:24:08.000000000 +0400 +++ new/src/macosx/native/sun/awt/CGraphicsDevice.m 2012-07-17 18:24:07.000000000 +0400 @@ -68,6 +68,11 @@ // One of the key parameters does not match continue; } + + if (refrate == 0) { // REFRESH_RATE_UNKNOWN + return cRef; + } + // Refresh rate might be 0 in display mode and we ask for specific display rate // but if we do not find exact match then 0 refresh rate might be just Ok if (CGDisplayModeGetRefreshRate(cRef) == refrate) {