125 return buf; 126 } 127 128 129 void 130 SplashInitPlatform(Splash * splash) { 131 pthread_mutex_init(&splash->lock, NULL); 132 133 splash->maskRequired = 0; 134 135 136 //TODO: the following is too much of a hack but should work in 90% cases. 137 // besides we don't use device-dependant drawing, so probably 138 // that's very fine indeed 139 splash->byteAlignment = 1; 140 initFormat(&splash->screenFormat, 0xff << 8, 141 0xff << 16, 0xff << 24, 0xff << 0); 142 splash->screenFormat.byteOrder = 1 ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST; 143 splash->screenFormat.depthBytes = 4; 144 145 [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() { 146 [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]]; 147 }]; 148 } 149 150 void 151 SplashCleanupPlatform(Splash * splash) { 152 splash->maskRequired = 0; 153 } 154 155 void 156 SplashDonePlatform(Splash * splash) { 157 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 158 159 pthread_mutex_destroy(&splash->lock); 160 [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ 161 if (splash->window) { 162 [splash->window orderOut:nil]; 163 [splash->window release]; 164 } 165 }]; 166 [pool drain]; 167 } | 125 return buf; 126 } 127 128 129 void 130 SplashInitPlatform(Splash * splash) { 131 pthread_mutex_init(&splash->lock, NULL); 132 133 splash->maskRequired = 0; 134 135 136 //TODO: the following is too much of a hack but should work in 90% cases. 137 // besides we don't use device-dependant drawing, so probably 138 // that's very fine indeed 139 splash->byteAlignment = 1; 140 initFormat(&splash->screenFormat, 0xff << 8, 141 0xff << 16, 0xff << 24, 0xff << 0); 142 splash->screenFormat.byteOrder = 1 ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST; 143 splash->screenFormat.depthBytes = 4; 144 145 // If this property is present we are running SWT and should not start a runLoop 146 char envVar[80]; 147 snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid()); 148 if (getenv(envVar) == NULL) { 149 [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() { 150 [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]]; 151 }]; 152 } 153 } 154 155 void 156 SplashCleanupPlatform(Splash * splash) { 157 splash->maskRequired = 0; 158 } 159 160 void 161 SplashDonePlatform(Splash * splash) { 162 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 163 164 pthread_mutex_destroy(&splash->lock); 165 [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ 166 if (splash->window) { 167 [splash->window orderOut:nil]; 168 [splash->window release]; 169 } 170 }]; 171 [pool drain]; 172 } |