]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/vout.m
macosx: Fix crash log and remove some unneeded NSLog.
[vlc] / modules / gui / macosx / vout.m
index 394a590adb6569005c30e27291c4637722fa2df2..dc85fd97181a853abed5e36c2f4539c150cef877 100644 (file)
@@ -857,13 +857,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (void)manage
 {
+    /* Dooh, why do we spend processor time doing this kind of stuff? */
     [super manage];
     unsigned int i_mouse_hide_timeout =
-        var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
+        var_CreateGetInteger(p_vout, "mouse-hide-timeout") * 1000;
+
+    if( i_mouse_hide_timeout < 100000 )
+        i_mouse_hide_timeout = 100000;
     if( p_vout->b_fullscreen )
     {
         if( mdate() - i_time_mouse_last_moved > i_mouse_hide_timeout )
         {
+            i_time_mouse_last_moved = mdate();
             [self hideMouse: YES];
         }
     }
@@ -876,15 +881,15 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (void)enterFullscreen
 {
-    [super enterFullscreen];
     [o_window performSelectorOnMainThread: @selector(enterFullscreen) withObject: NULL waitUntilDone: NO];
+    [super enterFullscreen];
 
 }
 
 - (void)leaveFullscreen
 {
-    [super leaveFullscreen];
     [o_window performSelectorOnMainThread: @selector(leaveFullscreen) withObject: NULL waitUntilDone: NO];
+    [super leaveFullscreen];
 }
 
 
@@ -939,7 +944,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
         [o_window setAcceptsMouseMovedEvents: TRUE];
 
-        if( var_GetBool( p_real_vout, "video-on-top" ) )
+        if( var_CreateGetBool( p_real_vout, "video-on-top" ) )
         {
             [o_window setLevel: NSStatusWindowLevel];
         }
@@ -1053,10 +1058,14 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
         [self center];
         [self makeKeyAndOrderFront: self];
         [self setReleasedWhenClosed: YES];
+        [self setFrameUsingName:@"VLCVoutWindowDetached"];
+        [self setFrameAutosaveName:@"VLCVoutWindowDetached"];
 
         /* We'll catch mouse events */
         [self makeFirstResponder: o_view];
         [self setCanBecomeKeyWindow: YES];
+        [self setAcceptsMouseMovedEvents: YES];
+        [self setIgnoresMouseEvents: NO];
 
         if( var_CreateGetBool( p_vout, "macosx-background" ) )
         {
@@ -1105,29 +1114,22 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     screen = [NSScreen screenWithDisplayID: (CGDirectDisplayID)i_device];
     if( !screen ) screen = [self screen];
 
-    if( b_black && [[NSScreen screens] count] > 1)
-    {
-        CGDisplayFadeReservationToken token;
-        CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
-        CGDisplayFade( token, 0.2 , kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
-
+    if( b_black )
         [screen blackoutOtherScreens];
 
-        CGDisplayFade( token, 0.1 , kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
-        CGReleaseDisplayFadeReservation( token);
-    }
-
     [self setMovableByWindowBackground: NO];
 
-    /* tell the fspanel to move itself to front next time it's triggered */
-    [[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: i_device];
-    [[[[VLCMain sharedInstance] getControls] getFSPanel] setActive: nil];
-
     if( [screen isMainScreen] )
         SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
 
     initialFrame = [self frame];
     [self setFrame:[screen frame] display:YES animate:YES];
+    [self setLevel:NSNormalWindowLevel];
+
+    /* tell the fspanel to move itself to front next time it's triggered */
+    [[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: i_device];
+    [[[[VLCMain sharedInstance] getControls] getFSPanel] setActive: nil];
+
     fullscreen = YES;
 }
 
@@ -1142,6 +1144,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
     [self setFrame:initialFrame display:YES animate:YES];
     [self setMovableByWindowBackground: YES];
+    if( var_GetBool( p_vout, "video-on-top" ) )
+        [self setLevel: NSStatusWindowLevel];
 }
 
 - (id)getVoutView // FIXME Naming scheme!