]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/vout.m
* made the look-for-update process faster and more error tolerant
[vlc] / modules / gui / macosx / vout.m
index 3bb355f64bb43dd8ff492540d0c51f596c2c4129..8098d8eaedf111c83e9bd18ea0371d56e516e521 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vout.m: MacOS X video output module
  *****************************************************************************
- * Copyright (C) 2001-2005 the VideoLAN team
+ * Copyright (C) 2001-2006 the VideoLAN team
  * $Id$
  *
  * Authors: Colin Delacroix <colin@zoy.org>
@@ -97,7 +97,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     }
     else
     {
-        msg_Warn( VLCIntf, "Cannot find Video Output");
+        msg_Warn( VLCIntf, "cannot find Video Output");
     }
 }
 
@@ -358,6 +358,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 {
     vlc_value_t val;
 
+    if( !p_real_vout ) return;
     if( var_Get( p_real_vout, "video-on-top", &val )>=0 && val.b_bool)
     {
         val.b_bool = VLC_FALSE;
@@ -372,6 +373,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 - (void)toggleFullscreen
 {
     vlc_value_t val;
+    if( !p_real_vout ) return;
     var_Get( p_real_vout, "fullscreen", &val );
     val.b_bool = !val.b_bool;
     var_Set( p_real_vout, "fullscreen", val );
@@ -425,7 +427,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
         /* Escape should always get you out of fullscreen */
         if( key == (unichar) 0x1b )
         {
-             if( [self isFullscreen] )
+             if( p_real_vout && [self isFullscreen] )
              {
                  [self toggleFullscreen];
              }
@@ -770,6 +772,13 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
                                                     frame: s_arg_frame];
     [self updateTitle];
     [view setFrame: [self frame]];
+
+    if( var_GetBool( p_real_vout, "video-on-top" ) )
+    {
+        [o_window setLevel: NSStatusWindowLevel];
+    }
+
+
     [o_window setAcceptsMouseMovedEvents: TRUE];
     return b_return;
 }
@@ -851,6 +860,12 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
         o_window = [self window];
         [o_window makeKeyAndOrderFront: self];
         [o_window setAcceptsMouseMovedEvents: TRUE];
+
+        if( var_GetBool( p_real_vout, "video-on-top" ) )
+        {
+            [o_window setLevel: NSStatusWindowLevel];
+        }
+
         [view setFrameSize: [self frame].size];
     }
     return b_return;
@@ -937,6 +952,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     p_fullscreen_state = NULL;
     p_real_vout = [VLCVoutView getRealVout: p_vout];
     i_device = var_GetInteger( p_real_vout->p_vlc, "video-device" );
+    b_black = var_GetBool( p_real_vout->p_vlc, "macosx-black" );
 
     /* Find out on which screen to open the window */
     if( i_device <= 0 || i_device > (int)[o_screens count] )
@@ -967,6 +983,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
               defer: YES screen: o_screen];
 
         if( var_GetBool( p_real_vout, "macosx-black" ) )
+        if( b_black == VLC_TRUE )
         {
             CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
             CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, true );
@@ -1008,7 +1025,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
             BeginFullScreen( &p_fullscreen_state, NULL, 0, 0,
                              NULL, NULL, fullScreenAllowEvents );
         }
-        if( var_GetBool( p_real_vout, "macosx-black" ) )
+        if( b_black == VLC_TRUE )
         {
             CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
             CGDisplayFade( token, 2 , kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, false );
@@ -1053,11 +1070,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
         [self setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
 
-        if( var_GetBool( p_real_vout, "video-on-top" ) )
-        {
-            [self setLevel: NSStatusWindowLevel];
-        }
-
         if( !s_frame )
         {
             [self center];
@@ -1097,7 +1109,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 {
     if( p_fullscreen_state )
         EndFullScreen( p_fullscreen_state, 0 );
-    if( var_GetBool( p_vout, "macosx-black" ) )
+    if( b_black == VLC_TRUE )
     {
         CGDisplayFadeReservationToken token;
         CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);