diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h index 19b50d176bf..49e0e7d8645 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h @@ -26,6 +26,7 @@ #include #import #import +#import #import "CPopupMenu.h" @@ -64,12 +65,14 @@ extern "C" { @public AWTTrayIcon *trayIcon; NSImage* image; + NSTrackingArea *trackingArea; BOOL isHighlighted; } -(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon; -(void)setHighlighted:(BOOL)aFlag; -(void)setImage:(NSImage*)anImage; -(void)setTrayIcon:(AWTTrayIcon*)theTrayIcon; +-(void)addTrackingArea; @end //AWTTrayIconView diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m index 0cc9e84eb0d..8057972d301 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m @@ -171,12 +171,27 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) { [self setTrayIcon: theTrayIcon]; isHighlighted = NO; image = nil; - + trackingArea = nil; + + [self addTrackingArea]; + return self; } +- (void)addTrackingArea { + NSTrackingAreaOptions options = NSTrackingMouseMoved | + NSTrackingInVisibleRect | + NSTrackingActiveAlways; + trackingArea = [[NSTrackingArea alloc] initWithRect: CGRectZero + options: options + owner: self + userInfo: nil]; + [self addTrackingArea:trackingArea]; +} + -(void) dealloc { [image release]; + [trackingArea release]; [super dealloc]; } @@ -269,6 +284,10 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) { [trayIcon deliverJavaMouseEvent: event]; } +- (void) mouseMoved: (NSEvent *)event { + [trayIcon deliverJavaMouseEvent: event]; +} + - (void) rightMouseDown:(NSEvent *)event { [trayIcon deliverJavaMouseEvent: event]; }