7145508: java.awt.GraphicsDevice.get/setDisplayMode behavior is incorrect when no display is present
authorprr
Mon, 20 Apr 2015 10:39:30 -0700
changeset 30473 e1314bc8c877
parent 30472 8ca94620c290
child 30474 afc246c255e1
7145508: java.awt.GraphicsDevice.get/setDisplayMode behavior is incorrect when no display is present Reviewed-by: serb, bae
jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Sun Apr 19 10:31:06 2015 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Mon Apr 20 10:39:30 2015 -0700
@@ -380,7 +380,11 @@
     @Override
     public synchronized DisplayMode getDisplayMode() {
         if (isFullScreenSupported()) {
-            return getCurrentDisplayMode(screen);
+            DisplayMode mode = getCurrentDisplayMode(screen);
+            if (mode == null) {
+                mode = getDefaultDisplayMode();
+            }
+            return mode;
         } else {
             if (origDisplayMode == null) {
                 origDisplayMode = getDefaultDisplayMode();