changeset 11806:fb2369cdbd53

7145508: java.awt.GraphicsDevice.get/setDisplayMode behavior is incorrect when no display is present Reviewed-by: serb, bae
author prr
date Mon, 20 Apr 2015 10:39:30 -0700
parents a5c091b8bee9
children 6c320b2d9138
files src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Sun Apr 19 10:31:06 2015 +0300
+++ b/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();