98 }
99 }
100
101 if (ret == NULL) {
102 return getPosixLocale(cat);
103 } else {
104 return ret;
105 }
106 }
107
108 /* There are several toolkit options on Mac OS X, so we should try to
109 * pick the "best" one, given what we know about the environment Java
110 * is running under
111 */
112
113 static PreferredToolkit getPreferredToolkitFromEnv() {
114 char *envVar = getenv("AWT_TOOLKIT");
115 if (envVar == NULL) return unset;
116
117 if (strcasecmp(envVar, "CToolkit") == 0) return CToolkit;
118 if (strcasecmp(envVar, "XToolkit") == 0) return XToolkit;
119 if (strcasecmp(envVar, "HToolkit") == 0) return HToolkit;
120 return unset;
121 }
122
123 static bool isInAquaSession() {
124 // Is the WindowServer available?
125 SecuritySessionId session_id;
126 SessionAttributeBits session_info;
127 OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
128 if (status != noErr) return false;
129 if (!(session_info & sessionHasGraphicAccess)) return false;
130 return true;
131 }
132
133 PreferredToolkit getPreferredToolkit() {
134 static PreferredToolkit pref = unset;
135 if (pref != unset) return pref;
136
137 PreferredToolkit prefFromEnv = getPreferredToolkitFromEnv();
138 if (prefFromEnv != unset) return pref = prefFromEnv;
|
98 }
99 }
100
101 if (ret == NULL) {
102 return getPosixLocale(cat);
103 } else {
104 return ret;
105 }
106 }
107
108 /* There are several toolkit options on Mac OS X, so we should try to
109 * pick the "best" one, given what we know about the environment Java
110 * is running under
111 */
112
113 static PreferredToolkit getPreferredToolkitFromEnv() {
114 char *envVar = getenv("AWT_TOOLKIT");
115 if (envVar == NULL) return unset;
116
117 if (strcasecmp(envVar, "CToolkit") == 0) return CToolkit;
118 if (strcasecmp(envVar, "HToolkit") == 0) return HToolkit;
119 return unset;
120 }
121
122 static bool isInAquaSession() {
123 // Is the WindowServer available?
124 SecuritySessionId session_id;
125 SessionAttributeBits session_info;
126 OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
127 if (status != noErr) return false;
128 if (!(session_info & sessionHasGraphicAccess)) return false;
129 return true;
130 }
131
132 PreferredToolkit getPreferredToolkit() {
133 static PreferredToolkit pref = unset;
134 if (pref != unset) return pref;
135
136 PreferredToolkit prefFromEnv = getPreferredToolkitFromEnv();
137 if (prefFromEnv != unset) return pref = prefFromEnv;
|