changeset 5396:ba7fae92732e

7181027: [macosx] Unable to use headless mode Reviewed-by: anthony
author leonidr
date Tue, 17 Jul 2012 01:59:14 +0400
parents 3aa687530ca9
children 122ea6020d26
files src/share/classes/java/awt/GraphicsEnvironment.java src/solaris/native/java/lang/java_props_md.c
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/GraphicsEnvironment.java	Mon Jul 16 16:31:10 2012 +0100
+++ b/src/share/classes/java/awt/GraphicsEnvironment.java	Tue Jul 17 01:59:14 2012 +0400
@@ -170,12 +170,12 @@
                         if (System.getProperty("javaplugin.version") != null) {
                             headless = defaultHeadless = Boolean.FALSE;
                         } else {
-                            if ("sun.awt.HeadlessGraphicsEnvironment".equals(
-                                    System.getProperty("java.awt.graphicsenv")))
+                            String osName = System.getProperty("os.name");
+                            if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
+                                    System.getProperty("awt.toolkit")))
                             {
                                 headless = defaultHeadless = Boolean.TRUE;
                             } else {
-                                String osName = System.getProperty("os.name");
                                 headless = defaultHeadless =
                                     Boolean.valueOf(("Linux".equals(osName) ||
                                                      "SunOS".equals(osName) ||
--- a/src/solaris/native/java/lang/java_props_md.c	Mon Jul 16 16:31:10 2012 +0100
+++ b/src/solaris/native/java/lang/java_props_md.c	Tue Jul 17 01:59:14 2012 +0400
@@ -398,6 +398,7 @@
     PreferredToolkit prefToolkit = getPreferredToolkit();
     switch (prefToolkit) {
         case CToolkit:
+        case HToolkit:
             sprops.graphics_env = "sun.awt.CGraphicsEnvironment";
             break;
         case XToolkit:
@@ -405,9 +406,6 @@
     sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
 #ifdef MACOSX
             break;
-        default:
-            sprops.graphics_env = "sun.java2d.HeadlessGraphicsEnvironment";
-            break;
     }
 #endif
     /* AWT properties */