* hide the fspanel if VLC looses its front app state in fullscreen mode (by using...
authorFelix Paul Kühne <fkuehne@videolan.org>
Mon, 18 Dec 2006 23:22:55 +0000 (23:22 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 18 Dec 2006 23:22:55 +0000 (23:22 +0000)
modules/gui/macosx/fspanel.h
modules/gui/macosx/fspanel.m

index 442414f..08c90b1 100644 (file)
@@ -31,6 +31,7 @@
     BOOL b_alreadyCounting;\r
     int i_timeToKeepVisibleInSec;\r
 \r
+    BOOL b_nonActive;\r
     BOOL b_displayed;\r
     BOOL b_voutWasUpdated;\r
     int i_device;\r
@@ -50,6 +51,9 @@
 - (void)setSeekable:(BOOL) b_seekable;\r
 - (void)setVolumeLevel: (float)f_volumeLevel;\r
 \r
+- (void)setNonActive:(id)noData;\r
+- (void)setActive:(id)noData;\r
+\r
 - (void)focus:(NSTimer *)timer;\r
 - (void)unfocus:(NSTimer *)timer;\r
 - (void)mouseExited:(NSEvent *)theEvent;\r
index 85e67fd..76e28dd 100644 (file)
         [self mouseEntered:NULL];\r
     if (!isInside)\r
         [self mouseExited:NULL];\r
+    \r
+    /* get a notification if VLC isn't the active app anymore */\r
+    [[NSNotificationCenter defaultCenter]\r
+    addObserver: self\r
+       selector: @selector(setNonActive:)\r
+           name: NSApplicationDidResignActiveNotification\r
+         object: NSApp];\r
+    \r
+    /* get a notification if VLC is the active app again */\r
+    [[NSNotificationCenter defaultCenter]\r
+    addObserver: self\r
+       selector: @selector(setActive:)\r
+           name: NSApplicationDidBecomeActiveNotification\r
+         object: NSApp];\r
 }\r
 \r
 /* Windows created with NSBorderlessWindowMask normally can't be key, but we want ours to be */\r
@@ -80,6 +94,8 @@
 \r
 -(void)dealloc\r
 {\r
+    [[NSNotificationCenter defaultCenter] removeObserver: self];\r
+    \r
     if( hideAgainTimer )\r
         [hideAgainTimer release];\r
     [self setFadeTimer:nil];\r
     [[self contentView] setVolumeLevel: f_volumeLevel];\r
 }\r
 \r
+- (void)setNonActive:(id)noData\r
+{\r
+    b_nonActive = YES;\r
+    [self orderOut: self];\r
+}\r
+\r
+- (void)setActive:(id)noData\r
+{\r
+    b_nonActive = NO;\r
+    [self orderFront: self];\r
+}\r
+\r
 /* This routine is called repeatedly to fade in the window */\r
 - (void)focus:(NSTimer *)timer\r
 {\r
 - (void)fadeIn\r
 {\r
     /* in case that the user don't want us to appear, just return here */\r
-    if(! config_GetInt( VLCIntf, "macosx-fspanel" ) )\r
+    if(! config_GetInt( VLCIntf, "macosx-fspanel" ) || b_nonActive )\r
         return;\r
     \r
     if( [self alphaValue] < 1.0 )\r