src/solaris/native/java/lang/java_props_macosx.c

Print this page
rev 8343 : 8025673: [macosx] Disable X11 AWT toolkit
Summary: Disable but not completely remove the XAWT and headless toolkits on Mac OS X
Reviewed-by:
Contributed-by: david.dehaven@oracle.com
rev 8344 : [mq]: 8025673.jdk3

*** 103,146 **** } else { return ret; } } ! /* There are several toolkit options on Mac OS X, so we should try to ! * pick the "best" one, given what we know about the environment Java ! * is running under ! */ ! ! static PreferredToolkit getPreferredToolkitFromEnv() { ! char *envVar = getenv("AWT_TOOLKIT"); ! if (envVar == NULL) return unset; ! ! if (strcasecmp(envVar, "CToolkit") == 0) return CToolkit; ! if (strcasecmp(envVar, "XToolkit") == 0) return XToolkit; ! if (strcasecmp(envVar, "HToolkit") == 0) return HToolkit; ! return unset; ! } ! ! static bool isInAquaSession() { // Is the WindowServer available? SecuritySessionId session_id; SessionAttributeBits session_info; OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info); ! if (status != noErr) return false; ! if (!(session_info & sessionHasGraphicAccess)) return false; ! return true; ! } ! ! PreferredToolkit getPreferredToolkit() { ! static PreferredToolkit pref = unset; ! if (pref != unset) return pref; ! ! PreferredToolkit prefFromEnv = getPreferredToolkitFromEnv(); ! if (prefFromEnv != unset) return pref = prefFromEnv; ! ! if (isInAquaSession()) return pref = CToolkit; ! return pref = HToolkit; } void setOSNameAndVersion(java_props_t *sprops) { /* Don't rely on JRSCopyOSName because there's no guarantee the value will * remain the same, or even if the JRS functions will continue to be part of --- 103,123 ---- } else { return ret; } } ! int isInAquaSession() { // Is the WindowServer available? SecuritySessionId session_id; SessionAttributeBits session_info; OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info); ! if (status == noErr) { ! if (session_info & sessionHasGraphicAccess) { ! return 1; ! } ! } ! return 0; } void setOSNameAndVersion(java_props_t *sprops) { /* Don't rely on JRSCopyOSName because there's no guarantee the value will * remain the same, or even if the JRS functions will continue to be part of