< prev index next >

src/java.base/macosx/native/libjava/java_props_macosx.c

Print this page




 195                 isdigit(scriptRegion[1]) &&
 196                 isdigit(scriptRegion[2]) &&
 197                 isdigit(scriptRegion[3])) ||
 198             // '@' followed by a 4 character script code (already validated above)
 199                 (length == 5));
 200     }
 201 
 202     return src;
 203 }
 204 
 205 char *setupMacOSXLocale(int cat) {
 206     char * ret = getMacOSXLocale(cat);
 207 
 208     if (ret == NULL) {
 209         return getPosixLocale(cat);
 210     } else {
 211         return ret;
 212     }
 213 }
 214 
 215 int isInAquaSession() {
 216     // environment variable to bypass the aqua session check
 217     char *ev = getenv("AWT_FORCE_HEADFUL");
 218     if (ev && (strncasecmp(ev, "true", 4) == 0)) {
 219         // if "true" then tell the caller we're in an Aqua session without actually checking
 220         return 1;
 221     }
 222     // Is the WindowServer available?
 223     SecuritySessionId session_id;
 224     SessionAttributeBits session_info;
 225     OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
 226     if (status == noErr) {
 227         if (session_info & sessionHasGraphicAccess) {
 228             return 1;
 229         }
 230     }
 231     return 0;
 232 }
 233 
 234 // 10.9 SDK does not include the NSOperatingSystemVersion struct.
 235 // For now, create our own
 236 typedef struct {
 237         NSInteger majorVersion;
 238         NSInteger minorVersion;
 239         NSInteger patchVersion;
 240 } OSVerStruct;
 241 
 242 void setOSNameAndVersion(java_props_t *sprops) {
 243     // Hardcode os_name, and fill in os_version
 244     sprops->os_name = strdup("Mac OS X");
 245 
 246     char* osVersionCStr = NULL;
 247     // Mac OS 10.9 includes the [NSProcessInfo operatingSystemVersion] function,
 248     // but it's not in the 10.9 SDK.  So, call it via objc_msgSend_stret.
 249     if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
 250         OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret;
 251         OSVerStruct osVer = procInfoFn([NSProcessInfo processInfo],
 252                                        @selector(operatingSystemVersion));
 253         NSString *nsVerStr;




 195                 isdigit(scriptRegion[1]) &&
 196                 isdigit(scriptRegion[2]) &&
 197                 isdigit(scriptRegion[3])) ||
 198             // '@' followed by a 4 character script code (already validated above)
 199                 (length == 5));
 200     }
 201 
 202     return src;
 203 }
 204 
 205 char *setupMacOSXLocale(int cat) {
 206     char * ret = getMacOSXLocale(cat);
 207 
 208     if (ret == NULL) {
 209         return getPosixLocale(cat);
 210     } else {
 211         return ret;
 212     }
 213 }
 214 



















 215 // 10.9 SDK does not include the NSOperatingSystemVersion struct.
 216 // For now, create our own
 217 typedef struct {
 218         NSInteger majorVersion;
 219         NSInteger minorVersion;
 220         NSInteger patchVersion;
 221 } OSVerStruct;
 222 
 223 void setOSNameAndVersion(java_props_t *sprops) {
 224     // Hardcode os_name, and fill in os_version
 225     sprops->os_name = strdup("Mac OS X");
 226 
 227     char* osVersionCStr = NULL;
 228     // Mac OS 10.9 includes the [NSProcessInfo operatingSystemVersion] function,
 229     // but it's not in the 10.9 SDK.  So, call it via objc_msgSend_stret.
 230     if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
 231         OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret;
 232         OSVerStruct osVer = procInfoFn([NSProcessInfo processInfo],
 233                                        @selector(operatingSystemVersion));
 234         NSString *nsVerStr;


< prev index next >