JRE-907 macOS: add ability to check for scaled display mode
diff --git a/src/macosx/native/sun/awt/CGraphicsDevice.m b/src/macosx/native/sun/awt/CGraphicsDevice.m
index 8d315ed..6a22c65 100644
--- a/src/macosx/native/sun/awt/CGraphicsDevice.m
+++ b/src/macosx/native/sun/awt/CGraphicsDevice.m
@@ -139,9 +139,11 @@
     h = CGDisplayModeGetHeight(mode);
     w = CGDisplayModeGetWidth(mode);
     CFRelease(currentBPP);
+    uint32_t flags = CGDisplayModeGetIOFlags(mode);
+    BOOL isDisplayModeDefault = (flags & kDisplayModeDefaultFlag) ? YES : NO;
     static JNF_CLASS_CACHE(jc_DisplayMode, "java/awt/DisplayMode");
-    static JNF_CTOR_CACHE(jc_DisplayMode_ctor, jc_DisplayMode, "(IIII)V");
-    ret = JNFNewObject(env, jc_DisplayMode_ctor, w, h, bpp, refrate);
+    static JNF_CTOR_CACHE(jc_DisplayMode_ctor, jc_DisplayMode, "(IIIIZ)V");
+    ret = JNFNewObject(env, jc_DisplayMode_ctor, w, h, bpp, refrate, (jboolean)isDisplayModeDefault);
     JNF_COCOA_EXIT(env);
     return ret;
 }
diff --git a/src/share/classes/java/awt/DisplayMode.java b/src/share/classes/java/awt/DisplayMode.java
index 97886d6..e6e0e16 100644
--- a/src/share/classes/java/awt/DisplayMode.java
+++ b/src/share/classes/java/awt/DisplayMode.java
@@ -51,6 +51,7 @@
     private Dimension size;
     private int bitDepth;
     private int refreshRate;
+    private boolean isDefault;
 
     /**
      * Create a new display mode object with the supplied parameters.
@@ -71,6 +72,13 @@
         this.refreshRate = refreshRate;
     }
 
+    private DisplayMode(int width, int height, int bitDepth, int refreshRate, boolean isDefault) {
+        this.size = new Dimension(width, height);
+        this.bitDepth = bitDepth;
+        this.refreshRate = refreshRate;
+        this.isDefault = isDefault;
+    }
+
     /**
      * Returns the height of the display, in pixels.
      * @return the height of the display, in pixels
@@ -123,6 +131,10 @@
         return refreshRate;
     }
 
+    private boolean isDefault() {
+        return isDefault;
+    }
+
     /**
      * Returns whether the two display modes are equal.
      * @return whether the two display modes are equal