+ /* init our fake object attribute */
+ blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1];
+}
+
++ (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
+{
+ int i;
+
+ for( i = 0; i < [[NSScreen screens] count]; i++ )
+ {
+ NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
+ if([screen displayID] == displayID)
+ return screen;
+ }
+ return nil;
+}
+
+- (BOOL)isMainScreen
+{
+ return ([self displayID] == [[[NSScreen screens] objectAtIndex:0] displayID]);
+}
+
+- (BOOL)isScreen: (NSScreen*)screen
+{
+ return ([self displayID] == [screen displayID]);
+}
+
+- (CGDirectDisplayID)displayID
+{
+ return (CGDirectDisplayID)_screenNumber;
+}
+
+- (void)blackoutOtherScreens
+{
+ unsigned int i;
+
+ /* Free our previous blackout window (follow blackoutWindow alloc strategy) */
+ [blackoutWindows makeObjectsPerformSelector:@selector(close)];
+ [blackoutWindows removeAllObjects];
+
+ for(i = 0; i < [[NSScreen screens] count]; i++)
+ {
+ NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
+ VLCWindow *blackoutWindow;
+ NSRect screen_rect;
+
+ if([self isScreen: screen])
+ continue;
+
+ screen_rect = [screen frame];
+ screen_rect.origin.x = screen_rect.origin.y = 0;
+
+ /* blackoutWindow alloc strategy
+ - The NSMutableArray blackoutWindows has the blackoutWindow references
+ - blackoutOtherDisplays is responsible for alloc/releasing its Windows
+ */
+ blackoutWindow = [[VLCWindow alloc] initWithContentRect: screen_rect styleMask: NSBorderlessWindowMask
+ backing: NSBackingStoreBuffered defer: NO screen: screen];
+ [blackoutWindow setBackgroundColor:[NSColor blackColor]];
+ [blackoutWindow setLevel: NSFloatingWindowLevel]; /* Disappear when Expose is triggered */
+
+ [blackoutWindow displayIfNeeded];
+ [blackoutWindow orderFront: self animate: YES];
+
+ [blackoutWindows addObject: blackoutWindow];
+ [blackoutWindow release];
+
+ if( [screen isMainScreen ] )
+ SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+ }
+}
+
++ (void)unblackoutScreens
+{
+ unsigned int i;
+
+ for(i = 0; i < [blackoutWindows count]; i++)
+ {
+ VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i];
+ [blackoutWindow closeAndAnimate: YES];
+ }
+
+ SetSystemUIMode( kUIModeNormal, 0);