src/macosx/native/sun/awt/ApplicationDelegate.m

Print this page

        

@@ -101,10 +101,11 @@
 @synthesize fPreferencesMenu;
 @synthesize fAboutMenu;
 
 @synthesize fDockMenu;
 @synthesize fDefaultMenuBar;
+@synthesize isAppActive;
 
 
 + (ApplicationDelegate *)sharedDelegate {
     static ApplicationDelegate *sApplicationDelegate = nil;
     static BOOL checked = NO;

@@ -226,10 +227,11 @@
     BOOL aboutAvailable = ([self.fAboutMenu menu] != nil);
     BOOL aboutEnabled = (aboutAvailable && [self.fAboutMenu isEnabled] && ([self.fAboutMenu target] != nil));
 
     BOOL prefsAvailable = ([self.fPreferencesMenu menu] != nil);
     BOOL prefsEnabled = (prefsAvailable && [self.fPreferencesMenu isEnabled] && ([self.fPreferencesMenu target] != nil));
+    isAppActive = NO;
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_CLASS_CACHE(sjc_AppMenuBarHandler, "com/apple/eawt/_AppMenuBarHandler");
     static JNF_STATIC_MEMBER_CACHE(sjm_initMenuStates, sjc_AppMenuBarHandler, "initMenuStates", "(ZZZZ)V");
     JNFCallStaticVoidMethod(env, sjm_initMenuStates, aboutAvailable, aboutEnabled, prefsAvailable, prefsEnabled);

@@ -498,10 +500,18 @@
     [image unlockFocus];
     [image autorelease];
     return image;
 }
 
+- (void)applicationWillBecomeActive:(id)application {
+    isAppActive = YES;
+}
+
+- (void)applicationWillResignActive:(id)application {
+    isAppActive = NO;
+}
+
 @end
 
 
 #pragma mark Native JNI calls