]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/vout.m
Support other displays fade out. Change video-device to point to the unique screen ID.
[vlc] / modules / gui / macosx / vout.m
index 77bbf130c12668cbc065105fc4b4ac4eccd25aca..c9671c119d3c8e5a1cc6a9b4c1e1c3c22e381060 100644 (file)
@@ -214,10 +214,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
                       (int)s_rect.size.width, (int)s_rect.size.height );
 
             text.psz_string = psz_temp;
-            val2.i_int = i;
+            val2.i_int = (int)[o_screen displayID];
             var_Change( p_real_vout, "video-device",
                         VLC_VAR_ADDCHOICE, &val2, &text );
-            if( i == i_device )
+            if( (int)[o_screen displayID] == i_device )
             {
                 var_Set( p_real_vout, "video-device", val2 );
             }
@@ -962,20 +962,13 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     b_embedded = var_GetBool( p_vout, "macosx-embedded" );
 
     /* Find out on which screen to open the window */
-    if( i_device <= 0 || i_device > (int)[o_screens count] )
-    {
-         /* No preference specified. Use the main screen */
+    o_screen = [NSScreen screenWithDisplayID: (CGDirectDisplayID)i_device];
+
+    if( !o_screen )
         o_screen = [NSScreen mainScreen];
-        i_device = [o_screens indexOfObject: o_screen];
-        if( o_screen == [o_screens objectAtIndex: 0] )
-            b_menubar_screen = VLC_TRUE;
-    }
-    else
-    {
-        i_device--;
-        o_screen = [o_screens objectAtIndex: i_device];
-        b_menubar_screen = ( i_device == 0 );
-    }
+
+    if( o_screen == [NSScreen mainScreen] )
+        b_menubar_screen = VLC_TRUE;
 
     if( p_vout->b_fullscreen )
     {
@@ -998,42 +991,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
               defer: YES screen: o_screen];
         
         if( b_black == VLC_TRUE )
-        {
-            CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
-            CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, true );
-            CGReleaseDisplayFadeReservation( token );
-            unsigned int i;
-            for( i = 0 ; i < [o_screens count]; i++)
-            {
-                struct
-                {
-                    CGDirectDisplayID displayID;
-                    CGGammaValue redMin, redMax, redGamma,
-                                 greenMin, greenMax, greenGamma,
-                                 blueMin, blueMax, blueGamma;
-                } dispSettings;
-                CGDisplayCount dspyCnt;
-                CGPoint gPoint;
-
-                if( i == (unsigned int)i_device ) continue;
-
-                screen_rect = [[o_screens objectAtIndex: i] frame];
-
-                gPoint.x = screen_rect.origin.x;
-                gPoint.y = screen_rect.origin.y;
-                CGGetDisplaysWithPoint( gPoint, 1, &(dispSettings.displayID), &dspyCnt);
-                CGGetDisplayTransferByFormula(
-                    dispSettings.displayID,
-                    &dispSettings.redMin, &dispSettings.redMax, &dispSettings.redGamma,
-                    &dispSettings.greenMin, &dispSettings.greenMax, &dispSettings.greenGamma,
-                    &dispSettings.blueMin, &dispSettings.blueMax, &dispSettings.blueGamma );
-                CGSetDisplayTransferByFormula(
-                    dispSettings.displayID,
-                    dispSettings.redMin,   0, dispSettings.redGamma,
-                    dispSettings.greenMin, 0, dispSettings.greenGamma,
-                    dispSettings.blueMin,  0, dispSettings.blueGamma );
-            }
-        }
+            [o_screen blackoutOtherScreens];
+
         if( b_menubar_screen )
         {
             SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);