--- old/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java 2016-03-16 16:06:35.000000000 +0400 +++ new/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java 2016-03-16 16:06:35.000000000 +0400 @@ -32,7 +32,7 @@ import java.awt.Insets; import java.awt.Window; import java.util.Objects; - +import sun.java2d.SunGraphicsEnvironment; import sun.java2d.opengl.CGLGraphicsConfig; public final class CGraphicsDevice extends GraphicsDevice @@ -140,7 +140,7 @@ public void displayChanged() { xResolution = nativeGetXResolution(displayID); yResolution = nativeGetYResolution(displayID); - scale = (int) nativeGetScaleFactor(displayID); + initScaleFactor(); //TODO configs/fullscreenWindow/modes? } @@ -248,6 +248,17 @@ public DisplayMode[] getDisplayModes() { return nativeGetDisplayModes(displayID); } + + private void initScaleFactor() { + if (SunGraphicsEnvironment.isUIScaleEnabled()) { + double debugScale = SunGraphicsEnvironment.getDebugScale(); + scale = (int) (debugScale >= 1 + ? Math.round(debugScale) + : nativeGetScaleFactor(displayID)); + } else { + scale = 1; + } + } private static native double nativeGetScaleFactor(int displayID);