--- old/src/macosx/native/sun/awt/awt.m 2012-02-01 03:44:43.000000000 -0800 +++ new/src/macosx/native/sun/awt/awt.m 2012-02-01 03:44:41.000000000 -0800 @@ -344,7 +344,7 @@ // ApplicationDelegate is the support code for com.apple.eawt. OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]); - // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent. + // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent. if (![app isRunning]) { if (verbose) AWT_DEBUG_LOG(@"+[AWTStarter startAWT]: ![app isRunning]"); @@ -374,7 +374,7 @@ [pool drain]; } - + @end --- old/src/macosx/native/sun/awt/AWTEvent.m 2012-02-01 03:44:49.000000000 -0800 +++ new/src/macosx/native/sun/awt/AWTEvent.m 2012-02-01 03:44:48.000000000 -0800 @@ -989,9 +989,9 @@ jint jmodifiers = 0; JNF_COCOA_ENTER(env); - + jmodifiers = GetJavaMouseModifiers(buttonNumber, modifierFlags); - + JNF_COCOA_EXIT(env); return jmodifiers; @@ -1009,11 +1009,11 @@ jint jmodifiers = 0; JNF_COCOA_ENTER(env); - + jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags); - + JNF_COCOA_EXIT(env); - + return jmodifiers; } @@ -1027,9 +1027,9 @@ (JNIEnv *env, jclass cls, jintArray inData, jintArray outData) { BOOL postsTyped = NO; - + JNF_COCOA_ENTER(env); - + jboolean copy = JNI_FALSE; jint *data = (*env)->GetIntArrayElements(env, inData, ©); @@ -1041,15 +1041,15 @@ jint jkeyCode = java_awt_event_KeyEvent_VK_UNDEFINED; jint jkeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN; - + NsCharToJavaVirtualKeyCode((unichar)testChar, (unichar)testDeadChar, (NSUInteger)modifierFlags, (unsigned short)keyCode, - &jkeyCode, &jkeyLocation, &postsTyped); + &jkeyCode, &jkeyLocation, &postsTyped); // out = [jkeyCode, jkeyLocation]; (*env)->SetIntArrayRegion(env, outData, 0, 1, &jkeyCode); (*env)->SetIntArrayRegion(env, outData, 1, 1, &jkeyLocation); - + JNF_COCOA_EXIT(env); return postsTyped; @@ -1065,10 +1065,10 @@ (JNIEnv *env, jclass cls, jintArray inData, jintArray outData) { JNF_COCOA_ENTER(env); - + jboolean copy = JNI_FALSE; jint *data = (*env)->GetIntArrayElements(env, inData, ©); - + // in = [modifierFlags, keyCode] jint modifierFlags = data[0]; jshort keyCode = (jshort)data[1]; @@ -1076,7 +1076,7 @@ jint jkeyCode = java_awt_event_KeyEvent_VK_UNDEFINED; jint jkeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN; jint jkeyType = java_awt_event_KeyEvent_KEY_PRESSED; - + NsKeyModifiersToJavaKeyInfo(modifierFlags, keyCode, &jkeyCode, @@ -1085,8 +1085,8 @@ // out = [jkeyCode, jkeyLocation, jkeyType]; (*env)->SetIntArrayRegion(env, outData, 0, 1, &jkeyCode); - (*env)->SetIntArrayRegion(env, outData, 1, 1, &jkeyLocation); + (*env)->SetIntArrayRegion(env, outData, 1, 1, &jkeyLocation); (*env)->SetIntArrayRegion(env, outData, 2, 1, &jkeyType); - + JNF_COCOA_EXIT(env); } --- old/src/macosx/native/sun/awt/AWTView.m 2012-02-01 03:44:52.000000000 -0800 +++ new/src/macosx/native/sun/awt/AWTView.m 2012-02-01 03:44:51.000000000 -0800 @@ -81,15 +81,15 @@ fInPressAndHold = NO; fPAHNeedsToSelect = NO; - if (windowLayer != nil) { + if (windowLayer != nil) { self.cglLayer = windowLayer; [self setWantsLayer: YES]; [self.layer addSublayer: (CALayer *)cglLayer]; [self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize]; [self setLayerContentsPlacement: NSViewLayerContentsPlacementTopLeft]; - [self setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable]; + [self setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable]; } - + #if USE_INTERMEDIATE_BUFFER self.cglLayer = windowLayer; [self setWantsLayer: YES]; @@ -200,7 +200,7 @@ [self deliverJavaMouseEvent: event]; } } - + - (void) mouseUp: (NSEvent *)event { [self deliverJavaMouseEvent: event]; } @@ -326,8 +326,8 @@ absP.y = screenRect.size.height - absP.y; jint clickCount; - if (type == NSMouseEntered || - type == NSMouseExited || + if (type == NSMouseEntered || + type == NSMouseExited || type == NSScrollWheel || type == NSMouseMoved) { clickCount = 0; @@ -338,7 +338,7 @@ static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent"); static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V"); jobject jEvent = JNFNewObject(env, jctor_NSEvent, - [event type], + [event type], [event modifierFlags], clickCount, [event buttonNumber], @@ -383,7 +383,7 @@ jstring characters = NULL; if ([event type] != NSFlagsChanged) { - characters = JNFNSToJavaString(env, [event characters]); + characters = JNFNSToJavaString(env, [event characters]); } static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent"); @@ -398,7 +398,7 @@ static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView, "deliverKeyEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V"); JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent); - + if (characters != NULL) { (*env)->DeleteLocalRef(env, characters); } --- old/src/macosx/native/sun/awt/AWTWindow.m 2012-02-01 03:44:55.000000000 -0800 +++ new/src/macosx/native/sun/awt/AWTWindow.m 2012-02-01 03:44:55.000000000 -0800 @@ -142,7 +142,7 @@ if (IS(mask, DOCUMENT_MODIFIED)) { [self setDocumentEdited:IS(bits, DOCUMENT_MODIFIED)]; } - + if ([self respondsToSelector:@selector(toggleFullScreen:)]) { if (IS(mask, FULLSCREENABLE)) { [self setCollectionBehavior:(1 << 7) /*NSWindowCollectionBehaviorFullScreenPrimary*/]; @@ -276,7 +276,7 @@ static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler"); static JNF_STATIC_MEMBER_CACHE(sjm_handleGestureFromNative, jc_GestureHandler, "handleGestureFromNative", "(Ljava/awt/Window;IDDDD)V"); JNFCallStaticVoidMethod(env, sjm_handleGestureFromNative, awtWindow, type, (jdouble)loc.x, (jdouble)loc.y, (jdouble)a, (jdouble)b); - (*env)->DeleteLocalRef(env, awtWindow); + (*env)->DeleteLocalRef(env, awtWindow); } (*env)->DeleteLocalRef(env, platformWindow); } @@ -427,7 +427,7 @@ - (void) windowDidBecomeKey: (NSNotification *) notification { -AWT_ASSERT_APPKIT_THREAD; +AWT_ASSERT_APPKIT_THREAD; [AWTToolkit eventCountPlusPlus]; [CMenuBar activate:self.javaMenuBar modallyDisabled:NO]; [self _deliverWindowFocusEvent:YES]; @@ -461,7 +461,7 @@ jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; if (platformWindow != NULL) { static JNF_MEMBER_CACHE(jm_deliverWindowClosingEvent, jc_CPlatformWindow, "deliverWindowClosingEvent", "()V"); - JNFCallVoidMethod(env, platformWindow, jm_deliverWindowClosingEvent); + JNFCallVoidMethod(env, platformWindow, jm_deliverWindowClosingEvent); (*env)->DeleteLocalRef(env, platformWindow); } // The window will be closed (if allowed) as result of sending Java event @@ -531,13 +531,13 @@ - (void)sendEvent:(NSEvent *)event { if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) { - + NSPoint p = [NSEvent mouseLocation]; NSRect frame = [self frame]; NSRect contentRect = [self contentRectForFrameRect:frame]; - - // Check if the click happened in the non-client area (title bar) - if (p.y >= (frame.origin.y + contentRect.size.height)) { + + // Check if the click happened in the non-client area (title bar) + if (p.y >= (frame.origin.y + contentRect.size.height)) { JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; // Currently, no need to deliver the whole NSEvent. --- old/src/macosx/native/sun/awt/CDragSource.m 2012-02-01 03:45:00.000000000 -0800 +++ new/src/macosx/native/sun/awt/CDragSource.m 2012-02-01 03:45:00.000000000 -0800 @@ -563,7 +563,7 @@ JNF_MEMBER_CACHE(dragDropFinishedMethod, CDragSourceContextPeerClass, "dragDropFinished", "(ZIII)V"); DLog3(@" -> posting dragDropFinished, point %f, %f", point.x, point.y); JNFCallVoidMethod(env, fDragSourceContextPeer, dragDropFinishedMethod, success, dragOp, (jint) point.x, (jint) point.y); // AWT_THREADING Safe (event) - JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V"); + JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V"); JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable } @finally { // Clear the current DragSource --- old/src/macosx/native/sun/awt/CDropTarget.m 2012-02-01 03:45:05.000000000 -0800 +++ new/src/macosx/native/sun/awt/CDropTarget.m 2012-02-01 03:45:04.000000000 -0800 @@ -363,9 +363,9 @@ // In case of an error make sure to return nil: if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); + (*env)->ExceptionDescribe(env); gbyteArray = nil; - } + } return gbyteArray; } @@ -570,8 +570,8 @@ // Should we notify Java things have changed? if (sDraggingError == FALSE && notifyJava) { NSPoint javaLocation = [fView convertPoint:sDraggingLocation fromView:nil]; - // For some reason even after the convertPoint drag events come with the y coordinate reverted - javaLocation.y = fView.window.frame.size.height - javaLocation.y; + // For some reason even after the convertPoint drag events come with the y coordinate reverted + javaLocation.y = fView.window.frame.size.height - javaLocation.y; //DLog5(@" : dragMoved: loc native %f, %f, java %f, %f\n", sDraggingLocation.x, sDraggingLocation.y, javaLocation.x, javaLocation.y); jlongArray formats = sDraggingFormats; --- old/src/macosx/native/sun/awt/CTrayIcon.m 2012-02-01 03:45:09.000000000 -0800 +++ new/src/macosx/native/sun/awt/CTrayIcon.m 2012-02-01 03:45:08.000000000 -0800 @@ -38,16 +38,16 @@ */ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) { NSRect imageRect = NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height); - - // There is a black line at the bottom of the status bar + + // There is a black line at the bottom of the status bar // that we don't want to cover with image pixels. CGFloat desiredHeight = [[NSStatusBar systemStatusBar] thickness] - 1.0; CGFloat scaleFactor = MIN(1.0, desiredHeight/imageSize.height); - + imageRect.size.width *= scaleFactor; imageRect.size.height *= scaleFactor; imageRect = NSIntegralRect(imageRect); - + return imageRect.size; } @@ -58,7 +58,7 @@ peer = thePeer; - theItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; + theItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; [theItem retain]; view = [[AWTTrayIconView alloc] initWithTrayIcon:self]; @@ -100,11 +100,11 @@ - (void) setImage:(NSImage *) imagePtr sizing:(BOOL)autosize{ NSSize imageSize = [imagePtr size]; NSSize scaledSize = ScaledImageSizeForStatusBar(imageSize); - if (imageSize.width != scaledSize.width || + if (imageSize.width != scaledSize.width || imageSize.height != scaledSize.height) { [imagePtr setSize: scaledSize]; } - + CGFloat itemLength = scaledSize.width + 2.0*kImageInset; [theItem setLength:itemLength]; @@ -120,13 +120,13 @@ @implementation AWTTrayIconView --(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon { +-(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon { self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)]; trayIcon = theTrayIcon; isHighlighted = NO; - image = nil; - + image = nil; + return self; } @@ -135,7 +135,7 @@ [super dealloc]; } -- (void)setHighlighted:(BOOL)aFlag +- (void)setHighlighted:(BOOL)aFlag { if (isHighlighted != aFlag) { isHighlighted = aFlag; @@ -145,7 +145,7 @@ - (void)setImage:(NSImage*)anImage { [anImage retain]; - [image release]; + [image release]; image = anImage; if (image != nil) { @@ -153,12 +153,12 @@ } } -- (void)menuWillOpen:(NSMenu *)menu +- (void)menuWillOpen:(NSMenu *)menu { [self setHighlighted:YES]; } -- (void)menuDidClose:(NSMenu *)menu +- (void)menuDidClose:(NSMenu *)menu { [menu setDelegate:nil]; [self setHighlighted:NO]; @@ -173,20 +173,20 @@ NSRect bounds = [self bounds]; NSSize imageSize = [image size]; - NSRect drawRect = {{ (bounds.size.width - imageSize.width) / 2.0, + NSRect drawRect = {{ (bounds.size.width - imageSize.width) / 2.0, (bounds.size.height - imageSize.height) / 2.0 }, imageSize}; - // don't cover bottom pixels of the status bar with the image + // don't cover bottom pixels of the status bar with the image if (drawRect.origin.y < 1.0) { drawRect.origin.y = 1.0; } - drawRect = NSIntegralRect(drawRect); - + drawRect = NSIntegralRect(drawRect); + [trayIcon.theItem drawStatusBarBackgroundInRect:bounds - withHighlight:isHighlighted]; - [image drawInRect:drawRect - fromRect:NSZeroRect - operation:NSCompositeSourceOver + withHighlight:isHighlighted]; + [image drawInRect:drawRect + fromRect:NSZeroRect + operation:NSCompositeSourceOver fraction:1.0 ]; } @@ -203,7 +203,7 @@ NSMenu* menu = [cmenu menu]; [menu setDelegate:self]; [trayIcon.theItem popUpStatusItemMenu:menu]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplay:YES]; } else { JNFCallVoidMethod(env, trayIcon.peer, jm_performAction); } @@ -298,19 +298,19 @@ JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - + __block NSPoint pt = NSZeroPoint; AWTTrayIcon *icon = jlong_to_ptr(model); [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - - NSPoint loc = [icon getLocationOnScreen]; + + NSPoint loc = [icon getLocationOnScreen]; pt = ConvertNSScreenPoint(env, loc); }]; jpt = NSToJavaPoint(env, pt); - + JNF_COCOA_EXIT(env); - + return jpt; } --- old/src/macosx/native/sun/awt/LWCToolkit.m 2012-02-01 03:45:13.000000000 -0800 +++ new/src/macosx/native/sun/awt/LWCToolkit.m 2012-02-01 03:45:12.000000000 -0800 @@ -376,18 +376,18 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive (JNIEnv *env, jclass clazz) { - __block jboolean active = JNI_FALSE; + __block jboolean active = JNI_FALSE; AWT_ASSERT_NOT_APPKIT_THREAD; JNF_COCOA_ENTER(env); - - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() { - active = (jboolean)[NSRunningApplication currentApplication].active; - }]; - + + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() { + active = (jboolean)[NSRunningApplication currentApplication].active; + }]; + JNF_COCOA_EXIT(env); - - return active; + + return active; } --- old/src/macosx/native/sun/java2d/opengl/CGLLayer.m 2012-02-01 03:45:17.000000000 -0800 +++ new/src/macosx/native/sun/java2d/opengl/CGLLayer.m 2012-02-01 03:45:16.000000000 -0800 @@ -53,7 +53,7 @@ if (self == nil) return self; javaLayer = layer; - + // NOTE: async=YES means that the layer is re-cached periodically self.asynchronous = FALSE; self.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; @@ -69,7 +69,7 @@ JNIEnv *env = [ThreadUtilities getJNIEnv]; (*env)->DeleteGlobalRef(env, javaLayer); javaLayer = NULL; - + [super dealloc]; } @@ -148,7 +148,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD; jobject javaLayer = (*env)->NewGlobalRef(env, obj); - + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; @@ -174,9 +174,9 @@ layer.textureWidth = oglsdo->width; layer.textureHeight = oglsdo->height; } else { - layer.textureID = 0; + layer.textureID = 0; } -} +} // Must be called on the AppKit thread and under the RQ lock. JNIEXPORT void JNICALL --- old/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m 2012-02-01 03:45:25.000000000 -0800 +++ new/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m 2012-02-01 03:45:24.000000000 -0800 @@ -691,9 +691,9 @@ oglsdo->isOpaque = isOpaque; cglsdo->peerData = (AWTView *)jlong_to_ptr(pPeerData); - cglsdo->layer = (CGLLayer *)jlong_to_ptr(layerPtr); + cglsdo->layer = (CGLLayer *)jlong_to_ptr(layerPtr); cglsdo->configInfo = (CGLGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo); - + if (cglsdo->configInfo == NULL) { free(cglsdo); JNU_ThrowNullPointerException(env, "Config info is null in initOps"); --- old/src/macosx/native/sun/osxapp/NSApplicationAWT.m 2012-02-01 03:45:29.000000000 -0800 +++ new/src/macosx/native/sun/osxapp/NSApplicationAWT.m 2012-02-01 03:45:29.000000000 -0800 @@ -53,11 +53,11 @@ AWT_ASSERT_APPKIT_THREAD; fApplicationName = nil; fUseDefaultIcon = NO; - + // NSApplication will call _RegisterApplication with the application's bundle, but there may not be one. // So, we need to call it ourselves to ensure the app is set up properly. [self registerWithProcessManager]; - + return [super init]; } @@ -75,7 +75,7 @@ AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnv]; - + // Get default nib file location // NOTE: This should learn about the current java.version. Probably best thru // the Makefile system's -DFRAMEWORK_VERSION define. Need to be able to pass this @@ -87,44 +87,44 @@ } else { sUsingDefaultNIB = NO; } - + [NSBundle loadNibFile:defaultNibFile externalNameTable: [NSDictionary dictionaryWithObject:self forKey:@"NSOwner"] withZone:nil]; - + // Set user defaults to not try to parse application arguments. NSUserDefaults * defs = [NSUserDefaults standardUserDefaults]; NSDictionary * noOpenDict = [NSDictionary dictionaryWithObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; [defs registerDefaults:noOpenDict]; - + // Fix up the dock icon now that we are registered with CAS and the Dock. [self setDockIconWithEnv:env]; - + // If we are using our nib (the default application NIB) we need to put the app name into // the application menu, which has placeholders for the name. if (sUsingDefaultNIB) { NSUInteger i, itemCount; NSMenu *theMainMenu = [NSApp mainMenu]; - + // First submenu off the main menu is the application menu. NSMenuItem *appMenuItem = [theMainMenu itemAtIndex:0]; NSMenu *appMenu = [appMenuItem submenu]; itemCount = [appMenu numberOfItems]; - + for (i = 0; i < itemCount; i++) { NSMenuItem *anItem = [appMenu itemAtIndex:i]; NSString *oldTitle = [anItem title]; [anItem setTitle:[NSString stringWithFormat:oldTitle, fApplicationName]]; } } - + if (applicationDelegate) { [self setDelegate:applicationDelegate]; } else { qad = [QueuingApplicationDelegate sharedDelegate]; [self setDelegate:qad]; } - + [super finishLaunching]; - + // inform any interested parties that the AWT has arrived and is pumping [[NSNotificationCenter defaultCenter] postNotificationName:JNFRunLoopDidStartNotification object:self]; } @@ -135,29 +135,29 @@ // Embedded: NO // Multiple Calls: NO // Caller: -[NSApplicationAWT init] - + AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnv]; - + char envVar[80]; - + // The following environment variable is set from the -Xdock:name param. It should be UTF8. snprintf(envVar, sizeof(envVar), "APP_NAME_%d", getpid()); char *appName = getenv(envVar); if (appName != NULL) { fApplicationName = [NSString stringWithUTF8String:appName]; unsetenv(envVar); - + // If this environment variable was set we were launched from the command line, so we // should use a generic app icon if one wasn't set. fUseDefaultIcon = YES; } - + // If it wasn't specified as an argument, see if it was specified as a system property. if (fApplicationName == nil) { fApplicationName = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.application.name" withEnv:env]; } - + // If we STILL don't have it, the app name is retrieved from an environment variable (set in java.c) It should be UTF8. if (fApplicationName == nil) { char mainClassEnvVar[80]; @@ -166,7 +166,7 @@ if (mainClass != NULL) { fApplicationName = [NSString stringWithUTF8String:mainClass]; unsetenv(mainClassEnvVar); - + NSRange lastPeriod = [fApplicationName rangeOfString:@"." options:NSBackwardsSearch]; if (lastPeriod.location != NSNotFound) { fApplicationName = [fApplicationName substringFromIndex:lastPeriod.location + 1]; @@ -176,24 +176,24 @@ fUseDefaultIcon = YES; } } - + // The dock name is nil for double-clickable Java apps (bundled and Web Start apps) // When that happens get the display name, and if that's not available fall back to // CFBundleName. NSBundle *mainBundle = [NSBundle mainBundle]; if (fApplicationName == nil) { fApplicationName = (NSString *)[mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]; - + if (fApplicationName == nil) { fApplicationName = (NSString *)[mainBundle objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey]; - + if (fApplicationName == nil) { fApplicationName = (NSString *)[mainBundle objectForInfoDictionaryKey: (NSString *)kCFBundleExecutableKey]; - + if (fApplicationName == nil) { // Name of last resort is the last part of the applicatoin name without the .app (consistent with CopyProcessName) fApplicationName = [[mainBundle bundlePath] lastPathComponent]; - + if ([fApplicationName hasSuffix:@".app"]) { fApplicationName = [fApplicationName stringByDeletingPathExtension]; } @@ -201,38 +201,38 @@ } } } - + // We're all done trying to determine the app name. Hold on to it. [fApplicationName retain]; - + NSDictionary *registrationOptions = [NSMutableDictionary dictionaryWithObject:fApplicationName forKey:@"JRSAppNameKey"]; - + NSString *launcherType = [PropertiesUtilities javaSystemPropertyForKey:@"sun.java.launcher" withEnv:env]; if ([@"SUN_STANDARD" isEqualToString:launcherType]) { [registrationOptions setValue:[NSNumber numberWithBool:YES] forKey:@"JRSAppIsCommandLineKey"]; } - + NSString *uiElementProp = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.UIElement" withEnv:env]; if ([@"true" isCaseInsensitiveLike:uiElementProp]) { [registrationOptions setValue:[NSNumber numberWithBool:YES] forKey:@"JRSAppIsUIElementKey"]; } - + NSString *backgroundOnlyProp = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.BackgroundOnly" withEnv:env]; if ([@"true" isCaseInsensitiveLike:backgroundOnlyProp]) { [registrationOptions setValue:[NSNumber numberWithBool:YES] forKey:@"JRSAppIsBackgroundOnlyKey"]; } - + // TODO replace with direct call // [JRSAppKitAWT registerAWTAppWithOptions:registrationOptions]; // and remove below transform/activate/run hack - + id jrsAppKitAWTClass = objc_getClass("JRSAppKitAWT"); SEL registerSel = @selector(registerAWTAppWithOptions:); if ([jrsAppKitAWTClass respondsToSelector:registerSel]) { [jrsAppKitAWTClass performSelector:registerSel withObject:registrationOptions]; return; } - + // HACK BEGIN // The following is necessary to make the java process behave like a // proper foreground application... @@ -240,7 +240,7 @@ ProcessSerialNumber psn; GetCurrentProcess(&psn); TransformProcessType(&psn, kProcessTransformToForegroundApplication); - + [NSApp activateIgnoringOtherApps:YES]; [NSApp run]; }]; @@ -249,7 +249,7 @@ - (void) setDockIconWithEnv:(JNIEnv *)env { NSString *theIconPath = nil; - + // The following environment variable is set in java.c. It is probably UTF8. char envVar[80]; snprintf(envVar, sizeof(envVar), "APP_ICON_%d", getpid()); @@ -258,27 +258,27 @@ theIconPath = [NSString stringWithUTF8String:appIcon]; unsetenv(envVar); } - + if (theIconPath == nil) { theIconPath = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.application.icon" withEnv:env]; } - + // If the icon file wasn't specified as an argument and we need to get an icon // we'll use the generic java app icon. NSString *defaultIconPath = [NSString stringWithFormat:@"%@%@", SHARED_FRAMEWORK_BUNDLE, @"/Resources/GenericApp.icns"]; if (fUseDefaultIcon && (theIconPath == nil)) { theIconPath = defaultIconPath; } - + // Set up the dock icon if we have an icon name. if (theIconPath != nil) { NSImage *iconImage = [[NSImage alloc] initWithContentsOfFile:theIconPath]; - + // If we failed for some reason fall back to the default icon. if (iconImage == nil) { iconImage = [[NSImage alloc] initWithContentsOfFile:defaultIconPath]; } - + [NSApp setApplicationIconImage:iconImage]; [iconImage release]; } @@ -316,7 +316,7 @@ [optionsDictionary setValue:[NSApp applicationIconImage] forKey:@"ApplicationIcon"]; } } - + [super orderFrontStandardAboutPanelWithOptions:optionsDictionary]; } @@ -326,10 +326,10 @@ if (mask == DRAGMASK && [((NSString *)kCFRunLoopDefaultMode) isEqual:mode]) { postEventDuringEventSynthesis = YES; } - + NSEvent *event = [super nextEventMatchingMask:mask untilDate:expiration inMode:mode dequeue: deqFlag]; postEventDuringEventSynthesis = NO; - + return event; } @@ -340,7 +340,7 @@ { AWT_ASSERT_APPKIT_THREAD; applicationDelegate = delegate; - + if (NSApp != nil) { [NSApp setDelegate: applicationDelegate]; --- old/src/macosx/native/sun/osxapp/PropertiesUtilities.m 2012-02-01 03:45:34.000000000 -0800 +++ new/src/macosx/native/sun/osxapp/PropertiesUtilities.m 2012-02-01 03:45:33.000000000 -0800 @@ -30,11 +30,11 @@ + (NSString *) javaSystemPropertyForKey:(NSString *)key withEnv:(JNIEnv *)env { static JNF_CLASS_CACHE(jc_System, "java/lang/System"); static JNF_STATIC_MEMBER_CACHE(jm_getProperty, jc_System, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;"); - + jstring jKey = JNFNSToJavaString(env, key); jstring jValue = JNFCallStaticObjectMethod(env, jm_getProperty, jKey); (*env)->DeleteLocalRef(env, jKey); - + NSString *value = JNFJavaToNSString(env, jValue); (*env)->DeleteLocalRef(env, jValue); return value; --- old/src/macosx/native/sun/osxapp/QueuingApplicationDelegate.m 2012-02-01 03:45:38.000000000 -0800 +++ new/src/macosx/native/sun/osxapp/QueuingApplicationDelegate.m 2012-02-01 03:45:37.000000000 -0800 @@ -67,7 +67,7 @@ // If the java application has a bundle with an Info.plist file with // a CFBundleDocumentTypes entry, then it is set up to handle Open Doc // and Print Doc commands for these files. Therefore java AWT will - // cache Open Doc and Print Doc events that are sent prior to a + // cache Open Doc and Print Doc events that are sent prior to a // listener being installed by the client java application. NSBundle *bundle = [NSBundle mainBundle]; fHandlesDocumentTypes = [bundle objectForInfoDictionaryKey:@"CFBundleDocumentTypes"] != nil || [bundle _hasEAWTOverride:@"DocumentHandler"]; @@ -130,7 +130,7 @@ [self->queue addObject:^(){ [realDelegate application:application printFiles:fileNames withSettings:printSettings showPrintPanels:showPrintPanels]; }]; - + // well, a bit premature, but what else can we do?.. return NSPrintingSuccess; } --- old/src/macosx/native/sun/osxapp/ThreadUtilities.m 2012-02-01 03:45:42.000000000 -0800 +++ new/src/macosx/native/sun/osxapp/ThreadUtilities.m 2012-02-01 03:45:41.000000000 -0800 @@ -112,7 +112,7 @@ if (fWait) { sInPerformFromJava = YES; } - + sPerformCount++; // Actually do the work (cheat to avoid a method call) @@ -148,20 +148,20 @@ // Do an asynchronous perform to the main thread. [self performSelectorOnMainThread:@selector(_performCompatible:) withObject:resultLock waitUntilDone:NO modes:sAWTPerformModes]; - + // Wait for a little bit for it to finish [resultLock lockWhenCondition:READY beforeDate:[NSDate dateWithTimeIntervalSinceNow:sCocoaComponentCompatibilityTimeout]]; - + // If the _performCompatible is actually in progress, // we should let it finish if ([resultLock condition] == IN_PROGRESS) { [resultLock lockWhenCondition:READY]; } - + if ([resultLock condition] == NOT_READY && sLoggingEnabled) { NSLog(@"[Java CocoaComponent compatibility mode]: Operation timed out due to possible deadlock: selector '%@' on target '%@' with args '%@'", NSStringFromSelector(fSelector), fTarget, fArg); } - + [resultLock unlock]; [resultLock autorelease]; } @@ -171,9 +171,9 @@ // notify that the perform is in progress! [resultLock lock]; [resultLock unlockWithCondition:IN_PROGRESS]; - + sPerformCount++; - + // Actually do the work. @try { [fTarget performSelector:fSelector withObject:fArg]; @@ -183,7 +183,7 @@ // notify done! [resultLock lock]; [resultLock unlockWithCondition:READY]; - + // Clean up after ourselves [resultLock autorelease]; [fTarget autorelease]; @@ -223,7 +223,7 @@ // ModalPanel, and EventTracking modes sPerformModes = [[NSArray alloc] initWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, nil]; sAWTPerformModes = [[NSArray alloc] initWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, [JNFRunLoop javaRunLoopMode], nil]; - + #ifdef AWT_THREAD_ASSERTS_ENV_ASSERT sAWTThreadAsserts = (getenv("COCOA_AWT_DISABLE_THREAD_ASSERTS") == NULL); #endif /* AWT_THREAD_ASSERTS_ENV_ASSERT */