]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/vout.m
s/pl_Yield/pl_Hold/
[vlc] / modules / gui / macosx / vout.m
index b590f817d5d7aa1c3af569db2ab54fe22e7311ac..5880fcfa3f818da91ca44c9a0a2644c92df25cac 100644 (file)
@@ -145,7 +145,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (id)initWithFrame: (NSRect)frameRect
 {
-    [super initWithFrame: frameRect];
+    self = [super initWithFrame: frameRect];
     p_vout = NULL;
     o_view = nil;
     s_frame = &frameRect;
@@ -444,7 +444,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 - (void)manage
 {
     /* Disable Screensaver, when we're playing something, but allow it on pause */
-    if( !VLCIntf || !VLCIntf->p_sys || !VLCIntf->p_sys->i_play_status )
+    if( !VLCIntf || !VLCIntf->p_sys )
         return;
 
     if( VLCIntf->p_sys->i_play_status == PLAYING_S )
@@ -480,7 +480,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     if( i_pressed_modifiers & NSCommandKeyMask )
         val.i_int |= KEY_MODIFIER_COMMAND;
 
-    key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
+    key = [[[o_event charactersIgnoringModifiers] lowercaseString] characterAtIndex: 0];
 
     if( key )
     {
@@ -492,22 +492,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
                  [self toggleFullscreen];
              }
         }
-        else if ( key == ' ' )
+        else if ( p_vout )
         {
-            vlc_value_t val;
-            val.i_int = config_GetInt( p_vout, "key-play-pause" );
-            var_Set( p_vout->p_libvlc, "key-pressed", val );
-        }
-        else
-        {
-            val.i_int |= CocoaKeyToVLC( key );
+            if( key == ' ')
+                val.i_int = config_GetInt( p_vout, "key-play-pause" );
+            else
+                val.i_int |= (int)CocoaKeyToVLC( key );
             var_Set( p_vout->p_libvlc, "key-pressed", val );
         }
+        else NSLog( @"Could not send keyevent to VLC core" );
     }
     else
-    {
         [super keyDown: o_event];
-    }
 }
 
 - (void)mouseDown:(NSEvent *)o_event
@@ -773,7 +769,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 - (void)enterFullscreen
 {
     /* Save the settings for next playing item */
-    playlist_t * p_playlist = pl_Yield( p_real_vout );
+    playlist_t * p_playlist = pl_Hold( p_real_vout );
     var_SetBool( p_playlist, "fullscreen", true );
     pl_Release( p_real_vout );
 }
@@ -781,7 +777,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 - (void)leaveFullscreen
 {
     /* Save the settings for next playing item */
-    playlist_t * p_playlist = pl_Yield( p_real_vout );
+    playlist_t * p_playlist = pl_Hold( p_real_vout );
     var_SetBool( p_playlist, "fullscreen", false );
     pl_Release( p_real_vout );
 }
@@ -860,7 +856,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     /* 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;
@@ -881,15 +877,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];
 }
 
 
@@ -944,7 +940,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];
         }
@@ -1114,29 +1110,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;
 }
 
@@ -1151,6 +1140,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!