]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/vout.m
* implement the error panel correctly (for the records: not < 10.3 compatible)
[vlc] / modules / gui / macosx / vout.m
index 3bb355f64bb43dd8ff492540d0c51f596c2c4129..6be49cc14fa6a5b51c2e9a80d6ef25ae273c3d27 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];
              }
@@ -458,9 +460,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
         {
             case NSLeftMouseDown:
             {
-                var_Get( p_vout, "mouse-button-down", &val );
-                val.i_int |= 1;
-                var_Set( p_vout, "mouse-button-down", val );
+                if( [o_event clickCount] <= 1 )
+                {
+                    /* single clicking */
+                    var_Get( p_vout, "mouse-button-down", &val );
+                    val.i_int |= 1;
+                    var_Set( p_vout, "mouse-button-down", val );
+                }
+                else
+                {
+                    /* multiple clicking */
+                    [self toggleFullscreen];
+                }
             }
             break;
 
@@ -770,6 +781,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 +869,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;
@@ -934,9 +958,9 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
     b_init_ok = VLC_FALSE;
 
-    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 +991,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 );
@@ -1005,10 +1030,9 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
         }
         if( b_menubar_screen )
         {
-            BeginFullScreen( &p_fullscreen_state, NULL, 0, 0,
-                             NULL, NULL, fullScreenAllowEvents );
+            SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
         }
-        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 +1077,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];
@@ -1095,9 +1114,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (id) closeReal: (id) sender
 {
-    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);
@@ -1105,6 +1122,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
         CGReleaseDisplayFadeReservation( token);
         CGDisplayRestoreColorSyncSettings();
     }
+    SetSystemUIMode( kUIModeNormal, 0);
     [super close];
     return NULL;
 }