]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.m
macosx: move fullscreen logic to VLCVoutController and remove now unneeded helper...
[vlc] / modules / gui / macosx / intf.m
index 4607a16eae42216fa89ad198eac1d79a33ebc6df..fcb005ccc479f87fe0d26d85c49aa82b664efb21 100644 (file)
@@ -172,8 +172,8 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
         int i_full = 1;
 
         SEL sel = @selector(setFullscreen:forWindow:);
-        NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[VLCMain sharedInstance] methodSignatureForSelector:sel]];
-        [inv setTarget:[VLCMain sharedInstance]];
+        NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[[VLCMain sharedInstance] voutController] methodSignatureForSelector:sel]];
+        [inv setTarget:[[VLCMain sharedInstance] voutController]];
         [inv setSelector:sel];
         [inv setArgument:&i_full atIndex:2];
         [inv setArgument:&p_wnd atIndex:3];
@@ -236,8 +236,8 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
             int i_full = va_arg(args, int);
 
             SEL sel = @selector(setFullscreen:forWindow:);
-            NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[VLCMain sharedInstance] methodSignatureForSelector:sel]];
-            [inv setTarget:[VLCMain sharedInstance]];
+            NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[[VLCMain sharedInstance] voutController] methodSignatureForSelector:sel]];
+            [inv setTarget:[[VLCMain sharedInstance] voutController]];
             [inv setSelector:sel];
             [inv setArgument:&i_full atIndex:2]; // starting at 2!
             [inv setArgument:&p_wnd atIndex:3];
@@ -932,7 +932,7 @@ static VLCMain *_o_sharedMainInstance = nil;
         int keyRepeat = (keyFlags & 0x1);
 
         if (keyCode == NX_KEYTYPE_PLAY && keyState == 0)
-            [[VLCCoreInteraction sharedInstance] play];
+            [[VLCCoreInteraction sharedInstance] playOrPause];
 
         if ((keyCode == NX_KEYTYPE_FAST || keyCode == NX_KEYTYPE_NEXT) && !b_mediakeyJustJumped) {
             if (keyState == 0 && keyRepeat == 0)
@@ -1078,13 +1078,13 @@ static VLCMain *_o_sharedMainInstance = nil;
             [[VLCCoreInteraction sharedInstance] toggleFullscreen];
             break;
         case k2009RemoteButtonPlay:
-            [[VLCCoreInteraction sharedInstance] play];
+            [[VLCCoreInteraction sharedInstance] playOrPause];
             break;
         case kRemoteButtonPlay:
             if (count >= 2)
                 [[VLCCoreInteraction sharedInstance] toggleFullscreen];
             else
-                [[VLCCoreInteraction sharedInstance] play];
+                [[VLCCoreInteraction sharedInstance] playOrPause];
             break;
         case kRemoteButtonVolume_Plus:
             if (config_GetInt(VLCIntf, "macosx-appleremote-sysvol"))
@@ -1192,7 +1192,7 @@ static VLCMain *_o_sharedMainInstance = nil;
         }
 
         if (key == 0x0020) { // space key
-            [[VLCCoreInteraction sharedInstance] play];
+            [[VLCCoreInteraction sharedInstance] playOrPause];
             return YES;
         }
 
@@ -1253,45 +1253,6 @@ static VLCMain *_o_sharedMainInstance = nil;
 
 #pragma mark -
 #pragma mark Interface updaters
-- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd
-{
-    if (!p_intf || (!b_nativeFullscreenMode && !p_wnd))
-        return;
-    playlist_t * p_playlist = pl_Get(p_intf);
-    BOOL b_fullscreen = i_full;
-
-    if (!var_GetBool(p_playlist, "fullscreen") != !b_fullscreen)
-        var_SetBool(p_playlist, "fullscreen", b_fullscreen);
-
-    if (b_nativeFullscreenMode) {
-        // this is called twice in certain situations, so only toogle if we really need to
-        if ((b_fullscreen && !([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen)) ||
-            (!b_fullscreen &&  ([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen)))
-            [o_mainwindow toggleFullScreen: self];
-
-        if (b_fullscreen)
-            [NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
-        else
-            [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
-    } else {
-        assert(p_wnd);
-
-        if (b_fullscreen) {
-            input_thread_t * p_input = pl_CurrentInput(p_intf);
-            if (p_input != NULL && [self activeVideoPlayback]) {
-                // activate app, as method can also be triggered from outside the app (prevents nasty window layout)
-                [NSApp activateIgnoringOtherApps:YES];
-                [o_vout_controller updateWindow:p_wnd withSelector:@selector(enterFullscreen)];
-
-            }
-            if (p_input)
-                vlc_object_release(p_input);
-        } else {
-            // leaving fullscreen is always allowed
-            [o_vout_controller updateWindow:p_wnd withSelector:@selector(leaveFullscreen)];
-        }
-    }
-}
 
 - (void)PlaylistItemChanged
 {