< prev index next >

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

Print this page

        

@@ -279,11 +279,11 @@
                                                 ArrayList<DisplayMode> modes);
     private static native void configDisplayMode(int screen,
                                                  int width, int height,
                                                  int displayMode);
     private static native void resetNativeData(int screen);
-    private static native int getNativeScaleFactor(int screen);
+    private static native double getNativeScaleFactor(int screen);
 
     /**
      * Returns true only if:
      *   - the Xrandr extension is present
      *   - the necessary Xrandr functions were loaded successfully

@@ -514,21 +514,25 @@
 
     public int getScaleFactor() {
         return scale;
     }
 
+    public int getNativeScale() {
+        isXrandrExtensionSupported();
+        return (int)Math.round(getNativeScaleFactor(screen));
+    }
+
     private int initScaleFactor() {
 
         if (SunGraphicsEnvironment.isUIScaleEnabled()) {
 
             double debugScale = SunGraphicsEnvironment.getDebugScale();
 
             if (debugScale >= 1) {
                 return (int) debugScale;
             }
-
-            int nativeScale = getNativeScaleFactor(screen);
+            int nativeScale = getNativeScale();
             return nativeScale >= 1 ? nativeScale : 1;
         }
 
         return 1;
     }
< prev index next >