>From 31b4e113cd9a11427c623db34d45cf7a56707594 Mon Sep 17 00:00:00 2001
From: Ron Frederick <ronf@timeheart.net>
Date: Thu, 18 Feb 2010 20:46:54 -0800
Subject: [PATCH] MacOS GUI: Tie display fade to "Black out" preference

Change the MacOS GUI to trigger the fade of all the displays to black
when entering & leaving full screen mode only if the "Black out other
displays" preference is set.
---
 modules/gui/macosx/embeddedwindow.m |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m
index 6b89236..a14f0b2 100644
--- a/modules/gui/macosx/embeddedwindow.m
+++ b/modules/gui/macosx/embeddedwindow.m
@@ -440,8 +440,11 @@
              * simply fade the display */
             CGDisplayFadeReservationToken token;
  
-            CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
-            CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+            if( blackout_other_displays )
+            {
+                CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
+                CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+            }
  
             if ([screen isMainScreen])
                 SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
@@ -457,8 +460,11 @@
 
             [o_fullscreen_window setFrame:screen_rect display:YES];
 
-            CGDisplayFade( token, 0.3, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
-            CGReleaseDisplayFadeReservation( token);
+            if( blackout_other_displays )
+            {
+                CGDisplayFade( token, 0.3, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
+                CGReleaseDisplayFadeReservation( token);
+            }
 
             /* Will release the lock */
             [self hasBecomeFullscreen];
@@ -560,6 +566,7 @@
 {
     NSMutableDictionary *dict1, *dict2;
     NSRect frame;
+    BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" );
 
     [self lockFullscreenAnimation];
 
@@ -582,8 +589,11 @@
         * simply fade the display */
         CGDisplayFadeReservationToken token;
 
-        CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
-        CGDisplayFade( token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+        if( blackout_other_displays )
+        {
+            CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
+            CGDisplayFade( token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+        }
 
         [[[[VLCMain sharedInstance] controls] fspanel] setNonActive: nil];
         SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
@@ -595,8 +605,12 @@
          * here */
         b_window_is_invisible = YES;
 
-        CGDisplayFade( token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
-        CGReleaseDisplayFadeReservation( token);
+        if( blackout_other_displays )
+        {
+            CGDisplayFade( token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
+            CGReleaseDisplayFadeReservation( token);
+        }
+
         return;
     }
 
-- 
1.7.0

