]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/fspanel.m
macosx: get rid of the infamous 'get' prefixes everywhere and finally respect Cocoa...
[vlc] / modules / gui / macosx / fspanel.m
index ae252bac01434738eb7005dc481ab2f474601286..7b31e6ec34939feb8e90fc6f99f6b61b552a0d2b 100644 (file)
 #import "misc.h"
 #import "fspanel.h"
 
+@interface VLCFSPanel ()
+- (void)hideMouse;
+@end
+
 /*****************************************************************************
  * VLCFSPanel
  *****************************************************************************/
 @implementation VLCFSPanel
 /* We override this initializer so we can set the NSBorderlessWindowMask styleMask, and set a few other important settings */
 - (id)initWithContentRect:(NSRect)contentRect 
-                styleMask:(unsigned int)aStyle 
+                styleMask:(NSUInteger)aStyle 
                   backing:(NSBackingStoreType)bufferingType 
                     defer:(BOOL)flag
 {
 
 - (void)setActive:(id)noData
 {
-    if( [[[[VLCMain sharedInstance] getControls] getVoutView] isFullscreen] )
+    if( [[[VLCMain sharedInstance] controls] voutView] != nil )
     {
-        b_nonActive = NO;
-        [self fadeIn];
+        if( [[[[VLCMain sharedInstance] controls] voutView] isFullscreen] )
+        {
+            b_nonActive = NO;
+            [self fadeIn];
+        }
     }
 }
 
 - (void)mouseExited:(NSEvent *)theEvent
 {
     /* give up our focus, so the vout may show us again without letting the user clicking it */
-    if( [[[[VLCMain sharedInstance] getControls] getVoutView] isFullscreen] )
-        [[[[[VLCMain sharedInstance] getControls] getVoutView] window] makeKeyWindow];
+    if( [[[[VLCMain sharedInstance] controls] voutView] isFullscreen] )
+        [[[[[VLCMain sharedInstance] controls] voutView] window] makeKeyWindow];
+}
+
+- (void)hideMouse
+{
+    [NSCursor setHiddenUntilMouseMoves: YES];
 }
 
 - (void)fadeIn
 {
-    /* in case that the user don't want us to appear, just return here */
-    if(! config_GetInt( VLCIntf, "macosx-fspanel" ) || b_nonActive )
+    /* in case that the user don't want us to appear, make sure we hide the mouse */
+
+    if( !config_GetInt( VLCIntf, "macosx-fspanel" ) )
+    {
+        float time = (float)var_CreateGetInteger( VLCIntf, "mouse-hide-timeout" ) / 1000.;
+        [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:time target:self selector:@selector(hideMouse) userInfo:nil repeats:NO]];
+        return;
+    }
+
+    if( b_nonActive )
         return;
 
     [self orderFront: nil];
     /* count down until we hide ourselfes again and do so if necessary */
     if( --i_timeToKeepVisibleInSec < 1 )
     {
-        [NSCursor setHiddenUntilMouseMoves: YES];
+        [self hideMouse];
         [self fadeOut];
         [hideAgainTimer invalidate]; /* released in -autoHide and -dealloc */
         b_alreadyCounting = NO;
 
 - (IBAction)play:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] play: sender];
+    [[[VLCMain sharedInstance] controls] play: sender];
 }
 
 - (IBAction)forward:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] forward: sender];
+    [[[VLCMain sharedInstance] controls] forward: sender];
 }
 
 - (IBAction)backward:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] backward: sender];
+    [[[VLCMain sharedInstance] controls] backward: sender];
 }
 
 - (IBAction)prev:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] prev: sender];
+    [[[VLCMain sharedInstance] controls] prev: sender];
 }
 
 - (IBAction)next:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] next: sender];
+    [[[VLCMain sharedInstance] controls] next: sender];
 }
 
 - (IBAction)windowAction:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] windowAction: sender];
+    [[[VLCMain sharedInstance] controls] windowAction: sender];
 }
 
 - (IBAction)fsTimeSliderUpdate:(id)sender
 
 - (IBAction)fsVolumeSliderUpdate:(id)sender
 {
-    [[[VLCMain sharedInstance] getControls] volumeSliderUpdated: sender];
+    [[[VLCMain sharedInstance] controls] volumeSliderUpdated: sender];
 }
 
 #define addImage(image, _x, _y, mode, _width)                                               \